public class LocalSnapshotStore extends java.lang.Object implements SnapshotStore, ActorLogging
Local filesystem backed snapshot store.
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
LocalSnapshotStore(com.typesafe.config.Config config) |
Modifier and Type | Method and Description |
---|---|
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
scala.concurrent.Future<scala.runtime.BoxedUnit> |
deleteAsync(SnapshotMetadata metadata)
Plugin API: deletes the snapshot identified by
metadata . |
scala.concurrent.Future<scala.runtime.BoxedUnit> |
deleteAsync(java.lang.String persistenceId,
SnapshotSelectionCriteria criteria)
Plugin API: deletes all snapshots matching
criteria . |
protected Snapshot |
deserialize(java.io.InputStream inputStream) |
scala.concurrent.Future<scala.Option<SelectedSnapshot>> |
loadAsync(java.lang.String persistenceId,
SnapshotSelectionCriteria criteria)
Plugin API: asynchronously loads a snapshot.
|
void |
preStart()
User overridable callback.
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receivePluginInternal()
Plugin API
Allows plugin implementers to use
f pipeTo self and
handle additional messages for implementing advanced features |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receiveSnapshotStore() |
protected void |
save(SnapshotMetadata metadata,
java.lang.Object snapshot) |
scala.concurrent.Future<scala.runtime.BoxedUnit> |
saveAsync(SnapshotMetadata metadata,
java.lang.Object snapshot)
Plugin API: asynchronously saves a snapshot.
|
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
protected void |
serialize(java.io.OutputStream outputStream,
Snapshot snapshot) |
protected java.io.File |
snapshotFileForWrite(SnapshotMetadata metadata,
java.lang.String extension)
Only by persistenceId and sequenceNr, timestamp is informational - accomodates for 2.13.x series files
|
protected java.io.File |
withOutputStream(SnapshotMetadata metadata,
scala.Function1<java.io.OutputStream,scala.runtime.BoxedUnit> p) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
receive, senderPersistentActor, tryReceivePluginInternal
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, sender, supervisorStrategy, unhandled
log
public final scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receiveSnapshotStore()
receiveSnapshotStore
in interface SnapshotStore
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public scala.concurrent.Future<scala.Option<SelectedSnapshot>> loadAsync(java.lang.String persistenceId, SnapshotSelectionCriteria criteria)
SnapshotStore
If the future Option
is None
then all events will be replayed,
i.e. there was no snapshot. If snapshot could not be loaded the Future
should be completed with failure. That is important because events may
have been deleted and just replaying the events might not result in a valid
state.
This call is protected with a circuit-breaker.
loadAsync
in interface SnapshotStore
persistenceId
- id of the persistent actor.criteria
- selection criteria for loading.public scala.concurrent.Future<scala.runtime.BoxedUnit> saveAsync(SnapshotMetadata metadata, java.lang.Object snapshot)
SnapshotStore
This call is protected with a circuit-breaker.
saveAsync
in interface SnapshotStore
metadata
- snapshot metadata.snapshot
- snapshot.public scala.concurrent.Future<scala.runtime.BoxedUnit> deleteAsync(SnapshotMetadata metadata)
SnapshotStore
metadata
.
This call is protected with a circuit-breaker.
deleteAsync
in interface SnapshotStore
metadata
- snapshot metadata.public scala.concurrent.Future<scala.runtime.BoxedUnit> deleteAsync(java.lang.String persistenceId, SnapshotSelectionCriteria criteria)
SnapshotStore
criteria
.
This call is protected with a circuit-breaker.
deleteAsync
in interface SnapshotStore
persistenceId
- id of the persistent actor.criteria
- selection criteria for deleting.public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receivePluginInternal()
SnapshotStore
f pipeTo self
and
handle additional messages for implementing advanced featuresreceivePluginInternal
in interface SnapshotStore
protected void save(SnapshotMetadata metadata, java.lang.Object snapshot)
protected Snapshot deserialize(java.io.InputStream inputStream)
protected void serialize(java.io.OutputStream outputStream, Snapshot snapshot)
protected java.io.File withOutputStream(SnapshotMetadata metadata, scala.Function1<java.io.OutputStream,scala.runtime.BoxedUnit> p)
protected java.io.File snapshotFileForWrite(SnapshotMetadata metadata, java.lang.String extension)