restore

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package restore is the init-container side: read HEAD.json from the backend, walk the manifest chain (full + increments in order), stream each one through hanzoai/vfs into db.Load(r). After this completes, the target ZapDB at the configured path holds a byte-equivalent copy of whatever the replicator most recently published.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Prune

func Prune(ctx context.Context, cfg PruneConfig) error

Prune removes manifests older than the Nth-most-recent full snapshot, plus the blocks that ONLY those manifests reference.

Block GC: walk every surviving manifest, build a set of referenced block IDs. Any block in the to-delete manifests that is NOT in the survivor set can be deleted.

func Run

func Run(ctx context.Context, cfg Config) error

Run executes the restore. Returns nil if the target is already populated and SkipIfNotEmpty is true.

Types

type Config

type Config struct {
	DBPath  string // target path; created if it does not exist
	Network string // sanity check — must match HEAD/manifests
	VFS     *vfs.VFS
	Backend backend.Backend
	// SkipIfNotEmpty: if true (default), restore aborts when the target
	// already contains data. Set false to force restore over an
	// existing dir.
	SkipIfNotEmpty bool
}

Config wires a single restore run.

type PruneConfig

type PruneConfig struct {
	VFS       *vfs.VFS
	Backend   backend.Backend
	KeepFulls int  // keep the N most recent full snapshots; older fulls and their increments are deleted
	DryRun    bool // log only, do not delete
}

PruneConfig wires a single prune run.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL