Documentation ¶
Overview ¶
The archive utilities manage the internal format of a snapshot, which is a tar file with the following contents:
meta.json - JSON-encoded snapshot metadata from Raft state.bin - Encoded snapshot data from Raft SHA256SUMS - SHA-256 sums of the above two files
The integrity information is automatically created and checked, and a failure there just looks like an error to the caller.
snapshot manages the interactions between Nomad and Raft in order to take and restore snapshots for disaster recovery. The internal format of a snapshot is simply a tar file, as described in archive.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopySnapshot ¶ added in v1.2.0
func CopySnapshot(in io.Reader, dest io.WriteCloser) (*raft.SnapshotMeta, error)
CopySnapshot copies the snapshot content from snapshot archive to dest. It will close the destination once complete.
Types ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is a structure that holds state about a temporary file that is used to hold a snapshot. By using an intermediate file we avoid holding everything in memory.
func New ¶
New takes a state snapshot of the given Raft instance into a temporary file and returns an object that gives access to the file as an io.Reader. You must arrange to call Close() on the returned object or else you will leak a temporary file.
func (*Snapshot) Close ¶
Close closes the snapshot and removes any temporary storage associated with it. You must arrange to call this whenever NewSnapshot() has been called successfully. This is safe to call on a nil snapshot.