localConfig.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "local"); defaultConfig.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "default"); BaseTransactionConfig defaultTxConfig = new StandardBaseTransactionConfig.Builder().customOptions(defaultConfig).timestampProvider(TimestampProviders.MICRO).build(); StoreFeatures backingFeatures = new StandardStoreFeatures.Builder().keyConsistent(globalConfig, localConfig).build();
uniqueIDUpperBound = 1<<uniqueIdBitWidth; storeTxConfigBuilder = new StandardBaseTransactionConfig.Builder().groupName(metricsPrefix).timestampProvider(times); randomUniqueIDLimit,uniqueIDUpperBound); uniqueId = -1; storeTxConfigBuilder.customOptions(manager.getFeatures().getKeyConsistentTxConfig()); } else { randomizeUniqueId = false; if (conflictAvoidanceMode.equals(ConflictAvoidanceMode.LOCAL_MANUAL)) { Preconditions.checkArgument(config.has(IDAUTHORITY_CAV_TAG),"Need to configure a unique id in order to use local consistency"); storeTxConfigBuilder.customOptions(manager.getFeatures().getLocalKeyConsistentTxConfig()); } else { storeTxConfigBuilder.customOptions(manager.getFeatures().getKeyConsistentTxConfig());
Preconditions.checkArgument(StringUtils.isNotBlank(dbName),"Need to specify a database to execute against"); Preconditions.checkArgument(times!=null,"Need to configure the timestamp provider for this job"); StandardBaseTransactionConfig.Builder txBuilder = new StandardBaseTransactionConfig.Builder(); txBuilder.timestampProvider(times); txBuilder.customOptions(scanConfig); StoreTransaction storeTx = manager.beginTransaction(txBuilder.build()); KeyColumnValueStore kcvs = manager.openDatabase(dbName);
this.defaultSchemaMaker = defaultSchemaMaker; this.hasDisabledSchemaConstraints = hasDisabledSchemaConstraints; this.handleConfig = new StandardBaseTransactionConfig.Builder() .commitTime(commitTime) .timestampProvider(times) .groupName(groupName) .customOptions(customOptions).build();
public static StandardBaseTransactionConfig of(TimestampProvider times) { return new Builder().timestampProvider(times).build(); }
public static StandardBaseTransactionConfig of(TimestampProvider times, Configuration customOptions) { return new Builder().timestampProvider(times).customOptions(customOptions).build(); }
@Override public StoreTransaction openTx() throws BackendException { return manager.beginTransaction(storeTxConfigBuilder.build()); }
/** * Copies everything from {@code template} to this builder except for * the {@code commitTime}. * * @param template * an existing transaction from which this builder will take * its values */ public Builder(BaseTransactionConfig template) { customOptions(template.getCustomOptions()); groupName(template.getGroupName()); timestampProvider(template.getTimestampProvider()); }
private StoreTransaction overrideTimestamp(final StoreTransaction tx, final Instant commitTime) throws BackendException { StandardBaseTransactionConfig newCfg = new StandardBaseTransactionConfig.Builder(tx.getConfiguration()) .commitTime(commitTime).build(); return manager.beginTransaction(newCfg); }
@Override public ExpectedValueCheckingTransaction beginTransaction(BaseTransactionConfig configuration) throws BackendException { // Get a transaction without any guarantees about strong consistency StoreTransaction inconsistentTx = manager.beginTransaction(configuration); // Get a transaction that provides global strong consistency Configuration customOptions = new MergedConfiguration(storeFeatures.getKeyConsistentTxConfig(), configuration.getCustomOptions()); BaseTransactionConfig consistentTxCfg = new StandardBaseTransactionConfig.Builder(configuration) .customOptions(customOptions).build(); StoreTransaction strongConsistentTx = manager.beginTransaction(consistentTxCfg); // Return a wrapper around both the inconsistent and consistent store transactions return new ExpectedValueCheckingTransaction(inconsistentTx, strongConsistentTx, maxReadTime); }
@Override public StoreTransaction openTx() throws BackendException { return manager.beginTransaction(storeTxConfigBuilder.build()); } @Override