Interface StagedSnapshotCapability

All Superinterfaces:
LogCapability

public interface StagedSnapshotCapability extends LogCapability
A log capability that allows snapshot creation in two phases: staging and committing.

The caller writes snapshot data to the OutputStream returned by stage(), then atomically promotes it with commit(OutputStream).

Since:
2.0
Author:
José Bolina
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Atomically installs a previously staged snapshot as the active snapshot.
    Creates a new staging area for a snapshot and returns a stream to write into it.
  • Method Details

    • stage

      OutputStream stage() throws IOException
      Creates a new staging area for a snapshot and returns a stream to write into it.

      The returned stream must be closed before calling commit(OutputStream). Closing the stream flushes all data to durable storage.

      Returns:
      an output stream for writing snapshot data
      Throws:
      IOException - if the staging area cannot be created
    • commit

      void commit(OutputStream staged) throws IOException
      Atomically installs a previously staged snapshot as the active snapshot.

      Must be called from the RAFT event loop.

      Parameters:
      staged - the stream previously returned by stage(), already closed
      Throws:
      IOException - if the snapshot cannot be installed