snapshot

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package snapshot names, labels and groups snapshots: copies of a stack's named volumes, kept as Docker volumes. Everything here is a pure function; copying happens through a helper container (see internal/docker).

Index

Constants

View Source
const (
	LabelName    = "dev.siding.snapshot"
	LabelVolume  = "dev.siding.snapshot-volume"
	LabelCreated = "dev.siding.snapshot-created"
)

Labels of a snapshot volume.

View Source
const (
	// DefaultName is the snapshot a first up seeds from without --seed (spec seeding).
	DefaultName = "default"
	// ReservedName is not a snapshot name: --seed none means no snapshot.
	ReservedName = "none"
)
View Source
const Image = "busybox:1.37.0"

Image is the helper image that copies volumes; the devcontainer's SIDING_BUSYBOX_IMAGE is the same.

Variables

This section is empty.

Functions

func CopyHelper

func CopyHelper(from, to, machine string) docker.Helper

CopyHelper copies the volume from into the volume to.

func ExistsError

func ExistsError(repo, name string) error

ExistsError is the error of saving a snapshot whose name is taken.

func Labels

func Labels(repo, name, key, machine string, created time.Time) map[string]string

Labels are the labels of a snapshot volume.

func ValidName

func ValidName(name string) error

ValidName fails with InvalidArguments unless name is lowercase letters, digits and single dashes, at most 40 characters.

func VolumeName

func VolumeName(repo, name, key string) string

VolumeName is the volume holding one volume of a snapshot. The parts are separated by "_", which neither slugs nor snapshot names contain, so two snapshots never share a volume.

Types

type Snapshot

type Snapshot struct {
	Name    string
	Repo    string
	Created string
	// Volumes maps the stack's volume key to the snapshot volume.
	Volumes map[string]string
	// Size is the sum of the volumes' sizes, -1 when Docker does not know one of them.
	Size int64
}

Snapshot is one snapshot with its volumes.

func Find

func Find(all []Snapshot, repo, name string) (Snapshot, error)

Find returns the snapshot name of repo, failing with SnapshotNotFound.

func Group

func Group(vols []docker.Volume, sizes map[string]int64) []Snapshot

Group turns snapshot volumes into snapshots, sorted by repository and name. sizes may be nil.

func (Snapshot) String

func (s Snapshot) String() string

String is used in messages.

Jump to

Keyboard shortcuts

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