Documentation
¶
Overview ¶
Package microsandbox is the pure-Go client for the colocated SDK helper. Core owns lifecycle intent; the helper owns no database or background service.
Index ¶
- Constants
- Variables
- func BuildNode(c sandbox.NodeConfig, options sandbox.LocalOptions, result *sandbox.Built) (func(), error)
- func CheckpointClass(c Config) (sandbox.CheckpointCompatibility, error)
- func CheckpointStore(c Config) (string, error)
- func HelperEnvironment(env []string, c Config) []string
- func Labels(c Config, r sandbox.Reference) map[string]string
- func Name(c Config, r sandbox.Reference, g uint64) string
- func Operations() providercontract.Operations
- func Policy() sandbox.DeploymentPolicy
- func SnapshotReference(c Config, r sandbox.Reference, operation string) string
- func ValidReference(r sandbox.Reference) bool
- func ValidateBootstrap(b sandbox.Bootstrap) error
- func ValidateCommand(c sandbox.Command) error
- func ValidateCompute(c Config, r sandbox.Reference, v Compute) error
- func ValidateRequest(q Request) error
- func ValidateResources(r sandbox.Resources) error
- func ValidateSnapshot(c Config, r sandbox.Reference, s SnapshotIdentity) error
- func ValidateSpecification(s sandbox.DeploymentSpec) error
- type Caller
- type Compute
- type Config
- type LeaseIdentity
- type Metrics
- type Native
- type Network
- type NetworkPolicy
- type NetworkRule
- type ProcessCaller
- type Provider
- func (p *Provider) Create(ctx context.Context, b sandbox.Bootstrap) (sandbox.Info, error)
- func (p *Provider) DeleteSnapshot(ctx context.Context, r sandbox.Reference, s SnapshotIdentity) error
- func (p *Provider) GetCompute(ctx context.Context, r sandbox.Reference, c Compute) (State, error)
- func (p *Provider) GetInfo(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)
- func (p *Provider) Initial(ctx context.Context, r sandbox.Reference) (Compute, error)
- func (p *Provider) Kill(ctx context.Context, r sandbox.Reference) error
- func (p *Provider) KillCompute(ctx context.Context, r sandbox.Reference, c Compute) error
- func (p *Provider) NewCompute(ctx context.Context, r sandbox.Reference, generation uint64, ...) (Compute, error)
- func (p *Provider) Observe(ctx context.Context, target runtimeobs.Target) (runtimeobs.Sample, error)
- func (*Provider) ProviderOperations() providercontract.Operations
- func (p *Provider) Renew(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)
- func (p *Provider) Resume(ctx context.Context, q ResumeRequest) (State, error)
- func (p *Provider) ResumeCompute(ctx context.Context, r sandbox.Reference, c Compute) (State, error)
- func (p *Provider) RunCommand(ctx context.Context, r sandbox.Reference, c sandbox.Command) (sandbox.CommandResult, error)
- func (p *Provider) RunCommandCompute(ctx context.Context, r sandbox.Reference, c Compute, command sandbox.Command) (sandbox.CommandResult, error)
- func (p *Provider) Suspend(ctx context.Context, q SuspendRequest) (State, error)
- type Request
- type Response
- type ResumeRequest
- type Rule
- type SnapshotIdentity
- type State
- type SuspendRequest
- type WorkspaceDirectory
Constants ¶
const MaxOutputBytes = 1024 * 1024
const MaxRequestBytes = 72 * 1024 * 1024
const MaxResponseBytes = 16 * 1024 * 1024
const ProtocolVersion = 5
const SDKVersion = "v0.7.8"
Variables ¶
var ErrUnconfirmed = sandbox.ErrComputeUnconfirmed
var NodeArtifacts = []providerassets.Artifact{
{Path: "native/bin/oac-microsandbox-provider", Suffix: "microsandbox-provider", Role: "runtime"},
{Path: "native/microsandbox/msb", Suffix: "msb", Role: "runtime"},
{Path: "native/microsandbox/libkrunfw.so.5.6.1", Suffix: "libkrunfw.so.5.6.1", Role: "runtime"},
}
NodeArtifacts are the native files a microsandbox node installs beside the shared node payload.
Functions ¶
func BuildNode ¶ added in v0.0.10
func BuildNode(c sandbox.NodeConfig, options sandbox.LocalOptions, result *sandbox.Built) (func(), error)
BuildNode constructs the node-local microsandbox adapter from a validated node configuration.
func CheckpointClass ¶ added in v0.0.10
func CheckpointClass(c Config) (sandbox.CheckpointCompatibility, error)
CheckpointClass deliberately admits only identical native and host execution profiles. Paths, hostname and local SDK cache identities are not compatibility.
func CheckpointStore ¶ added in v0.0.10
CheckpointStore opens only an explicitly configured, private archive root. Its marker is an operator-owned identity, never inferred from workspace paths.
func HelperEnvironment ¶
Strip native selector and credential-bearing inherited configuration. Operator proxy settings are not passed into guest environments by this adapter.
func Operations ¶
func Operations() providercontract.Operations
Operations is this adapter's complete authored resource contract.
func Policy ¶
func Policy() sandbox.DeploymentPolicy
func SnapshotReference ¶
func ValidReference ¶
func ValidateBootstrap ¶
func ValidateCommand ¶
func ValidateRequest ¶
func ValidateResources ¶
func ValidateSnapshot ¶
func ValidateSnapshot(c Config, r sandbox.Reference, s SnapshotIdentity) error
func ValidateSpecification ¶
func ValidateSpecification(s sandbox.DeploymentSpec) error
Types ¶
type Config ¶
type Config struct {
// ExternalWorkspace is derived from the immutable deployment specification.
ExternalWorkspace bool
InstallationID string
HelperPath string
RuntimeHome string
CheckpointRoot 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.
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 Native ¶ added in v0.0.10
type Native struct {
HelperPath string `json:"helper_path"`
RuntimeHome string `json:"runtime_home"`
CheckpointRoot string `json:"checkpoint_root"`
RuntimePath string `json:"runtime_path"`
FirmwarePath string `json:"firmware_path"`
Network Network `json:"network"`
}
Native is the node configuration's native object for microsandbox: the helper, Runtime and firmware paths, the private store and the network policy. The helper owns local paths; no ambient backend is selected. Resources, the image and the artifact hashes come from the deployment specification.
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) Quiescent ¶
func (p *ProcessCaller) Quiescent() bool
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) DeleteSnapshot ¶
func (*Provider) GetCompute ¶
func (*Provider) KillCompute ¶
func (*Provider) NewCompute ¶
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) ProviderOperations ¶
func (*Provider) ProviderOperations() providercontract.Operations
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 ¶
type Request ¶
type Request struct {
Workspace *WorkspaceDirectory `json:",omitempty"`
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
}
type Response ¶
type Response struct {
// CreateSettled binds State to a completed Create rejection or an initial_info
// absence whose allocation lock permanently prevents a later initial Create.
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
type WorkspaceDirectory ¶ added in v0.0.10
Request and Response are the finite, private helper boundary. Confidential Bootstrap and Command bytes travel only through stdin and are never logged. WorkspaceDirectory is the resolved private helper input, without filesystem adapter configuration.