Interface LockWatchingCache
-
- All Known Implementing Classes:
NoOpLockWatchingCache
public interface LockWatchingCache
-
-
Method Summary
All Methods Instance Methods Abstract 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 lockWatchState)
A transaction can attempt to cache entries read during the transaction using this method.
-
-
-
Method Detail
-
getCached
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.- 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
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.- Parameters:
tableRef
- the table to which the transaction wrotewrites
- actual writes
-
maybeCacheEntriesRead
void maybeCacheEntriesRead(TableReference tableRef, Map<Cell,byte[]> writes, com.palantir.lock.watch.LockWatchStateUpdate lockWatchState)
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.- Parameters:
tableRef
- table to cache entries forwrites
- entries read by the transactionlockWatchState
- lock watch state at the start of the transaction that read the entries
-
getView
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.- Parameters:
startTimestamp
- of the transactionlockWatchState
- returned from theStartTransactionWithWatchesResponse
- Returns:
- view of the cache
-
-