state

package
v0.0.0-...-5c0fc10 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 13 Imported by: 6

Documentation

Overview

Package state provides high-level state wrappers.

Index

Constants

View Source
const (
	// GvisorCPUUsageKey is the metadata key to store and retrieve CPU time usage
	// across save restore.
	GvisorCPUUsageKey = "gvisor_cpu_usage"
	// GvisorWallTimeKey is the metadata key to store and retrieve wall time
	// across save restore.
	GvisorWallTimeKey = "gvisor_wall_time"
)

Variables

This section is empty.

Functions

func CPUTime

func CPUTime() (time.Duration, error)

CPUTime returns the CPU time usage by Sentry and app.

func NewStatefileReader

func NewStatefileReader(source io.ReadCloser, key []byte) (io.ReadCloser, map[string]string, error)

NewStatefileReader returns the statefile's metadata and a reader for it. The ownership of source is transferred to the returned reader.

Types

type SaveOpts

type SaveOpts struct {
	// Destination is the save target.
	Destination io.Writer

	// PagesMetadata is the file into which MemoryFile metadata is stored if
	// PagesMetadata is non-nil. Otherwise this content is stored in Destination.
	PagesMetadata io.WriteCloser

	// PagesFile is the file in which all MemoryFile pages are stored if
	// PagesFile is non-nil. Otherwise this content is stored in Destination.
	PagesFile stateio.AsyncWriter

	// Key is used to enable state integrity check.
	Key []byte

	// Metadata is save metadata.
	Metadata map[string]string

	// AppMFExcludeCommittedZeroPages is the value of
	// pgalloc.SaveOpts.ExcludeCommittedZeroPages for the application memory
	// file.
	AppMFExcludeCommittedZeroPages bool

	// Resume indicates if the statefile is used for save-resume.
	Resume bool

	// Autosave indicates if the statefile is used for autosave.
	Autosave bool

	// StartTime stores the start time of the sandbox.
	StartTime time.Time

	// CudaCheckpointPath is the path to the cuda-checkpoint binary.
	CudaCheckpointPath string

	// CudaCheckpointSequential indicates whether cuda-checkpoint should be run
	// sequentially (rather than in parallel).
	CudaCheckpointSequential bool
}

SaveOpts contains save-related options.

func (*SaveOpts) Close

func (opts *SaveOpts) Close() error

Close releases resources owned by opts.

func (*SaveOpts) Save

func (opts *SaveOpts) Save(ctx context.Context, k *kernel.Kernel, w *watchdog.Watchdog) error

Save saves the system state.

Directories

Path Synopsis
Package checkpointfiles defines constants used when sentry state is checkpointed to multiple files in a directory rather than to an opaque FD.
Package checkpointfiles defines constants used when sentry state is checkpointed to multiple files in a directory rather than to an opaque FD.
Package stateio defines I/O types used by sentry save/restore.
Package stateio defines I/O types used by sentry save/restore.
Package stateipc proxies stateio interfaces across process boundaries.
Package stateipc proxies stateio interfaces across process boundaries.

Jump to

Keyboard shortcuts

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