Documentation
¶
Index ¶
- func CollectBackupSet(repoPath string, backupIDs []string) ([]string, error)
- func Export(repoPath string, backupIDs []string, outputZip string, key *crypto.MasterKey) error
- func Import(ctx context.Context, repoPath string, inputZip string, key *crypto.MasterKey) error
- func VerifyFrame(frame []byte, want [32]byte, rc store.RepoConfig, key *crypto.MasterKey, ...) (hasher.ChunkID, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectBackupSet ¶
CollectBackupSet resolves the given backup IDs and returns the transitively-closed set every one of them references — ParentBackupID chains and per-file DataBackupID pointers — in VISIT order: requested backups first, ancestors after (reverse it for a parents-first walk). Export stages this whole set so archives are self-contained; seed-and-ship (#258) ships it whole so a restorable-looking backup in the cloud can never be missing its parents.
The traversal uses LoadCatalog (metadata + catalog only) — Load would hold every backup's full ENTRIES section in memory at once, several GB for a chain of large incrementals.
func Export ¶
Export packages one or more backups (manifests + chunk data) into a self-contained zip file. Chunks are exported as raw frames (compressed + encrypted as-is), so chunk data itself needs no key — but for encrypted repos the dedup index is stored encrypted, so the repo's CHUNK key must be provided (nil for unencrypted repos) to resolve chunk hashes to pack locations. Whether that key is also the index's key is derived here (store.IndexKeyFor), not by the caller.
The export is transitively closed over backup references: a watcher-mode incremental keeps unchanged files as FileEntry.DataBackupID pointers into an ancestor backup, and an incremental carries a ParentBackupID. Those ancestors' manifests and chunks are pulled in automatically, so the resulting archive is self-contained and restorable. Unique chunk hashes across every included backup are deduplicated — each appears once in the zip.
func Import ¶
Import reads a zip file produced by Export and injects its backups into repoPath. key is the repo's CHUNK key (nil for an unencrypted repo); the dedup index's own key is derived from it by store.IndexKeyFor, so a managed repo's index stays plaintext without the caller having to know that rule. After importing chunks, the dedup index is fully rebuilt so future backups dedup correctly against all imported data.
Every staged frame is verified against this repository BEFORE the chunk store is opened — see verifyArchiveFrames. An archive that does not belong here is refused with nothing written.
For managed-encryption repos, the index rebuild is skipped and a warning is printed; run "disknexus index --rebuild-all" manually after the controller is contacted.
func VerifyFrame ¶
func VerifyFrame(frame []byte, want [32]byte, rc store.RepoConfig, key *crypto.MasterKey, norm preprocess.Normalizer, decoder *zstd.Decoder) (hasher.ChunkID, error)
VerifyFrame is the per-chunk half of the #280 proof, shared with seed-and-ship (#258): it proves ONE raw frame belongs in the repository rc describes — this repo's read path (its key, its normalizer) turns the payload back into the chunk it is filed under:
sha256(normalize(decompress(decrypt(payload)))) == want
On success it returns the chunk's full identity (weak + strong hash of the normalized bytes), which is exactly what a dedup-index insert needs. The refusal messages are the import family's, verbatim — a ship IS an import.
norm must be the normalizer reconstructed from rc (preprocess.FromNames); decoder is a caller-held zstd reader so per-chunk calls stay cheap.
Types ¶
This section is empty.