- All Superinterfaces:
- All Known Implementing Classes:
public interface AtomicKVStore extends KVStoreExtension of the
KVStoreinterface for implementations that support atomic, batched reads and writes.
Atomic batch reads are available via
snapshot(), which returns a consistent point-in-time views of the
KVStore. Atomic batch writes are available via
mutate(), which applies a set of mutations in an "all or none" fashion.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
mutate(Mutations mutations, boolean sync)Apply a set of mutations to this instance atomically.
snapshot()Acquire a read-only, snapshot view of this instance based on the current state.
start()Start this instance.
stop()Stop this instance.
void start()Start this instance. This method must be called prior to creating any transactions.
This method is idempotent: if this instance is already started, nothing happens.
Whether an instance that has been started and stopped can be restarted is implementation-dependent.
IllegalStateException- if this instance is not properly configured
CloseableKVStore snapshot()Acquire a read-only, snapshot view of this instance based on the current state.
KVStoreview should remain constant even if this instance is subsequently mutated.
Note: callers are required to
closethe returned instance when no longer in use.
void mutate(Mutations mutations, boolean sync)Apply a set of mutations to this instance atomically.
If this method returns normally, all of the given mutations will have been applied. If this method returns abnormally, then none of the given mutations will have been applied.
In any case, other threads observing this instance will never see a partial application of the given mutations.
This method is required to apply the mutations in this order: removes, puts, adjusts.
syncis true, the implementation must durably persist the changes before returning.
mutations- the mutations to apply
sync- if true, caller requires that the changes be durably persisted
StaleTransactionException- if an underlying transaction is no longer usable
RetryTransactionException- if an underlying transaction must be retried and is no longer usable
syncis true and this implementation cannot guarantee durability
IllegalStateException- if this instance is not