pub fn take(
layout: &Layout,
dest: &Path,
daemon: Option<&Path>,
) -> Result<Taken, String>Expand description
Takes a backup of the node whose state directory is layout, into
dest, in the shape verify reads and choir backup restore
unpacks.
The same checks the flip-era pull script made, on the node’s own
disk: the copied log must be a prefix-extension of the one already
held here, contiguous from seq 0, and pass choir-node --verify-log
when a daemon is there to run it; the policy archive must carry no
key or credential; every bundle must verify. Everything is written
into a sibling directory first and moved into place last, so a run
cut short leaves the previous backup as it was.
Live is fine: the log is append-only, and a line the daemon was still writing fails the contiguity check and is refused, which is the right answer for a copy taken a moment too early.
§Errors
Returns the sentence to print when the node’s files are missing, the log shrank or diverged from the backup already here, a secret is among the policy files, or a subprocess refused.