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
- Variables
- 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 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) DiscoverSelection(context.Context, sandbox.Selection) (sandbox.Selection, 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 (*Provider) ObservationProviderType() string
- func (p *Provider) Observe(ctx context.Context, target runtimeobs.Target) (runtimeobs.Sample, error)
- func (p *Provider) ObserveBatch(context.Context, []runtimeobs.Target) ([]runtimeobs.BatchResult, error)
- func (*Provider) ProviderOperations() providercontract.Operations
- func (p *Provider) Quiescent() bool
- func (p *Provider) Renew(ctx context.Context, r sandbox.Reference) (sandbox.Info, error)
- func (p *Provider) ResolveObservationSource(context.Context) (runtimeobs.Source, 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)
- func (p *Provider) VerifyCredential(context.Context, []sandbox.Reference) error
- type Request
- type Response
- type ResumeRequest
- type SnapshotIdentity
- type State
- type SuspendRequest
Constants ¶
const MaxOutputBytes = 1024 * 1024
const MaxRequestBytes = 72 * 1024 * 1024
const MaxResponseBytes = 16 * 1024 * 1024
const ProtocolVersion = 2
const SDKVersion = "v0.7.2"
Variables ¶
var ErrUnconfirmed = sandbox.ErrComputeUnconfirmed
Functions ¶
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 {
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.
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) Quiescent ¶
func (p *ProcessCaller) Quiescent() bool
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) DeleteSnapshot ¶
func (*Provider) DiscoverSelection ¶
func (*Provider) GetCompute ¶
func (*Provider) KillCompute ¶
func (*Provider) NewCompute ¶
func (*Provider) ObservationProviderType ¶
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 (p *Provider) ObserveBatch(context.Context, []runtimeobs.Target) ([]runtimeobs.BatchResult, error)
func (*Provider) ProviderOperations ¶
func (*Provider) ProviderOperations() providercontract.Operations
func (*Provider) Quiescent ¶
Quiescent includes a helper that outlived the caller's canceled context.
func (*Provider) ResolveObservationSource ¶
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 {
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