Documentation
¶
Overview ¶
Package fssnap takes read-only, point in time snapshots of the filesystems holding a set of paths, for a copy to read a stable source rather than one written to while it is read, and removes them after the copy, the snapshots a run killed before its end included.
A path is snapshotted with the filesystem mounted deepest under it:
- a logical volume, thick or thin, whose snapshot is mounted read-only,
- a btrfs subvolume, whose read-only snapshot is reached through a private mount of the filesystem root,
- a zfs dataset, whose snapshot is reached in its .zfs directory.
Any other filesystem is refused: a copy asked of a snapshot is not made of the live data instead.
Every mount, logical volume, subvolume and zfs snapshot made is written to a journal before it is made, and Remove undoes the journal, so a run killed before it removed them leaves them to the next one to remove.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Set ¶
type Set struct {
// Dir is the directory of the set, where its journal is kept and
// its snapshots mounted. It is the set's alone, as the var
// directory of a resource is.
Dir string
// Name names the snapshots, unique to the set among the snapshots
// of the node: a logical volume, a subvolume and a zfs snapshot
// are named after it. It holds letters, digits, '_', '.' and '-'.
Name string
Log *plog.Logger
// OneFileSystem says the copy stays on the filesystem of each path,
// as rsync -x does. Otherwise a filesystem mounted below a path is
// refused: the snapshot does not hold it, and the copy would take
// its absence for files to delete.
OneFileSystem bool
}
Set is the snapshots of one copy, as one run of a sync resource.
func (*Set) Create ¶
Create snapshots the filesystems holding paths, after removing what a run killed before its end left, and returns the paths as the snapshots show them, in the order given. A path ending with a '/' keeps it, as rsync reads it.
On error, what Create made is left to Remove, which the caller defers as soon as it calls Create.
func (*Set) Remove ¶
Remove undoes what the set made, its journal says, the last made first. What it could not undo stays in the journal, for the next Remove.
func (*Set) RemoveDetached ¶
RemoveDetached is Remove with a context of its own, for a deferred call after a context that may be done.