Interface DataPersistenceProvider
-
- All Known Implementing Classes:
DelegatingPersistentDataProvider
,NonPersistentDataProvider
,PersistentDataProvider
public interface DataPersistenceProvider
DataPersistenceProvider provides methods to persist data and is an abstraction of the akka-persistence persistence API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deleteMessages(long sequenceNumber)
Deletes journal entries up to the given sequence number.void
deleteSnapshots(SnapshotSelectionCriteria criteria)
Deletes snapshots based on the given criteria.long
getLastSequenceNumber()
Returns the last sequence number contained in the journal.boolean
handleJournalResponse(@NonNull JournalProtocol.Response response)
Receive and potentially handle aJournalProtocol
response.boolean
handleSnapshotResponse(@NonNull SnapshotProtocol.Response response)
Receive and potentially handle aSnapshotProtocol
response.boolean
isRecoveryApplicable()
Returns whether or not persistence recovery is applicable/enabled.<T> void
persist(T entry, Procedure<T> procedure)
Persists an entry to the applicable journal synchronously.<T> void
persistAsync(T entry, Procedure<T> procedure)
Persists an entry to the applicable journal asynchronously.void
saveSnapshot(Object snapshot)
Saves a snapshot.
-
-
-
Method Detail
-
isRecoveryApplicable
boolean isRecoveryApplicable()
Returns whether or not persistence recovery is applicable/enabled.- Returns:
- true if recovery is applicable, otherwise false, in which case the provider is not persistent and may not have anything to be recovered
-
persist
<T> void persist(T entry, Procedure<T> procedure)
Persists an entry to the applicable journal synchronously.- Type Parameters:
T
- the type of the journal entry- Parameters:
entry
- the journal entry to persistprocedure
- the callback when persistence is complete
-
persistAsync
<T> void persistAsync(T entry, Procedure<T> procedure)
Persists an entry to the applicable journal asynchronously.- Type Parameters:
T
- the type of the journal entry- Parameters:
entry
- the journal entry to persistprocedure
- the callback when persistence is complete
-
saveSnapshot
void saveSnapshot(Object snapshot)
Saves a snapshot.- Parameters:
snapshot
- the snapshot object to save
-
deleteSnapshots
void deleteSnapshots(SnapshotSelectionCriteria criteria)
Deletes snapshots based on the given criteria.- Parameters:
criteria
- the search criteria
-
deleteMessages
void deleteMessages(long sequenceNumber)
Deletes journal entries up to the given sequence number.- Parameters:
sequenceNumber
- the sequence number
-
getLastSequenceNumber
long getLastSequenceNumber()
Returns the last sequence number contained in the journal.- Returns:
- the last sequence number
-
handleJournalResponse
boolean handleJournalResponse(@NonNull JournalProtocol.Response response)
Receive and potentially handle aJournalProtocol
response.- Parameters:
response
- AJournalProtocol
response- Returns:
true
if the response was handled
-
handleSnapshotResponse
boolean handleSnapshotResponse(@NonNull SnapshotProtocol.Response response)
Receive and potentially handle aSnapshotProtocol
response.- Parameters:
response
- ASnapshotProtocol
response- Returns:
true
if the response was handled
-
-