snapshotmode

package module
v0.0.0-...-6843e3f Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package snapshotmode defines the user-visible mode of a snapshot artifact.

A mode describes what a snapshot contains, never how a sandbox behaves after it has been started: pause/resume always carry memory and have no mode.

Index

Constants

View Source
const (
	ErrFilesystemOnlyUnsupported       = "snapshot_filesystem_only_unsupported_node"
	ErrFilesystemOnlyNodeUnknown       = "snapshot_filesystem_only_node_capability_unknown"
	ErrFilesystemOnlyNotReady          = "snapshot_filesystem_only_not_ready"
	ErrFilesystemOnlyRollback          = "snapshot_filesystem_only_rollback_unsupported"
	ErrFilesystemOnlyCatalog           = "snapshot_filesystem_only_catalog_missing"
	ErrFilesystemOnlyGuestRuntime      = "snapshot_filesystem_only_guest_runtime_mismatch"
	ErrFilesystemOnlyFreezeUnsupported = "snapshot_filesystem_only_freeze_unsupported"
	ErrFilesystemOnlyFreezeFailed      = "snapshot_filesystem_only_freeze_failed"
	ErrFilesystemOnlyThawFailed        = "snapshot_filesystem_only_thaw_failed"
	ErrFilesystemOnlyRootfsUnsupported = "snapshot_filesystem_only_rootfs_unsupported"
	ErrFilesystemOnlySharedVolume      = "snapshot_filesystem_only_shared_volume_unsupported"
	ErrFilesystemOnlyMultiContainer    = "snapshot_filesystem_only_multi_container_unsupported"
	ErrFilesystemOnlyRestoreFailed     = "snapshot_filesystem_only_restore_failed"
	ErrSnapshotMemoryMissing           = "snapshot_memory_missing"
	ErrSnapshotModeInvalid             = "snapshot_mode_invalid"
	ErrSnapshotModeConflict            = "snapshot_mode_conflict"
)

Stable error identifiers shared by CubeMaster and Cubelet. They describe the filesystem-only feature, not a mode literal, so the names are intentionally independent of the canonical "fs-only" wire value.

View Source
const AliasFilesystem = "filesystem"

AliasFilesystem is the E2B 2.55 wire value accepted at API boundaries only. It is normalized to FsOnly and must never be written to a response, the database, a catalog entry, or a log field that describes a stored artifact.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind classifies a failure that carries one of the stable identifiers above.

const (
	// KindOther means the message carries no stable identifier; callers keep
	// their existing default classification.
	KindOther Kind = iota
	// KindClientError means the request itself is invalid (HTTP 400).
	KindClientError
	// KindPrecondition means the request is valid but the cluster or the
	// artifact cannot satisfy it (HTTP 409).
	KindPrecondition
	// KindUnavailable means the answer depends on cluster state that has not
	// arrived yet; the caller may retry (HTTP 503).
	KindUnavailable
)

func Classify

func Classify(message string) Kind

Classify reports how a failure that carries a stable identifier should be surfaced.

Identifiers travel inside larger messages: Cubelet wraps them ("failed to capture sandbox snapshot: <id>: ...") and Master stores that text in the job's error_message, so the match is by containment. Callers must not depend on the identifier being the first token.

type Mode

type Mode string

Mode is the canonical snapshot artifact mode.

const (
	// Full snapshots carry rootfs + memory + metadata.
	Full Mode = "full"
	// FsOnly snapshots carry rootfs + metadata only.
	FsOnly Mode = "fs-only"
)

func Normalize

func Normalize(raw string) Mode

Normalize maps stored or internal values to a canonical mode. Empty means full: the mode column was added after full snapshots already existed. Values that were never written by this build also fall back to full, because the only historical rows are full rows. Client input must go through Parse so an unknown value is rejected instead of silently becoming full.

func Parse

func Parse(raw string) (Mode, error)

Parse accepts canonical values and the E2B compatibility alias. An empty string is not a mode: callers that treat "missing" as the default must use Normalize instead. The returned value is always canonical.

func (Mode) HasMemory

func (m Mode) HasMemory() bool

HasMemory reports whether the artifact carries guest memory.

func (Mode) IsFsOnly

func (m Mode) IsFsOnly() bool

IsFsOnly reports whether the artifact omits guest memory.

func (Mode) String

func (m Mode) String() string

func (Mode) Valid

func (m Mode) Valid() bool

Valid reports whether m is a canonical value.

Jump to

Keyboard shortcuts

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