Documentation
¶
Overview ¶
Package backup produces and restores a single-file archive of a moth data directory: an online-consistent snapshot of the SQLite database plus the uploads and key material.
The database is never copied byte-for-byte — a live WAL-mode file is not safe to read while the server is writing. Instead VACUUM INTO writes a fresh, transactionally-consistent copy that captures every committed write up to the moment it runs, so a backup can be taken under load. The result is a gzip-compressed tar; Restore reverses it with traversal and overwrite guards.
Index ¶
Constants ¶
const DBArchiveName = "moth.db"
DBArchiveName is the path of the vacuumed database inside the archive; on Restore it lands at <dataDir>/moth.db.
Variables ¶
This section is empty.
Functions ¶
func Backup ¶
Backup writes a gzip-compressed tar snapshot to out. dbPath is the live SQLite database; dataDir holds the uploads/ and keys/ subtrees. Missing subtrees are skipped (a fresh instance may have no uploads yet). The snapshot is taken with VACUUM INTO, so it is safe to call while the server is serving traffic.
Types ¶
This section is empty.