Documentation
¶
Overview ¶
Package backup snapshots a set of files into a tar archive and restores such archives atomically. DuckDB databases get special handling on both sides: they are checkpointed and lock-guarded before being read, and a restore refuses to replace a database another process still holds. Encryption (AES-256-GCM) is applied by the caller; the root sisyphus package's Backup/Restore pair this with key escrow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Archive ¶
Archive snapshots paths into an uncompressed tar, storing each file under its basename (two paths with the same basename are an error). A DuckDB database is checkpointed under this package's cross-process lock before it is read, so the snapshot is consistent — which also means backing up a database needs write access to it. A path that does not exist is skipped, unless an orphaned .wal sits beside it, which is an error. An archive that would contain no files at all is also an error.
func Restore ¶
Restore decrypts sealed with key, extracts the archive, and swaps the contained files into destDir (created if needed), returning the sorted basenames it wrote. Entries are flattened to basenames, staged to disk first, then swapped in with the previous files set aside; on failure the swap is rolled back, and the error says exactly which files (if any) could not be put back. Databases still held by another process are refused.
Types ¶
This section is empty.