Class SnapshotManager

java.lang.Object
org.opendaylight.controller.cluster.raft.SnapshotManager

public final class SnapshotManager extends Object
Manages the capturing of snapshots for a RaftActor.
Author:
Moiz Raja, Thomas Pantelis
  • Method Details

    • isApplying

      public boolean isApplying()
    • isCapturing

      public boolean isCapturing()
      Returns whether or not a capture is in progress.
      Returns:
      true when a snapshot is being captured, false otherwise
    • captureToInstall

      public boolean captureToInstall(EntryMeta lastLogEntry, long replicatedToAllIndex, String targetFollower)
      Initiates a capture snapshot for the purposing of installing the snapshot on a follower.
      Parameters:
      lastLogEntry - the last entry in the replicated log
      replicatedToAllIndex - the current replicatedToAllIndex
      targetFollower - the id of the follower on which to install
      Returns:
      true if capture was started
    • capture

      public boolean capture(EntryMeta lastLogEntry, long replicatedToAllIndex)
      Initiates a capture snapshot.
      Parameters:
      lastLogEntry - the last entry in the replicated log
      replicatedToAllIndex - the current replicatedToAllIndex
      Returns:
      true if capture was started
    • persist

      @NonNullByDefault public void persist(Snapshot.State snapshotState, InstallableSnapshot installable)
      Persists a snapshot.
      Parameters:
      snapshotState - the snapshot State
      installable - the InstallableSnapshot
    • trimLog

      public long trimLog(long desiredTrimIndex)
      Trims the in-memory log.
      Parameters:
      desiredTrimIndex - the desired index to trim from
      Returns:
      the actual trim index
    • setSnapshotCohort

      public void setSnapshotCohort(RaftActorSnapshotCohort<?> snapshotCohort)
    • getCaptureSnapshot

      public @Nullable SnapshotManager.CaptureSnapshot getCaptureSnapshot()