Interface StagedSnapshotCapability
- All Superinterfaces:
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 TypeMethodDescriptionvoidcommit(OutputStream staged) Atomically installs a previously staged snapshot as the active snapshot.stage()Creates a new staging area for a snapshot and returns a stream to write into it.
-
Method Details
-
stage
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
Atomically installs a previously staged snapshot as the active snapshot.Must be called from the RAFT event loop.
- Parameters:
staged- the stream previously returned bystage(), already closed- Throws:
IOException- if the snapshot cannot be installed
-