Interface SnapshotId

All Superinterfaces:
Comparable<SnapshotId>
All Known Implementing Classes:
FileBasedSnapshotId

public interface SnapshotId extends Comparable<SnapshotId>
Represents an identifier of an PersistedSnapshot.
  • Method Details

    • getIndex

      long getIndex()
      Returns:
      the index of the snapshot
    • getTerm

      long getTerm()
      Returns:
      the term when the snapshot was taken
    • getProcessedPosition

      long getProcessedPosition()
      Returns:
      the processed position when the snapshot was taken
    • getExportedPosition

      long getExportedPosition()
      Returns:
      the exported position when the snapshot was taken
    • getSnapshotIdAsString

      String getSnapshotIdAsString()
      The string representation of the snapshot identifier, looks like 'index-term-timestamp'.
      Returns:
      the string representation
    • compareTo

      default int compareTo(SnapshotId other)
      A snapshot is considered "lower" if its term is less than that of the other snapshot. If they are the same, then it is considered "lower" if its index is less then the other, if they are equal then the processed positions are compared, and then exported positions are compared. If they are the same then these snapshots are the same order-wise.
      Specified by:
      compareTo in interface Comparable<SnapshotId>
      Parameters:
      other - the snapshot to compare against
      Returns:
      -1 if this is less than other, 0 if they are the same, 1 if it is greater