snapshot

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 14 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")

Functions

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 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 ValidateMergeStrategy added in v0.10.0

func ValidateMergeStrategy(strategy string) error

Types

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 .zip 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 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 extension is given, .zip is tried as a fallback. 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 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