Package com.usatiuk.objects.stores
Class WritebackObjectPersistentStore
java.lang.Object
com.usatiuk.objects.stores.WritebackObjectPersistentStore
Asynchronous write cache of objects.
Objects are put into a write queue by commitTx, and written to the storage by a separate thread.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
asyncFence
(long txId, Runnable fn) Run a given callback after the transaction with id txId is committed.commitTx
(Collection<TxRecord.TxObjectRecord<?>> writes) Commit a transaction to the persistent store.Get a snapshot of the persistent store, including the pending writes.
-
Constructor Details
-
WritebackObjectPersistentStore
public WritebackObjectPersistentStore()
-
-
Method Details
-
asyncFence
Run a given callback after the transaction with id txId is committed. If the transaction is already committed, the callback is run immediately.- Parameters:
txId
- transaction id to wait forfn
- callback to run
-
commitTx
Commit a transaction to the persistent store.- Parameters:
writes
- the transaction manifest- Returns:
- a function that allows to add a callback to be run after the transaction is committed
-
getSnapshot
Get a snapshot of the persistent store, including the pending writes.- Returns:
- a snapshot of the store
-