本文整理汇总了Java中com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig类的典型用法代码示例。如果您正苦于以下问题:Java StandardBaseTransactionConfig类的具体用法?Java StandardBaseTransactionConfig怎么用?Java StandardBaseTransactionConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardBaseTransactionConfig类属于com.thinkaurelius.titan.diskstorage.util包,在下文中一共展示了StandardBaseTransactionConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWriteConsistencyLevel
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testWriteConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration();
mc.set(CASSANDRA_WRITE_CONSISTENCY, writeLevel.name());
b.customOptions(mc);
b.timestampProvider(TimestampProviders.MICRO);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getWriteConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
示例2: testReadConsistencyLevel
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testReadConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration();
mc.set(CASSANDRA_READ_CONSISTENCY, writeLevel.name());
b.timestampProvider(TimestampProviders.MICRO);
b.customOptions(mc);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getReadConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
示例3: testDataSequential
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
public void testDataSequential() throws Exception {
loadData(200000,2);
close();
KeyColumnValueStoreManager manager = openStorageManager();
KeyColumnValueStore store = manager.openDatabase(Backend.EDGESTORE_NAME);
SliceQuery query = new SliceQuery(BufferUtil.zeroBuffer(8),BufferUtil.oneBuffer(8));
query.setLimit(2);
// DAVID
StopwatchTitan watch = StopwatchTitan.createStarted();
StoreTransaction txh = manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MILLI));
KeyIterator iter = store.getKeys(query,txh);
int numV = 0;
while(iter.hasNext()) {
StaticBuffer key = iter.next();
RecordIterator<Entry> entries = iter.getEntries();
assertEquals(2, Iterators.size(entries));
numV++;
}
iter.close();
txh.commit();
System.out.println("Time taken: " + watch.elapsed(TimeUnit.MILLISECONDS));
System.out.println("Num Vertices: " + numV);
store.close();
manager.close();
}
示例4: getConfig
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Override
public WriteConfiguration getConfig() {
final KeyColumnValueStoreManager manager = new InMemoryStoreManager(Configuration.EMPTY);
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.TIMESTAMP_PROVIDER, TimestampProviders.MICRO);
try {
return new KCVSConfiguration(new BackendOperation.TransactionalProvider() {
@Override
public StoreTransaction openTx() throws BackendException {
return manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MICRO, manager.getFeatures().getKeyConsistentTxConfig()));
}
@Override
public void close() throws BackendException {
manager.close();
}
}, config, manager.openDatabase("titan"),"general");
} catch (BackendException e) {
throw new RuntimeException(e);
}
}
示例5: simpleWriteAndQuery
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
private void simpleWriteAndQuery(IndexProvider idx) throws BackendException, InterruptedException {
final Duration maxWrite = Duration.ofMillis(2000L);
final String storeName = "jvmlocal_test_store";
final KeyInformation.IndexRetriever indexRetriever = IndexProviderTest.getIndexRetriever(IndexProviderTest.getMapping(idx.getFeatures()));
BaseTransactionConfig txConfig = StandardBaseTransactionConfig.of(TimestampProviders.MILLI);
IndexTransaction itx = new IndexTransaction(idx, indexRetriever, txConfig, maxWrite);
assertEquals(0, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "ali"))).size());
itx.add(storeName, "doc", IndexProviderTest.NAME, "alice", false);
itx.commit();
Thread.sleep(1500L); // Slightly longer than default 1s index.refresh_interval
itx = new IndexTransaction(idx, indexRetriever, txConfig, maxWrite);
assertEquals(0, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "zed"))).size());
assertEquals(1, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "ali"))).size());
itx.rollback();
}
示例6: getStandaloneGlobalConfiguration
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
public static KCVSConfiguration getStandaloneGlobalConfiguration(final KeyColumnValueStoreManager manager,
final Configuration config) {
try {
final StoreFeatures features = manager.getFeatures();
return getGlobalConfiguration(new BackendOperation.TransactionalProvider() {
@Override
public StoreTransaction openTx() throws BackendException {
return manager.beginTransaction(StandardBaseTransactionConfig.of(config.get(TIMESTAMP_PROVIDER),features.getKeyConsistentTxConfig()));
}
@Override
public void close() throws BackendException {
manager.close();
}
},manager.openDatabase(SYSTEM_PROPERTIES_STORE_NAME),config);
} catch (BackendException e) {
throw new TitanException("Could not open global configuration",e);
}
}
示例7: testDataSequential
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
public void testDataSequential() throws Exception {
loadData(200000,2);
close();
KeyColumnValueStoreManager manager = openStorageManager();
KeyColumnValueStore store = manager.openDatabase(Backend.EDGESTORE_NAME);
SliceQuery query = new SliceQuery(BufferUtil.zeroBuffer(8),BufferUtil.oneBuffer(8));
query.setLimit(2);
Stopwatch watch = Stopwatch.createStarted();
StoreTransaction txh = manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MILLI));
KeyIterator iter = store.getKeys(query,txh);
int numV = 0;
while(iter.hasNext()) {
StaticBuffer key = iter.next();
RecordIterator<Entry> entries = iter.getEntries();
assertEquals(2, Iterators.size(entries));
numV++;
}
iter.close();
txh.commit();
System.out.println("Time taken: " + watch.elapsed(TimeUnit.MILLISECONDS));
System.out.println("Num Vertices: " + numV);
store.close();
manager.close();
}
示例8: testWriteConsistencyLevel
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testWriteConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildConfiguration();
mc.set(CASSANDRA_WRITE_CONSISTENCY, writeLevel.name());
b.customOptions(mc);
b.timestampProvider(Timestamps.MICRO);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getWriteConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
示例9: testReadConsistencyLevel
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testReadConsistencyLevel() {
int levelsChecked = 0;
// Test whether CassandraTransaction honors the write consistency level option
for (CLevel writeLevel : CLevel.values()) {
StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();
ModifiableConfiguration mc = GraphDatabaseConfiguration.buildConfiguration();
mc.set(CASSANDRA_READ_CONSISTENCY, writeLevel.name());
b.timestampProvider(Timestamps.MICRO);
b.customOptions(mc);
CassandraTransaction ct = new CassandraTransaction(b.build());
assertEquals(writeLevel, ct.getReadConsistencyLevel());
levelsChecked++;
}
// Sanity check: if CLevel.values was empty, something is wrong with the test
Preconditions.checkState(0 < levelsChecked);
}
示例10: testDataSequential
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
public void testDataSequential() throws Exception {
loadData(200000,2);
close();
KeyColumnValueStoreManager manager = openStorageManager();
KeyColumnValueStore store = manager.openDatabase(Backend.EDGESTORE_NAME);
SliceQuery query = new SliceQuery(BufferUtil.zeroBuffer(8),BufferUtil.oneBuffer(8));
query.setLimit(2);
Stopwatch watch = new Stopwatch();
watch.start();
StoreTransaction txh = manager.beginTransaction(StandardBaseTransactionConfig.of(Timestamps.MILLI));
KeyIterator iter = store.getKeys(query,txh);
int numV = 0;
while(iter.hasNext()) {
StaticBuffer key = iter.next();
RecordIterator<Entry> entries = iter.getEntries();
assertEquals(2, Iterators.size(entries));
numV++;
}
iter.close();
txh.commit();
System.out.println("Time taken: " + watch.elapsed(TimeUnit.MILLISECONDS));
System.out.println("Num Vertices: " + numV);
store.close();
manager.close();
}
示例11: getConfig
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Override
public WriteConfiguration getConfig() {
final KeyColumnValueStoreManager manager = new InMemoryStoreManager(Configuration.EMPTY);
try {
return new KCVSConfiguration(new BackendOperation.TransactionalProvider() {
@Override
public StoreTransaction openTx() throws BackendException {
return manager.beginTransaction(StandardBaseTransactionConfig.of(Timestamps.MICRO, manager.getFeatures().getKeyConsistentTxConfig()));
}
@Override
public void close() throws BackendException {
manager.close();
}
}, Timestamps.MICRO,manager.openDatabase("titan"),"general");
} catch (BackendException e) {
throw new RuntimeException(e);
}
}
示例12: simpleWriteAndQuery
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
private void simpleWriteAndQuery(IndexProvider idx) throws BackendException, InterruptedException {
final Duration maxWrite = new StandardDuration(2000L, TimeUnit.MILLISECONDS);
final String storeName = "jvmlocal_test_store";
final KeyInformation.IndexRetriever indexRetriever = IndexProviderTest.getIndexRetriever(IndexProviderTest.getMapping(idx.getFeatures()));
BaseTransactionConfig txConfig = StandardBaseTransactionConfig.of(Timestamps.MILLI);
IndexTransaction itx = new IndexTransaction(idx, indexRetriever, txConfig, maxWrite);
assertEquals(0, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "ali"))).size());
itx.add(storeName, "doc", IndexProviderTest.NAME, "alice", false);
itx.commit();
Thread.sleep(1500L); // Slightly longer than default 1s index.refresh_interval
itx = new IndexTransaction(idx, indexRetriever, txConfig, maxWrite);
assertEquals(0, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "zed"))).size());
assertEquals(1, itx.query(new IndexQuery(storeName, PredicateCondition.of(IndexProviderTest.NAME, Text.PREFIX, "ali"))).size());
itx.rollback();
}
示例13: testTimestampProvider
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testTimestampProvider() {
BaseTransactionConfig txcfg = StandardBaseTransactionConfig.of(TimestampProviders.NANO);
CassandraTransaction ct = new CassandraTransaction(txcfg);
assertEquals(TimestampProviders.NANO, ct.getConfiguration().getTimestampProvider());
txcfg = StandardBaseTransactionConfig.of(TimestampProviders.MICRO);
ct = new CassandraTransaction(txcfg);
assertEquals(TimestampProviders.MICRO, ct.getConfiguration().getTimestampProvider());
txcfg = StandardBaseTransactionConfig.of(TimestampProviders.MILLI);
ct = new CassandraTransaction(txcfg);
assertEquals(TimestampProviders.MILLI, ct.getConfiguration().getTimestampProvider());
}
示例14: getStoreTx
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
public StoreTransaction getStoreTx() {
try {
return storeManager.beginTransaction(StandardBaseTransactionConfig.of(times));
} catch (BackendException se) {
throw new RuntimeException(se);
}
}
示例15: testSimpleScan
import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; //导入依赖的package包/类
@Test
public void testSimpleScan()
throws InterruptedException, ExecutionException, IOException, BackendException {
int keys = 1000;
int cols = 40;
String[][] values = KeyValueStoreUtil.generateData(keys, cols);
//Make it only half the number of columns for every 2nd key
for (int i = 0; i < values.length; i++) {
if (i%2==0) values[i]= Arrays.copyOf(values[i], cols / 2);
}
log.debug("Loading values: " + keys + "x" + cols);
KeyColumnValueStoreManager mgr = new CassandraThriftStoreManager(GraphDatabaseConfiguration.buildGraphConfiguration());
KeyColumnValueStore store = mgr.openDatabase("edgestore");
StoreTransaction tx = mgr.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MICRO));
KeyColumnValueStoreUtil.loadValues(store, tx, values);
tx.commit(); // noop on Cassandra, but harmless
SimpleScanJobRunner runner = (ScanJob job, Configuration jobConf, String rootNSName) -> {
try {
return new CassandraHadoopScanRunner(job).scanJobConf(jobConf).scanJobConfRoot(rootNSName)
.partitionerOverride("org.apache.cassandra.dht.Murmur3Partitioner").run();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
};
SimpleScanJob.runBasicTests(keys, cols, runner);
}