Class AsyncSnapshotDirector
java.lang.Object
io.camunda.zeebe.scheduler.Actor
io.camunda.zeebe.broker.system.partitions.impl.AsyncSnapshotDirector
- All Implemented Interfaces:
RaftCommittedEntryListener,AsyncClosable,ConcurrencyControl,HealthMonitorable,AutoCloseable
public final class AsyncSnapshotDirector
extends Actor
implements RaftCommittedEntryListener, HealthMonitorable
-
Nested Class Summary
Nested classes/interfaces inherited from class io.camunda.zeebe.scheduler.Actor
Actor.ActorBuilder -
Field Summary
FieldsFields inherited from class io.camunda.zeebe.scheduler.Actor
actor, ACTOR_PROP_NAME, ACTOR_PROP_PARTITION_ID -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFailureListener(FailureListener listener) Directly take a snapshot, independently of the scheduled snapshots.getName()protected voidhandleFailure(Throwable failure) voidnewPositionCommitted(long currentCommitPosition) static AsyncSnapshotDirectorofProcessingMode(int nodeId, int partitionId, StreamProcessor streamProcessor, StateController stateController, Duration snapshotRate, Callable<CompletableFuture<Void>> flushLog) Create an AsyncSnapshotDirector that can take snapshot when the StreamProcessor is in processing modestatic AsyncSnapshotDirectorofReplayMode(int nodeId, int partitionId, StreamProcessor streamProcessor, StateController stateController, Duration snapshotRate, Callable<CompletableFuture<Void>> flushLog) Create an AsyncSnapshotDirector that can take snapshot when the StreamProcessor is in continuous replay mode.protected voidvoidonCommit(IndexedRaftLogEntry indexedRaftLogEntry) voidremoveFailureListener(FailureListener failureListener) Methods inherited from class io.camunda.zeebe.scheduler.Actor
buildActorName, close, getContext, isActorClosed, newActor, onActorClosed, onActorCloseRequested, onActorClosing, onActorFailed, onActorStarted, run, runOnCompletion, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.zeebe.scheduler.ConcurrencyControl
createCompletedFuture, createFuture
-
Field Details
-
MINIMUM_SNAPSHOT_PERIOD
-
-
Method Details
-
createContext
- Overrides:
createContextin classActor
-
getName
- Specified by:
getNamein interfaceHealthMonitorable- Overrides:
getNamein classActor
-
onActorStarting
protected void onActorStarting()- Overrides:
onActorStartingin classActor
-
closeAsync
- Specified by:
closeAsyncin interfaceAsyncClosable- Overrides:
closeAsyncin classActor
-
handleFailure
- Overrides:
handleFailurein classActor
-
ofReplayMode
public static AsyncSnapshotDirector ofReplayMode(int nodeId, int partitionId, StreamProcessor streamProcessor, StateController stateController, Duration snapshotRate, Callable<CompletableFuture<Void>> flushLog) Create an AsyncSnapshotDirector that can take snapshot when the StreamProcessor is in continuous replay mode.- Parameters:
nodeId- id of this brokerpartitionId- partition idstreamProcessor- stream processor for the partitionstateController- state controller that manages statesnapshotRate- rate at which the snapshot is taken- Returns:
- snapshot director
-
ofProcessingMode
public static AsyncSnapshotDirector ofProcessingMode(int nodeId, int partitionId, StreamProcessor streamProcessor, StateController stateController, Duration snapshotRate, Callable<CompletableFuture<Void>> flushLog) Create an AsyncSnapshotDirector that can take snapshot when the StreamProcessor is in processing mode- Parameters:
nodeId- id of this brokerpartitionId- partition idstreamProcessor- stream processor for the partitionstateController- state controller that manages statesnapshotRate- rate at which the snapshot is taken- Returns:
- snapshot director
-
forceSnapshot
Directly take a snapshot, independently of the scheduled snapshots.- Returns:
- A future that is completed successfully when the snapshot was taken. If the snapshot was skipped, the future is also completed successfully but with a null.
-
getHealthReport
- Specified by:
getHealthReportin interfaceHealthMonitorable
-
addFailureListener
- Specified by:
addFailureListenerin interfaceHealthMonitorable
-
removeFailureListener
- Specified by:
removeFailureListenerin interfaceHealthMonitorable
-
onCommit
- Specified by:
onCommitin interfaceRaftCommittedEntryListener
-
newPositionCommitted
public void newPositionCommitted(long currentCommitPosition)
-