use of com.thinkaurelius.titan.diskstorage.configuration.Configuration in project titan by thinkaurelius.
the class BerkeleyJEStoreManager method beginTransaction.
@Override
public BerkeleyJETx beginTransaction(final BaseTransactionConfig txCfg) throws BackendException {
try {
Transaction tx = null;
Configuration effectiveCfg = new MergedConfiguration(txCfg.getCustomOptions(), getStorageConfig());
if (transactional) {
TransactionConfig txnConfig = new TransactionConfig();
ConfigOption.getEnumValue(effectiveCfg.get(ISOLATION_LEVEL), IsolationLevel.class).configure(txnConfig);
tx = environment.beginTransaction(null, txnConfig);
}
BerkeleyJETx btx = new BerkeleyJETx(tx, ConfigOption.getEnumValue(effectiveCfg.get(LOCK_MODE), LockMode.class), txCfg);
if (log.isTraceEnabled()) {
log.trace("Berkeley tx created", new TransactionBegin(btx.toString()));
}
return btx;
} catch (DatabaseException e) {
throw new PermanentBackendException("Could not start BerkeleyJE transaction", e);
}
}
use of com.thinkaurelius.titan.diskstorage.configuration.Configuration in project titan by thinkaurelius.
the class AbstractCassandraStoreManager method getFeatures.
@Override
public StoreFeatures getFeatures() {
if (features == null) {
Configuration global = GraphDatabaseConfiguration.buildGraphConfiguration().set(CASSANDRA_READ_CONSISTENCY, "QUORUM").set(CASSANDRA_WRITE_CONSISTENCY, "QUORUM").set(METRICS_PREFIX, GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT);
Configuration local = GraphDatabaseConfiguration.buildGraphConfiguration().set(CASSANDRA_READ_CONSISTENCY, "LOCAL_QUORUM").set(CASSANDRA_WRITE_CONSISTENCY, "LOCAL_QUORUM").set(METRICS_PREFIX, GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT);
StandardStoreFeatures.Builder fb = new StandardStoreFeatures.Builder();
fb.batchMutation(true).distributed(true);
fb.timestamps(true).cellTTL(true);
fb.keyConsistent(global, local);
boolean keyOrdered;
switch(getPartitioner()) {
case RANDOM:
keyOrdered = false;
fb.keyOrdered(keyOrdered).orderedScan(false).unorderedScan(true);
break;
case BYTEORDER:
keyOrdered = true;
fb.keyOrdered(keyOrdered).orderedScan(true).unorderedScan(false);
break;
default:
throw new IllegalArgumentException("Unrecognized partitioner: " + getPartitioner());
}
switch(getDeployment()) {
case REMOTE:
fb.multiQuery(true);
break;
case LOCAL:
fb.multiQuery(true).localKeyPartition(keyOrdered);
break;
case EMBEDDED:
fb.multiQuery(false).localKeyPartition(keyOrdered);
break;
default:
throw new IllegalArgumentException("Unrecognized deployment mode: " + getDeployment());
}
features = fb.build();
}
return features;
}
use of com.thinkaurelius.titan.diskstorage.configuration.Configuration in project titan by thinkaurelius.
the class RidGenerationTest method testThreadBasedRidGeneration.
@Test
public void testThreadBasedRidGeneration() throws InterruptedException {
Configuration c = Configuration.EMPTY;
int n = 8;
// n <= 1 is useless
Preconditions.checkArgument(1 < n);
Collection<byte[]> rids = Collections.synchronizedSet(new HashSet<byte[]>());
RidThread[] threads = new RidThread[n];
for (int i = 0; i < n; i++) {
threads[i] = new RidThread(rids, c);
}
for (int i = 0; i < n; i++) {
threads[i].start();
}
for (int i = 0; i < n; i++) {
threads[i].join();
}
//TODO: rewrite test case in terms of GraphDatabaseConfiguration
//assertEquals(n, rids.size());
}
use of com.thinkaurelius.titan.diskstorage.configuration.Configuration in project titan by thinkaurelius.
the class HBaseStoreManager method getFeatures.
@Override
public StoreFeatures getFeatures() {
Configuration c = GraphDatabaseConfiguration.buildGraphConfiguration();
StandardStoreFeatures.Builder fb = new StandardStoreFeatures.Builder().orderedScan(true).unorderedScan(true).batchMutation(true).multiQuery(true).distributed(true).keyOrdered(true).storeTTL(true).timestamps(true).preferredTimestamps(PREFERRED_TIMESTAMPS).keyConsistent(c);
try {
fb.localKeyPartition(getDeployment() == Deployment.LOCAL);
} catch (Exception e) {
logger.warn("Unexpected exception during getDeployment()", e);
}
return fb.build();
}
use of com.thinkaurelius.titan.diskstorage.configuration.Configuration in project titan by thinkaurelius.
the class ElasticSearchConfigTest method testLocalNodeUsingYaml.
@Test
public void testLocalNodeUsingYaml() throws BackendException, InterruptedException {
String baseDir = Joiner.on(File.separator).join("target", "es", "jvmlocal_yml");
assertFalse(new File(baseDir + File.separator + "data").exists());
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME);
config.set(INDEX_CONF_FILE, Joiner.on(File.separator).join("target", "test-classes", "es_jvmlocal.yml"), INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = new ElasticSearchIndex(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
assertTrue(new File(baseDir + File.separator + "data").exists());
}
Aggregations