Interface ImmediateEntryStore

All Superinterfaces:
EntryStore
All Known Implementing Classes:
DisabledRaftStorage

@NonNullByDefault public interface ImmediateEntryStore extends EntryStore
An immediate EntryStore. Offloads asynchronous persist responses via RaftStorageCompleter exposed via EntryStore.completer().
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    checkpointLastApplied(long commitJournalIndex)
    Record a known value of lastApplied as a recovery optimization.
    default void
    discardHead(long firstRetainedIndex)
    Deletes journal entries up to, but not including, the given journalIndex.
    default void
    discardTail(long firstRemovedIndex)
    Delete entries starting from, and including, specified index.
    default void
    Persists an entry to the applicable journal asynchronously.

    Methods inherited from interface org.opendaylight.controller.cluster.raft.spi.EntryStore

    completer, persistEntry
  • Method Details

    • startPersistEntry

      default void startPersistEntry(ReplicatedLogEntry entry, RaftCallback<Long> callback)
      Description copied from interface: EntryStore
      Persists an entry to the applicable journal asynchronously.
      Specified by:
      startPersistEntry in interface EntryStore
      Parameters:
      entry - the journal entry to persist
      callback - the callback when persistence is complete
    • discardHead

      default void discardHead(long firstRetainedIndex)
      Description copied from interface: EntryStore
      Deletes journal entries up to, but not including, the given journalIndex.
      Specified by:
      discardHead in interface EntryStore
      Parameters:
      firstRetainedIndex - the journalIndex of the first retained entry
    • discardTail

      default void discardTail(long firstRemovedIndex)
      Description copied from interface: EntryStore
      Delete entries starting from, and including, specified index. The contract is that the callback will be invoked before RaftActor sees any other message.
      Specified by:
      discardTail in interface EntryStore
      Parameters:
      firstRemovedIndex - the journalIndex of first entry to delete
    • checkpointLastApplied

      default void checkpointLastApplied(long commitJournalIndex)
      Description copied from interface: EntryStore
      Record a known value of lastApplied as a recovery optimization. If we can recover this information, recovery can re-apply these entries before we attempt to talk to other members. It is okay to lose this marker, as in that case we will just apply those entries as part of being a follower or becoming a leader.

      This amounts to persisting a lower bound on commitIndex, which is explicitly volatile state. We could remember that instead (or perhaps as well) -- but now we just derive it.

      If we later discover that this index lies beyond current leader's commitIndex, we will ask for a complete snapshot -- which is not particularly nice, but should happen seldom enough for it not to matter much.

      Specified by:
      checkpointLastApplied in interface EntryStore
      Parameters:
      commitJournalIndex - the journalIndex of the entry which is covered by commitIndex and has been observed as lastApplied.