For AI agents: the complete documentation index is at https://www.daytona.com/llms.txt. Append .md to any docs page URL to get it as Markdown.

Sign Up
Skip to Content

Snapshots

type Snapshots struct {
	// contains filtered or unexported fields
}

Snapshots manages saved sandbox memory and disk. Obtain it with Client.Snapshots. Its methods are safe for concurrent use.

Snapshots.Delete

func (s *Snapshots) Delete(ctx context.Context, id string) error

Delete deletes a snapshot by ID or name. Missing snapshots return ErrNotFound.

Snapshots.Get

func (s *Snapshots) Get(ctx context.Context, id string, opts *GetArtifactOptions) (*Snapshot, error)

Get reads a snapshot by ID or name. "search" must be read by ID instead. A failed/error snapshot is returned for inspection, even when waiting.

Snapshots.List

func (s *Snapshots) List(ctx context.Context, opts *ListSnapshotsOptions) (*Page[Snapshot], error)

List returns one page of snapshot values, preferring eventually consistent search and falling back only on 404 or SEARCH_NOT_CONFIGURED.

Snapshots.ListAll

func (s *Snapshots) ListAll(ctx context.Context, opts *ListSnapshotsOptions) iter.Seq2[Snapshot, error]

ListAll lazily visits snapshot pages until exhaustion, a repeated cursor, an error, cancellation or an early consumer break.

ListSnapshotsOptions

type ListSnapshotsOptions struct {
	// Cursor is the opaque continuation cursor.
	Cursor string
	// Limit is 1–200; zero uses the server default.
	Limit int
	// Name filters by snapshot name.
	Name string
	// SandboxID filters by the captured sandbox.
	SandboxID string
}

ListSnapshotsOptions filters one snapshot page. Zero values use defaults.

Snapshot

type Snapshot struct {
	// ID is the stable snapshot identifier.
	ID string
	// Name is the snapshot name.
	Name string
	// Class is the normalized sandbox class.
	Class SnapshotClass
	// RawClass preserves the server class.
	RawClass string
	// Kind is the snapshot format.
	Kind SnapshotKind
	// RawKind preserves the server kind.
	RawKind string
	// AvailableIn lists regions where the snapshot is available.
	AvailableIn []string
	// Region is the snapshot's home region.
	Region string
	// Status is its normalized readiness status.
	Status SnapshotStatus
	// RawStatus preserves the server status.
	RawStatus string
	// Error is the recorded failure.
	Error string
	// CreatedAt is the creation time.
	CreatedAt time.Time
	// UpdatedAt is the last update time.
	UpdatedAt time.Time
	// Bytes is the disk size, or nil when unreported.
	Bytes *int64
	// MemoryBytes is the saved memory size, or nil when unreported.
	MemoryBytes *int64
	// SandboxID identifies the captured sandbox, when reported.
	SandboxID string
}

Snapshot is a caller-owned observation of a saved sandbox's memory and disk.

SnapshotClass

type SnapshotClass string

SnapshotClass identifies a snapshot's operating-system class.

const (
	// SnapshotClassUnknown identifies a future class.
	SnapshotClassUnknown SnapshotClass = "unknown"
	// SnapshotClassLinux identifies Linux snapshots.
	SnapshotClassLinux SnapshotClass = "linux"
)

SnapshotKind

type SnapshotKind string

SnapshotKind describes the captured state.

const (
	// SnapshotKindUnknown identifies a future kind.
	SnapshotKindUnknown SnapshotKind = "unknown"
	// SnapshotKindFull captures memory and disk.
	SnapshotKindFull SnapshotKind = "full"
)

SnapshotStatus

type SnapshotStatus string

SnapshotStatus identifies snapshot readiness.

const (
	// SnapshotStatusUnknown identifies a future status.
	SnapshotStatusUnknown SnapshotStatus = "unknown"
	// SnapshotStatusPending means capture is queued.
	SnapshotStatusPending SnapshotStatus = "pending"
	// SnapshotStatusCreating means capture is in progress.
	SnapshotStatusCreating SnapshotStatus = "creating"
	// SnapshotStatusReady means the snapshot is usable.
	SnapshotStatusReady SnapshotStatus = "ready"
	// SnapshotStatusFailed means capture failed.
	SnapshotStatusFailed SnapshotStatus = "failed"
	// SnapshotStatusError is the alternative failure status.
	SnapshotStatusError SnapshotStatus = "error"
)