Enum Class SnapshotFileFormat

java.lang.Object
java.lang.Enum<SnapshotFileFormat>
org.opendaylight.controller.cluster.raft.spi.SnapshotFileFormat
All Implemented Interfaces:
Serializable, Comparable<SnapshotFileFormat>, Constable

@NonNullByDefault public enum SnapshotFileFormat extends Enum<SnapshotFileFormat>
All supported snapshot file formats. Content closely mirrors Snapshot, but does not include TermInfo
  • Enum Constant Details

    • SNAPSHOT_V1

      public static final SnapshotFileFormat SNAPSHOT_V1
      First version of snapshot file format.
  • Method Details

    • values

      public static SnapshotFileFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SnapshotFileFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • extension

      public final String extension()
      Returns the extension associated with this file format.
      Returns:
      the extension associated with this file format
    • latest

      public static SnapshotFileFormat latest()
      Returns the latest format.
      Returns:
      the latest format
    • forFileName

      public static @Nullable SnapshotFileFormat forFileName(String fileName)
      Returns the CompressionType corresponding to specified file name by examining its extension.
      Parameters:
      fileName - the file name
      Returns:
      the CompressionType, or null if the file extension is not recognized.
    • createNew

      public abstract Closeable createNew(Path file, Instant timestamp, EntryInfo lastIncluded, @Nullable VotingConfig votingConfig, CompressionType entryCompress, List<LogEntry> unappliedEntries, CompressionType stateCompress, @Nullable StateSnapshot.ToStorage<?> state) throws IOException
      Create a file of this format with the content of specified snapshot.
      Parameters:
      file - the file to write
      timestamp - the timestamp
      lastIncluded - last journal entry included in the snapshot
      votingConfig - the server configuration
      entryCompress - the compression to apply to unapplied entries
      unappliedEntries - the unapplied entries
      stateCompress - the compression to apply to user state
      state - the state, or null
      Returns:
      a Closeable representing the flush-and-close action
      Throws:
      IOException - if an I/O error occurs
    • open

      public abstract SnapshotFile open(Path file) throws IOException
      Open an existing file of this format.
      Parameters:
      file - the file to open
      Returns:
      a SnapshotFile
      Throws:
      IOException - if an I/O error occurs