use of org.infinispan.persistence.sifs.configuration.SoftIndexFileStoreConfigurationBuilder 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.sifs.configuration.SoftIndexFileStoreConfigurationBuilder in project infinispan by infinispan.
the class PersistenceConfigurationBuilder method addSoftIndexFileStore.
/**
* Adds a soft index file cache store.
* @return the configuration for a soft index file store
*/
public SoftIndexFileStoreConfigurationBuilder addSoftIndexFileStore() {
SoftIndexFileStoreConfigurationBuilder builder = new SoftIndexFileStoreConfigurationBuilder(this);
this.stores.add(builder);
return builder;
}
use of org.infinispan.persistence.sifs.configuration.SoftIndexFileStoreConfigurationBuilder in project infinispan by infinispan.
the class CacheParser method parseFileStore.
protected void parseFileStore(ConfigurationReader reader, ConfigurationBuilderHolder holder) {
SoftIndexFileStoreConfigurationBuilder fileStoreBuilder = null;
PersistenceConfigurationBuilder persistence = holder.getCurrentConfigurationBuilder().persistence();
AbstractStoreConfigurationBuilder<?, ?> actualStoreConfig;
int majorSchema = reader.getSchema().getMajor();
boolean legacyFileStore = false;
if (majorSchema < 13) {
parseSingleFileStore(reader, holder);
return;
} else if (majorSchema == 13) {
fileStoreBuilder = persistence.addStore(SFSToSIFSConfigurationBuilder.class);
actualStoreConfig = fileStoreBuilder;
legacyFileStore = true;
} else {
fileStoreBuilder = persistence.addSoftIndexFileStore();
actualStoreConfig = fileStoreBuilder;
}
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeName(i));
switch(attribute) {
case RELATIVE_TO:
{
if (reader.getSchema().since(11, 0))
throw ParseUtils.attributeRemoved(reader, i);
ignoreAttribute(reader, i);
break;
}
case PATH:
{
fileStoreBuilder.dataLocation(value);
fileStoreBuilder.indexLocation(value);
break;
}
case FRAGMENTATION_FACTOR:
case MAX_ENTRIES:
{
if (legacyFileStore) {
ignoreAttribute(reader, i);
} else {
throw ParseUtils.attributeRemoved(reader, i);
}
break;
}
case OPEN_FILES_LIMIT:
if (fileStoreBuilder != null) {
fileStoreBuilder.openFilesLimit(Integer.parseInt(value));
} else {
throw ParseUtils.unexpectedAttribute(reader, i);
}
break;
case COMPACTION_THRESHOLD:
if (fileStoreBuilder != null) {
fileStoreBuilder.compactionThreshold(Double.parseDouble(value));
} else {
throw ParseUtils.unexpectedAttribute(reader, i);
}
break;
case PURGE:
{
actualStoreConfig.purgeOnStartup(Boolean.parseBoolean(value));
break;
}
default:
{
parseStoreAttribute(reader, i, actualStoreConfig);
}
}
}
while (reader.inTag()) {
Element element = Element.forName(reader.getLocalName());
switch(element) {
case DATA:
if (fileStoreBuilder != null) {
parseData(reader, fileStoreBuilder);
} else {
throw ParseUtils.unexpectedElement(reader);
}
break;
case INDEX:
if (fileStoreBuilder != null) {
parseIndex(reader, fileStoreBuilder);
} else {
throw ParseUtils.unexpectedElement(reader);
}
break;
default:
parseStoreElement(reader, actualStoreConfig);
}
}
}
Aggregations