use of org.infinispan.persistence.rocksdb.configuration.RocksDBStoreConfigurationBuilder in project infinispan by infinispan.
the class TargetStoreFactory method getInitializedStoreBuilder.
private static StoreConfigurationBuilder getInitializedStoreBuilder(StoreProperties props) {
PersistenceConfigurationBuilder persistenceBuilder = new ConfigurationBuilder().persistence();
StoreType storeType = StoreType.valueOf(props.get(TYPE).toUpperCase());
switch(storeType) {
case LEVELDB:
case JDBC_BINARY:
case JDBC_MIXED:
throw new CacheConfigurationException(String.format("%s cannot be a target store as it no longer exists", storeType));
case JDBC_STRING:
return JdbcConfigurationUtil.configureStore(props, new JdbcStringBasedStoreConfigurationBuilder(persistenceBuilder));
case ROCKSDB:
props.required(LOCATION);
String location = props.get(LOCATION);
RocksDBStoreConfigurationBuilder builder = new RocksDBStoreConfigurationBuilder(persistenceBuilder);
builder.location(location).expiredLocation(location + "-expired-");
String compressionType = props.get(COMPRESSION);
if (compressionType != null)
builder.compressionType(CompressionType.valueOf(compressionType.toUpperCase()));
return builder;
case SINGLE_FILE_STORE:
props.required(LOCATION);
return new SingleFileStoreConfigurationBuilder(persistenceBuilder).location(props.get(LOCATION));
case SOFT_INDEX_FILE_STORE:
props.required(LOCATION);
props.required(INDEX_LOCATION);
return new SoftIndexFileStoreConfigurationBuilder(persistenceBuilder).dataLocation(props.get(LOCATION)).indexLocation(props.get(INDEX_LOCATION));
default:
throw new CacheConfigurationException(String.format("Unknown store type '%s'", storeType));
}
}
use of org.infinispan.persistence.rocksdb.configuration.RocksDBStoreConfigurationBuilder in project infinispan by infinispan.
the class RocksDBStoreFunctionalTest method testUnknownProperties.
public void testUnknownProperties() {
ConfigurationBuilder cb = getDefaultCacheConfiguration();
new File(tmpDirectory).mkdirs();
RocksDBStoreConfigurationBuilder storeConfigurationBuilder = createStoreBuilder(cb.persistence());
storeConfigurationBuilder.addProperty(RocksDBStore.DATABASE_PROPERTY_NAME_WITH_SUFFIX + "unknown", "some_value");
Configuration c = cb.build();
String cacheName = "rocksdb-unknown-properties";
TestingUtil.defineConfiguration(cacheManager, cacheName, c);
try {
cacheManager.getCache(cacheName);
} catch (Throwable t) {
Throwable cause;
while ((cause = t.getCause()) != null) {
t = cause;
}
Exceptions.assertException(CacheConfigurationException.class, ".*unknown\\ property$", t);
}
// Stop the cache manager early, otherwise cleanup won't work properly
TestingUtil.killCacheManagers(cacheManager);
}
use of org.infinispan.persistence.rocksdb.configuration.RocksDBStoreConfigurationBuilder in project infinispan by infinispan.
the class RocksDBStoreFunctionalTest method testKnownProperties.
public void testKnownProperties() {
ConfigurationBuilder cb = getDefaultCacheConfiguration();
new File(tmpDirectory).mkdirs();
RocksDBStoreConfigurationBuilder storeConfigurationBuilder = createStoreBuilder(cb.persistence());
String dbOptionName = "max_background_compactions";
String dbOptionValue = "2";
storeConfigurationBuilder.addProperty(RocksDBStore.DATABASE_PROPERTY_NAME_WITH_SUFFIX + dbOptionName, dbOptionValue);
String columnFamilyOptionName = "write_buffer_size";
String columnFamilyOptionValue = "96MB";
storeConfigurationBuilder.addProperty(RocksDBStore.COLUMN_FAMILY_PROPERTY_NAME_WITH_SUFFIX + columnFamilyOptionName, columnFamilyOptionValue);
Configuration c = cb.build();
String cacheName = "rocksdb-known-properties";
TestingUtil.defineConfiguration(cacheManager, cacheName, c);
// No easy way to ascertain if options are set, however if cache starts up it must have applied them,
// since otherwise this will fail like the unkonwn properties method
assertNotNull(cacheManager.getCache(cacheName));
}
use of org.infinispan.persistence.rocksdb.configuration.RocksDBStoreConfigurationBuilder in project infinispan by infinispan.
the class RocksDBStoreTest method createCacheStoreConfig.
protected RocksDBStoreConfigurationBuilder createCacheStoreConfig(PersistenceConfigurationBuilder lcb) {
RocksDBStoreConfigurationBuilder cfg = lcb.addStore(RocksDBStoreConfigurationBuilder.class);
cfg.segmented(segmented);
cfg.location(tmpDirectory);
cfg.expiredLocation(tmpDirectory);
cfg.clearThreshold(2);
return cfg;
}
use of org.infinispan.persistence.rocksdb.configuration.RocksDBStoreConfigurationBuilder in project infinispan by infinispan.
the class RocksDBMultiCacheStoreFunctionalTest method buildCacheStoreConfig.
@Override
protected RocksDBStoreConfigurationBuilder buildCacheStoreConfig(PersistenceConfigurationBuilder p, String discriminator) {
RocksDBStoreConfigurationBuilder store = p.addStore(RocksDBStoreConfigurationBuilder.class);
store.location(Paths.get(tmpDir.getAbsolutePath(), "rocksdb", "data" + discriminator).toString());
store.expiredLocation(Paths.get(tmpDir.getAbsolutePath(), "rocksdb", "expired-data-" + discriminator).toString());
return store;
}
Aggregations