Search in sources :

Example 1 with MergedConfiguration

use of com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration 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);
    }
}
Also used : MergedConfiguration(com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration) StoreTransaction(com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction) Configuration(com.thinkaurelius.titan.diskstorage.configuration.Configuration) MergedConfiguration(com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration) GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration) PermanentBackendException(com.thinkaurelius.titan.diskstorage.PermanentBackendException)

Example 2 with MergedConfiguration

use of com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration in project titan by thinkaurelius.

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
    ExpectedValueCheckingTransaction wrappedTx = new ExpectedValueCheckingTransaction(inconsistentTx, strongConsistentTx, maxReadTime);
    return wrappedTx;
}
Also used : MergedConfiguration(com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration) Configuration(com.thinkaurelius.titan.diskstorage.configuration.Configuration) MergedConfiguration(com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration) StandardBaseTransactionConfig(com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig) BaseTransactionConfig(com.thinkaurelius.titan.diskstorage.BaseTransactionConfig)

Aggregations

Configuration (com.thinkaurelius.titan.diskstorage.configuration.Configuration)2 MergedConfiguration (com.thinkaurelius.titan.diskstorage.configuration.MergedConfiguration)2 BaseTransactionConfig (com.thinkaurelius.titan.diskstorage.BaseTransactionConfig)1 PermanentBackendException (com.thinkaurelius.titan.diskstorage.PermanentBackendException)1 StoreTransaction (com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction)1 StandardBaseTransactionConfig (com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig)1 GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)1