Skip to main content

import

Function import 

Source
pub fn import(dir: &Path, root: &Path) -> Result<Report, String>
Expand description

Places the export at dir into a fresh node root.

Verifies before writing a byte, then refuses a root that already holds a log or any repository the manifest names — the thing being written over is the fallback, which is the same reason scripts/restore_from_backup.sh refuses both.

What this does not do is claim the result works. A restored node that serves is not a restored node; what settles it is one that accepts a write, and the secrets that boot needs are deliberately not here. docs/runbook-restore.md covers them. Hooks and git config are not written either: the daemon adopts a repository it finds under its root, so writing them here would be a second copy of that rule, drifting.

§Errors

Returns a description when the export does not verify, when root already holds a log or a named repository, or when git refuses to unbundle one.