@API(value=INTERNAL) public class InstrumentedTransaction extends Object implements Transaction
Transaction
that instruments certain calls to expose their behavior with
FDBStoreTimer
metrics.Modifier and Type | Field and Description |
---|---|
protected boolean |
enableAssertions |
protected static int |
MAX_KEY_LENGTH |
protected static int |
MAX_VALUE_LENGTH |
protected ReadTransaction |
snapshot |
protected StoreTimer |
timer |
protected T |
underlying |
ROW_LIMIT_UNLIMITED
Constructor and Description |
---|
InstrumentedTransaction(StoreTimer timer,
Transaction underlying,
boolean enableAssertions) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addReadConflictKeyIfNotSnapshot, addReadConflictRangeIfNotSnapshot, get, getKey, getRange, getRange, getRange, getRange, getRange, getRange, getRange, getRange, getRange, getRange, getRange, getRange, options
getExecutor, read, readAsync
@Nullable protected ReadTransaction snapshot
protected static final int MAX_KEY_LENGTH
protected static final int MAX_VALUE_LENGTH
@Nullable protected StoreTimer timer
@Nonnull protected T extends ReadTransaction underlying
protected final boolean enableAssertions
public InstrumentedTransaction(@Nullable StoreTimer timer, @Nonnull Transaction underlying, boolean enableAssertions)
public void addReadConflictRange(byte[] keyBegin, byte[] keyEnd)
addReadConflictRange
in interface Transaction
public void addReadConflictKey(byte[] key)
addReadConflictKey
in interface Transaction
public void addWriteConflictRange(byte[] keyBegin, byte[] keyEnd)
addWriteConflictRange
in interface Transaction
public void addWriteConflictKey(byte[] key)
addWriteConflictKey
in interface Transaction
public void set(byte[] key, byte[] value)
set
in interface Transaction
public void clear(byte[] key)
clear
in interface Transaction
public void clear(byte[] keyBegin, byte[] keyEnd)
clear
in interface Transaction
public void clear(Range range)
clear
in interface Transaction
@Deprecated public void clearRangeStartsWith(byte[] prefix)
clearRangeStartsWith
in interface Transaction
public void mutate(MutationType opType, byte[] key, byte[] param)
mutate
in interface Transaction
public CompletableFuture<Void> commit()
commit
in interface Transaction
public Long getCommittedVersion()
getCommittedVersion
in interface Transaction
public CompletableFuture<byte[]> getVersionstamp()
getVersionstamp
in interface Transaction
public CompletableFuture<Transaction> onError(Throwable throwable)
onError
in interface Transaction
public void cancel()
cancel
in interface Transaction
public CompletableFuture<Void> watch(byte[] bytes) throws FDBException
watch
in interface Transaction
FDBException
public Database getDatabase()
getDatabase
in interface Transaction
public <T> T run(Function<? super Transaction,T> function)
run
in interface Transaction
run
in interface TransactionContext
public <T> CompletableFuture<T> runAsync(Function<? super Transaction,? extends CompletableFuture<T>> function)
runAsync
in interface Transaction
runAsync
in interface TransactionContext
public void close()
close
in interface Transaction
close
in interface AutoCloseable
public boolean isSnapshot()
isSnapshot
in interface ReadTransaction
public ReadTransaction snapshot()
snapshot
in interface ReadTransaction
public CompletableFuture<Long> getReadVersion()
getReadVersion
in interface ReadTransaction
public void setReadVersion(long l)
setReadVersion
in interface ReadTransaction
public boolean addReadConflictRangeIfNotSnapshot(byte[] keyBegin, byte[] keyEnd)
addReadConflictRangeIfNotSnapshot
in interface ReadTransaction
public boolean addReadConflictKeyIfNotSnapshot(byte[] key)
addReadConflictKeyIfNotSnapshot
in interface ReadTransaction
public CompletableFuture<byte[]> get(byte[] key)
get
in interface ReadTransaction
public CompletableFuture<byte[]> getKey(KeySelector keySelector)
getKey
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(KeySelector begin, KeySelector end)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(KeySelector begin, KeySelector end, int limit)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(KeySelector begin, KeySelector end, int limit, boolean reverse)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(KeySelector begin, KeySelector end, int limit, boolean reverse, StreamingMode streamingMode)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(byte[] begin, byte[] end)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(byte[] begin, byte[] end, int limit)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(byte[] begin, byte[] end, int limit, boolean reverse)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(byte[] begin, byte[] end, int limit, boolean reverse, StreamingMode streamingMode)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(Range range)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(Range range, int limit)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(Range range, int limit, boolean reverse)
getRange
in interface ReadTransaction
public AsyncIterable<KeyValue> getRange(Range range, int limit, boolean reverse, StreamingMode streamingMode)
getRange
in interface ReadTransaction
public TransactionOptions options()
options
in interface ReadTransaction
public <T> T read(Function<? super ReadTransaction,T> function)
read
in interface ReadTransactionContext
public <T> CompletableFuture<T> readAsync(Function<? super ReadTransaction,? extends CompletableFuture<T>> function)
readAsync
in interface ReadTransactionContext
public Executor getExecutor()
getExecutor
in interface ReadTransactionContext
protected void increment(StoreTimer.Count count)
protected void increment(StoreTimer.Count count, int amount)
protected void recordSinceNanoTime(StoreTimer.Event event, long nanoTime)
@Nonnull protected KeySelector checkKey(@Nonnull KeySelector keySelector)