Class NoOpLockWatchingCache
- java.lang.Object
-
- com.palantir.atlasdb.transaction.api.NoOpLockWatchingCache
-
- All Implemented Interfaces:
LockWatchingCache
public final class NoOpLockWatchingCache extends Object implements LockWatchingCache
-
-
Field Summary
Fields Modifier and Type Field Description static NoOpLockWatchingCache
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<Cell,GuardedValue>
getCached(TableReference tableRef, Set<Cell> reads)
Given a table and a set of cells, the cache returns a map containing the latest cachedGuardedValue
s for cells present in the cache.TransactionLockWatchingCacheView
getView(long startTimestamp, com.palantir.lock.watch.LockWatchStateUpdate lockWatchState)
Creates a view of the cache for a transaction, based on the start timestamp and the lock watch state.void
maybeCacheCommittedWrites(TableReference tableRef, Map<Cell,byte[]> writes)
After a transaction has committed, this notifies the cache that the writes can be cached, if desired.void
maybeCacheEntriesRead(TableReference tableRef, Map<Cell,byte[]> writes, com.palantir.lock.watch.LockWatchStateUpdate lwState)
A transaction can attempt to cache entries read during the transaction using this method.
-
-
-
Field Detail
-
INSTANCE
public static final NoOpLockWatchingCache INSTANCE
-
-
Method Detail
-
getCached
public Map<Cell,GuardedValue> getCached(TableReference tableRef, Set<Cell> reads)
Description copied from interface:LockWatchingCache
Given a table and a set of cells, the cache returns a map containing the latest cachedGuardedValue
s for cells present in the cache.- Specified by:
getCached
in interfaceLockWatchingCache
- Parameters:
tableRef
- table to read fromreads
- set of cells to read- Returns:
- Cached values that are guaranteed to be the latest visible entries to the transaction making the request
if the
GuardedValue
's timestamp matches the transaction's lock watch state
-
maybeCacheCommittedWrites
public void maybeCacheCommittedWrites(TableReference tableRef, Map<Cell,byte[]> writes)
Description copied from interface:LockWatchingCache
After a transaction has committed, this notifies the cache that the writes can be cached, if desired.- Specified by:
maybeCacheCommittedWrites
in interfaceLockWatchingCache
- Parameters:
tableRef
- the table to which the transaction wrotewrites
- actual writes
-
maybeCacheEntriesRead
public void maybeCacheEntriesRead(TableReference tableRef, Map<Cell,byte[]> writes, com.palantir.lock.watch.LockWatchStateUpdate lwState)
Description copied from interface:LockWatchingCache
A transaction can attempt to cache entries read during the transaction using this method. The implementation of theLockWatchStateUpdate
must correctly arbitrate which of the passed entries are safe to cache.- Specified by:
maybeCacheEntriesRead
in interfaceLockWatchingCache
- Parameters:
tableRef
- table to cache entries forwrites
- entries read by the transactionlwState
- lock watch state at the start of the transaction that read the entries
-
getView
public TransactionLockWatchingCacheView getView(long startTimestamp, com.palantir.lock.watch.LockWatchStateUpdate lockWatchState)
Description copied from interface:LockWatchingCache
Creates a view of the cache for a transaction, based on the start timestamp and the lock watch state.- Specified by:
getView
in interfaceLockWatchingCache
- Parameters:
startTimestamp
- of the transactionlockWatchState
- returned from theStartTransactionWithWatchesResponse
- Returns:
- view of the cache
-
-