Search in sources :

Example 1 with MergedConfiguration

use of org.janusgraph.diskstorage.configuration.MergedConfiguration in project janusgraph by JanusGraph.

the class ExpectedValueCheckingStoreManager method beginTransaction.

@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);
}
Also used : MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) Configuration(org.janusgraph.diskstorage.configuration.Configuration) MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) StandardBaseTransactionConfig(org.janusgraph.diskstorage.util.StandardBaseTransactionConfig) BaseTransactionConfig(org.janusgraph.diskstorage.BaseTransactionConfig)

Example 2 with MergedConfiguration

use of org.janusgraph.diskstorage.configuration.MergedConfiguration in project janusgraph by JanusGraph.

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);
    }
}
Also used : MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) Configuration(org.janusgraph.diskstorage.configuration.Configuration) MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)

Aggregations

Configuration (org.janusgraph.diskstorage.configuration.Configuration)2 MergedConfiguration (org.janusgraph.diskstorage.configuration.MergedConfiguration)2 BaseTransactionConfig (org.janusgraph.diskstorage.BaseTransactionConfig)1 StoreTransaction (org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction)1 StandardBaseTransactionConfig (org.janusgraph.diskstorage.util.StandardBaseTransactionConfig)1 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)1