snapshot

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package snapshot implements atomic full-project backup and restore for the .cloop directory. Snapshots are stored as gzip-compressed tar archives in .cloop/snapshots/ and can be created, listed, restored, and deleted via the cloop snapshot subcommands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(workDir, id string) error

Delete removes the snapshot with the given id.

func Restore

func Restore(workDir, id string) error

Restore extracts the snapshot identified by id and replaces the contents of the .cloop directory, preserving the snapshots/ subdirectory.

Types

type Meta

type Meta struct {
	ID        string    // base filename without .tar.gz
	Name      string    // user-supplied label (may be empty)
	CreatedAt time.Time // parsed from the timestamp portion of the filename
	Size      int64     // compressed file size in bytes
	Path      string    // absolute path to the archive
}

Meta holds the parsed metadata for a single snapshot.

func FindByPrefix

func FindByPrefix(workDir, prefix string) (Meta, error)

FindByPrefix resolves a potentially abbreviated id prefix (or exact id) to a full Meta. Returns an error if zero or more than one match.

func List

func List(workDir string) ([]Meta, error)

List returns all snapshots in the snapshots directory, sorted oldest first.

func Save

func Save(workDir, name string) (Meta, error)

Save creates a new snapshot of the .cloop directory. name is an optional human-readable label; if empty the snapshot gets a timestamp-only ID. The snapshot excludes the snapshots/ subdirectory itself to avoid recursive growth.

Jump to

Keyboard shortcuts

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