snapshot

package
v0.14.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MergeStrategyAccountRegion = "account-region-merge"
	MergeStrategyOverwrite     = "overwrite"
	MergeStrategyService       = "service-merge"
)

Variables

View Source
var (
	// ErrRemoteNotSupported is returned for known remote schemes (s3://, oras://).
	ErrRemoteNotSupported = errors.New("remote destinations are not yet supported — coming soon")
	// ErrUnknownScheme is returned for unrecognized URL schemes.
	ErrUnknownScheme = errors.New("unrecognized destination scheme")
)
View Source
var ErrHomeNotSet = errors.New("home directory is not set")

ErrHomeNotSet is returned when a path needs "~" expansion but no home directory was provided.

View Source
var ErrIncompatibleSnapshot = errors.New("snapshot is incompatible with the running LocalStack version")
View Source
var ErrInvalidSnapshotFile = errors.New("not a valid snapshot file")

ErrInvalidSnapshotFile indicates the source could not be read as a snapshot (e.g. a non-snapshot file was passed). It deliberately hides the underlying archive format from the user-facing message.

View Source
var ErrPodNotFound = errors.New("cloud pod not found")

ErrPodNotFound is returned when the cloud pod does not exist on the platform.

Functions

func List added in v0.12.0

func List(ctx context.Context, lister CloudPodLister, authToken, creator string, sink output.Sink) error

func LoadLocal added in v0.10.0

func LoadLocal(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, client LocalLoadClient, host, src, strategy string, starter Starter, sink output.Sink) error

func LoadPod added in v0.10.0

func LoadPod(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, loader PodLoader, host, podName, authToken, strategy string, starter Starter, sink output.Sink) error

func Remove added in v0.12.0

func Remove(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, podName, authToken string, remover PodRemover, host string, force bool, sink output.Sink) error

Remove deletes a remote pod snapshot, prompting for confirmation unless force is true.

func SaveLocal added in v0.9.0

func SaveLocal(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, exporter StateExporter, host, dest string, sink output.Sink) error

func SavePod added in v0.9.0

func SavePod(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, saver PodSaver, host, podName, authToken string, sink output.Sink) error

func Show added in v0.13.0

func Show(ctx context.Context, inspector CloudPodInspector, authToken, podName string, sink output.Sink) error

Show fetches a single cloud snapshot's metadata from the platform and emits it as a SnapshotShownEvent. It is cloud-only and requires authentication.

func ValidateMergeStrategy added in v0.10.0

func ValidateMergeStrategy(strategy string) error

Types

type CloudPodInspector added in v0.13.0

type CloudPodInspector interface {
	GetCloudPod(ctx context.Context, authToken, podName string) (*api.CloudPodDetails, error)
}

type CloudPodLister added in v0.12.0

type CloudPodLister interface {
	ListCloudPods(ctx context.Context, authToken, creator string) ([]api.CloudPod, error)
}

type Destination added in v0.9.0

type Destination struct {
	Kind  DestinationKind
	Value string
}

Destination is the parsed result of a user-supplied snapshot destination. For KindLocal, Value is an absolute local file path with a .snapshot extension. For KindPod, Value is the validated pod name (without the "pod:" prefix).

func ParseDestination

func ParseDestination(dest, home string, now time.Time) (Destination, error)

ParseDestination resolves a user-supplied destination to a local path (KindLocal) or validated pod name (KindPod). home is used to expand a leading "~" or "~/"; pass "" to disable tilde expansion.

func ParseRemovable added in v0.12.0

func ParseRemovable(ref, cwd, home string) (Destination, error)

ParseRemovable parses a ref for snapshot remove. Only cloud (pod:) refs are accepted; local file paths are rejected because the CLI cannot delete local files. cwd and home are used to produce a human-readable path in error messages.

func ParseShowable added in v0.13.0

func ParseShowable(ref, cwd, home string) (Destination, error)

ParseShowable parses a ref for snapshot show. Only cloud (pod:) refs are accepted; local file paths are rejected because show only inspects cloud snapshots. cwd and home are used to produce a human-readable path in error messages.

func ParseSource added in v0.10.0

func ParseSource(ref, home string) (Destination, error)

ParseSource resolves a user-supplied source REF for loading a snapshot. Unlike ParseDestination it never auto-generates a name: REF is required. For local paths, the file must exist; if no matching file is found, .snapshot and then .zip (legacy) are tried as fallbacks. home is used to expand a leading "~" or "~/"; pass "" to disable tilde expansion.

type DestinationKind added in v0.9.0

type DestinationKind int

DestinationKind distinguishes local file paths from remote pod destinations.

const (
	KindLocal DestinationKind = iota
	KindPod
)

type LocalLoadClient added in v0.10.0

type LocalLoadClient interface {
	// ImportState posts a zip to /_localstack/pods[?merge=strategy] and streams
	// the NDJSON response. strategy is passed as-is; empty means server default.
	ImportState(ctx context.Context, host string, src io.Reader, strategy string) error
	// ResetState wipes all running state via POST /_localstack/state/reset.
	// Used to implement overwrite client-side before importing.
	ResetState(ctx context.Context, host string) error
}

LocalLoadClient is satisfied by aws.Client.

type PodLoader added in v0.10.0

type PodLoader interface {
	// LoadPodSnapshot issues PUT /_localstack/pods/{name}?merge=strategy and
	// streams the NDJSON response.
	LoadPodSnapshot(ctx context.Context, host, podName, authToken, strategy string) ([]string, error)
}

PodLoader is satisfied by aws.Client.

type PodRemover added in v0.12.0

type PodRemover interface {
	RemovePodSnapshot(ctx context.Context, host, podName, authToken string) error
}

PodRemover deletes a remote pod snapshot on the LocalStack platform.

type PodSaveResult added in v0.9.0

type PodSaveResult struct {
	Version  int
	Services []string
	Size     int64
}

PodSaveResult holds the metadata returned by the platform after a successful pod save.

type PodSaver added in v0.9.0

type PodSaver interface {
	SavePodSnapshot(ctx context.Context, host, podName, authToken string) (PodSaveResult, error)
}

PodSaver triggers a remote pod snapshot save on the running LocalStack instance.

type Starter added in v0.10.0

type Starter func(ctx context.Context, sink output.Sink) error

Starter is called to auto-start the emulator when none is running.

type StateExporter

type StateExporter interface {
	ExportState(ctx context.Context, host string, dst io.Writer) error
}

StateExporter retrieves state from the running LocalStack instance.

Jump to

Keyboard shortcuts

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