microsandbox

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package microsandbox is the pure-Go client for the colocated SDK helper. Core owns all durable state; the helper owns no database or background service.

Index

Constants

View Source
const MaxOutputBytes = 1024 * 1024
View Source
const MaxRequestBytes = 72 * 1024 * 1024
View Source
const MaxResponseBytes = 16 * 1024 * 1024
View Source
const ProtocolVersion = 2
View Source
const SDKVersion = "v0.7.2"

Variables

Functions

func HelperEnvironment

func HelperEnvironment(env []string, c Config) []string

Strip native selector and credential-bearing inherited configuration. Operator proxy settings are not passed into guest environments by this adapter.

func Labels

func Labels(c Config, r sandbox.Reference) map[string]string

func Name

func Name(c Config, r sandbox.Reference, g uint64) string

func Operations

func Operations() providercontract.Operations

Operations is this adapter's complete authored resource contract.

func Policy

func Policy() sandbox.DeploymentPolicy

func SnapshotReference

func SnapshotReference(c Config, r sandbox.Reference, operation string) string

func ValidReference

func ValidReference(r sandbox.Reference) bool

func ValidateBootstrap

func ValidateBootstrap(b sandbox.Bootstrap) error

func ValidateCommand

func ValidateCommand(c sandbox.Command) error

func ValidateCompute

func ValidateCompute(c Config, r sandbox.Reference, v Compute) error

func ValidateRequest

func ValidateRequest(q Request) error

func ValidateResources

func ValidateResources(r sandbox.Resources) error

func ValidateSnapshot

func ValidateSnapshot(c Config, r sandbox.Reference, s SnapshotIdentity) error

func ValidateSpecification

func ValidateSpecification(s sandbox.DeploymentSpec) error

Types

type Caller

type Caller interface {
	Call(context.Context, Request) (Response, error)
}

type Compute

type Compute = sandbox.Compute

These aliases keep the helper wire private while Core uses provider-neutral types.

type Config

type Config struct {
	InstallationID     string
	HelperPath         string
	RuntimeHome        string
	RuntimePath        string
	FirmwarePath       string
	RuntimeSHA256      string
	FirmwareSHA256     string
	Image              string
	MemoryMiB          uint32
	CPUs               uint8
	RootDiskMiB        uint32
	EnvironmentDiskMiB uint32
	Network            NetworkPolicy
}

Config is trusted deployment configuration. Paths and hashes refer to one immutable, qualified installation. Network is explicitly used on create and restore.

func (Config) Validate

func (c Config) Validate() error

type LeaseIdentity

type LeaseIdentity struct {
	InstallationID      string `json:"installation_id"`
	Generation          uint64 `json:"generation"`
	SpecificationDigest string `json:"specification_digest"`
}

LeaseIdentity is recorded by the installer before a generation can spawn a helper. Neither opener adopts a missing record or a replacement lease inode.

type Metrics

type Metrics struct {
	ObservedAt       time.Time
	Uptime           time.Duration
	VCPUTimeNs       uint64
	MemoryBytes      uint64
	MemoryLimitBytes uint64
}

Metrics is the bounded provider-helper projection used by Core observability. ObservedAt and Uptime preserve the same native registry sample at millisecond precision. It excludes instantaneous CPU percent and provider-native names.

type NetworkPolicy

type NetworkPolicy struct {
	DefaultEgress  string
	DefaultIngress string
	Rules          []NetworkRule
}

type NetworkRule

type NetworkRule struct{ Action, Direction, Destination, Protocol, Port string }

type ProcessCaller

type ProcessCaller struct {

	// LeasePath belongs to the permanent node state namespace, not a release.
	// It is never unlinked, including after the generation is collected.
	LeasePath     string
	LeaseIdentity LeaseIdentity
	// contains filtered or unexported fields
}

ProcessCaller never kills a mutating helper on a Core response timeout. The helper retains its allocation flock until the SDK mutation settles, including after Core exits. Output is still drained and bounded by this waiter.

func (*ProcessCaller) Call

func (p *ProcessCaller) Call(ctx context.Context, q Request) (Response, error)

func (*ProcessCaller) Quiescent

func (p *ProcessCaller) Quiescent() bool

type Provider

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

func New

func New(c Config) (*Provider, error)

func NewWithCaller

func NewWithCaller(c Config, caller Caller) (*Provider, error)

func (*Provider) Create

func (p *Provider) Create(ctx context.Context, b sandbox.Bootstrap) (sandbox.Info, error)

func (*Provider) DeleteSnapshot

func (p *Provider) DeleteSnapshot(ctx context.Context, r sandbox.Reference, s SnapshotIdentity) error

func (*Provider) DiscoverSelection

func (p *Provider) DiscoverSelection(context.Context, sandbox.Selection) (sandbox.Selection, error)

func (*Provider) GetCompute

func (p *Provider) GetCompute(ctx context.Context, r sandbox.Reference, c Compute) (State, error)

func (*Provider) GetInfo

func (p *Provider) GetInfo(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)

func (*Provider) Initial

func (p *Provider) Initial(ctx context.Context, r sandbox.Reference) (Compute, error)

func (*Provider) Kill

func (p *Provider) Kill(ctx context.Context, r sandbox.Reference) error

func (*Provider) KillCompute

func (p *Provider) KillCompute(ctx context.Context, r sandbox.Reference, c Compute) error

func (*Provider) NewCompute

func (p *Provider) NewCompute(ctx context.Context, r sandbox.Reference, generation uint64, snapshot *SnapshotIdentity) (Compute, error)

func (*Provider) ObservationProviderType

func (*Provider) ObservationProviderType() string

func (*Provider) Observe

func (p *Provider) Observe(ctx context.Context, target runtimeobs.Target) (runtimeobs.Sample, error)

Observe reads one point-in-time native metrics snapshot through the existing one-shot helper. The persisted compute receipt selects the exact generation; browser input and provider display names never select a sandbox.

func (*Provider) ObserveBatch

func (*Provider) ProviderOperations

func (*Provider) ProviderOperations() providercontract.Operations

func (*Provider) Quiescent

func (p *Provider) Quiescent() bool

Quiescent includes a helper that outlived the caller's canceled context.

func (*Provider) Renew

func (p *Provider) Renew(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)

func (*Provider) ResolveObservationSource

func (p *Provider) ResolveObservationSource(context.Context) (runtimeobs.Source, error)

func (*Provider) Resume

func (p *Provider) Resume(ctx context.Context, q ResumeRequest) (State, error)

func (*Provider) ResumeCompute

func (p *Provider) ResumeCompute(ctx context.Context, r sandbox.Reference, c Compute) (State, error)

ResumeCompute thaws the exact resident source after an aborted suspension. It never starts stopped compute or restores a checkpoint.

func (*Provider) RunCommand

func (*Provider) RunCommandCompute

func (p *Provider) RunCommandCompute(ctx context.Context, r sandbox.Reference, c Compute, command sandbox.Command) (sandbox.CommandResult, error)

func (*Provider) Suspend

func (p *Provider) Suspend(ctx context.Context, q SuspendRequest) (State, error)

func (*Provider) VerifyCredential

func (p *Provider) VerifyCredential(context.Context, []sandbox.Reference) error

type Request

type Request struct {
	Version   int
	Operation string
	Config    Config
	Reference sandbox.Reference
	Compute   Compute
	Bootstrap *sandbox.Bootstrap
	Command   *sandbox.Command
	Suspend   *SuspendRequest
	Resume    *ResumeRequest
	Snapshot  *SnapshotIdentity
	Deadline  time.Time
}

Request and Response are the finite, private helper boundary. Confidential Bootstrap and Command bytes travel only through stdin and are never logged.

type Response

type Response struct {
	// CreateSettled accompanies a configuration rejection after native Create
	// completed and before bootstrap began. State binds the exact created compute.
	CreateSettled bool `json:",omitempty"`
	Version       int
	State         *State
	Command       *sandbox.CommandResult
	Metrics       *Metrics
	ErrorCode     string
}

type ResumeRequest

type ResumeRequest = sandbox.ResumeRequest

type SnapshotIdentity

type SnapshotIdentity = sandbox.SnapshotIdentity

type State

type State = sandbox.ComputeState

type SuspendRequest

type SuspendRequest = sandbox.SuspendRequest

Jump to

Keyboard shortcuts

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