/** * Get the underlying {@link LevelDBAtomicKVStore} used by this instance. * * @return underlying key/value store */ public LevelDBAtomicKVStore getKVStore() { return (LevelDBAtomicKVStore)super.getKVStore(); }
@Override public LevelDBKVDatabase getKVDatabase() { return (LevelDBKVDatabase)super.getKVDatabase(); } }
/** * Get the hold timeout configured for this instance. * * <p> * The hold timeout limits how long a thread may hold on to a contested lock before being forced to release * all of its locks; after that, the next attempted operation will fail with {@link RetryTransactionException}. * * @return hold timeout in milliseconds */ public long getHoldTimeout() { return this.lockManager.getHoldTimeout(); }
@Override public byte[] get(byte[] key) { return this.view.get(key); }
@Override public CloseableIterator<KVPair> getRange(byte[] minKey, byte[] maxKey, boolean reverse) { return this.view.getRange(minKey, maxKey, reverse); }
@Override public void put(byte[] key, byte[] value) { this.view.put(key, value); }
@Override public KVPair getAtMost(byte[] maxKey, byte[] minKey) { return this.view.getAtMost(maxKey, minKey); }
@Override public byte[] encodeCounter(long value) { return this.view.encodeCounter(value); }
@Override public KVPair getAtLeast(byte[] minKey, byte[] maxKey) { return this.view.getAtLeast(minKey, maxKey); }
@Override public void removeRange(byte[] minKey, byte[] maxKey) { this.view.removeRange(minKey, maxKey); }
/** * Configure the underlying {@link AtomicArrayKVStore} used by this instance. Required property. * * @param kvstore underlying key/value store * @throws IllegalStateException if this instance is already {@link #start}ed */ public void setKVStore(AtomicArrayKVStore kvstore) { super.setKVStore(kvstore); }
@Override public synchronized LevelDBKVTransaction createTransaction() { return (LevelDBKVTransaction)super.createTransaction(); }
@Override public void apply(Mutations mutations) { this.view.apply(mutations); }
/** * Set the hold timeout for this instance. Default is {@link #DEFAULT_HOLD_TIMEOUT}. * * @param holdTimeout how long a thread may hold a contestested lock before throwing {@link RetryTransactionException} * in milliseconds, or zero for unlimited * @throws IllegalArgumentException if {@code holdTimeout} is negative */ public void setHoldTimeout(long holdTimeout) { this.lockManager.setHoldTimeout(holdTimeout); }
boolean decodeBoolean(byte[] key) throws IOException { final byte[] value = this.kv.get(key); return value != null && value.length > 0 && value[0] != 0; }
synchronized void rollback(SimpleKVTransaction tx) { // Prevent use after commit() or rollback() invoked if (tx.stale) return; tx.stale = true; // Release all locks this.lockManager.release(tx.lockOwner); }
/** * Get the underlying {@link AtomicArrayKVStore} used by this instance. * * @return underlying key/value store */ public AtomicArrayKVStore getKVStore() { return (AtomicArrayKVStore)super.getKVStore(); }
@Override public ArrayKVDatabase getKVDatabase() { return (ArrayKVDatabase)super.getKVDatabase(); } }
/** * Configure the underlying {@link LevelDBAtomicKVStore} used by this instance. Required property. * * @param kvstore underlying key/value store * @throws IllegalStateException if this instance is already {@link #start}ed */ public void setKVStore(LevelDBAtomicKVStore kvstore) { super.setKVStore(kvstore); }
@Override public synchronized ArrayKVTransaction createTransaction() { return (ArrayKVTransaction)super.createTransaction(); }