Package io.atomix.raft
Interface SnapshotReplicationListener
public interface SnapshotReplicationListener
Listener which will be invoked when a new snapshot is received by this follower from a leader.
When a new snapshot is received via raft replication, the log will be reset and all entries in
the log is deleted and creates a new empty log. Hence any consumers of the log may have to reset
its internal state so that it can start with a new log and a new snapshot.
The difference between this listener and PersistedSnapshotListener is that PersistedSnapshotListener notifies when a snapshot is taken locally
and when a snapshot is received via replication. This listener only notifies when a snapshot is
received via raft replication, which happens only when the follower's log is lagging behind the
leader.
These listeners are invoked in the Raft thread. Hence it should not do any heavy computations. Any time consuming steps should be delegated to another thread/actor.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonSnapshotReplicationCompleted(long term) Will be called after the snapshot replication is completed.voidWill be called when the snapshot receiving has started.
-
Method Details
-
onSnapshotReplicationStarted
void onSnapshotReplicationStarted()Will be called when the snapshot receiving has started. This should close the consumers of the log. -
onSnapshotReplicationCompleted
void onSnapshotReplicationCompleted(long term) Will be called after the snapshot replication is completed. The snapshot replication can // complete either a new snapshot is committed or the snapshot replication is aborted. // If a new snapshot has been committed, the log will be empty.- Parameters:
term- the current term
-