Documentation
¶
Index ¶
- Variables
- type Engine
- func (e *Engine) CreateSandbox(ctx context.Context, cfg runtime.SandboxConfig) (*Sandbox, error)
- func (e *Engine) DeleteSnapshot(ctx context.Context, snapshotID string) error
- func (e *Engine) DestroySandbox(ctx context.Context, id string) error
- func (e *Engine) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (*runtime.ExecResult, error)
- func (e *Engine) ExecStream(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.ExecStream, error)
- func (e *Engine) GetSandbox(id string) (*Sandbox, error)
- func (e *Engine) ListDir(ctx context.Context, id string, path string) ([]runtime.FileInfo, error)
- func (e *Engine) ListSandboxes() []*Sandbox
- func (e *Engine) ListSnapshots(ctx context.Context, sandboxID string) ([]runtime.SnapshotInfo, error)
- func (e *Engine) MkDir(ctx context.Context, id string, path string) error
- func (e *Engine) ReadFile(ctx context.Context, id string, path string) ([]byte, error)
- func (e *Engine) RemoveFile(ctx context.Context, id string, path string) error
- func (e *Engine) RestoreSnapshot(ctx context.Context, snapshotID string) (*Sandbox, error)
- func (e *Engine) Shutdown(_ context.Context)
- func (e *Engine) Snapshot(ctx context.Context, id string, name string) (*runtime.SnapshotInfo, error)
- func (e *Engine) Stats(ctx context.Context, id string) (*runtime.SandboxStats, error)
- func (e *Engine) StopSandbox(ctx context.Context, id string) error
- func (e *Engine) WriteFile(ctx context.Context, id string, path string, content []byte) error
- type Sandbox
- type WarmPool
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates sandbox lifecycle.
func NewEngine ¶
func NewEngine(rt runtime.Runtime, st store.Store, cfg config.SandboxConfig, s3Cfg config.S3Config, logger *slog.Logger) *Engine
NewEngine creates a new Engine.
func (*Engine) CreateSandbox ¶
CreateSandbox creates and starts a new sandbox.
func (*Engine) DeleteSnapshot ¶
DeleteSnapshot removes a snapshot.
func (*Engine) DestroySandbox ¶
DestroySandbox stops and removes a sandbox.
func (*Engine) Exec ¶
func (e *Engine) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (*runtime.ExecResult, error)
Exec runs a command in a sandbox.
func (*Engine) ExecStream ¶
func (e *Engine) ExecStream(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.ExecStream, error)
ExecStream runs a streaming command in a sandbox.
func (*Engine) GetSandbox ¶
GetSandbox returns a sandbox by ID.
func (*Engine) ListSandboxes ¶
ListSandboxes returns all tracked sandboxes.
func (*Engine) ListSnapshots ¶
func (e *Engine) ListSnapshots(ctx context.Context, sandboxID string) ([]runtime.SnapshotInfo, error)
ListSnapshots returns all snapshots for a sandbox.
func (*Engine) RemoveFile ¶
RemoveFile removes a file from a sandbox.
func (*Engine) RestoreSnapshot ¶
RestoreSnapshot restores a sandbox from a snapshot.
func (*Engine) Shutdown ¶
Shutdown gracefully stops all sandboxes. Uses a detached context so shutdown is not cancelled by the caller's context.
func (*Engine) Snapshot ¶
func (e *Engine) Snapshot(ctx context.Context, id string, name string) (*runtime.SnapshotInfo, error)
Snapshot creates a snapshot of a sandbox.
func (*Engine) StopSandbox ¶
StopSandbox stops a sandbox without removing it.
type Sandbox ¶
type Sandbox struct {
ID string `json:"id"`
Image string `json:"image"`
Config runtime.SandboxConfig `json:"-"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Ports []runtime.PortMapping `json:"ports,omitempty"`
// contains filtered or unexported fields
}
Sandbox represents a managed sandbox instance.
func (*Sandbox) GetStatus ¶
func (s *Sandbox) GetStatus() runtime.SandboxStatus
GetStatus returns the sandbox status (thread-safe).
func (*Sandbox) MarshalJSON ¶
MarshalJSON implements custom JSON marshaling to include the status field.
func (*Sandbox) SetStatus ¶
func (s *Sandbox) SetStatus(status runtime.SandboxStatus)
SetStatus updates the sandbox status (thread-safe).
type WarmPool ¶
type WarmPool struct {
// contains filtered or unexported fields
}
WarmPool pre-creates containers so sandbox creation is near-instant.
func NewWarmPool ¶
func NewWarmPool(rt runtime.Runtime, size int, cfg runtime.SandboxConfig, logger *slog.Logger) *WarmPool
NewWarmPool creates a warm pool that maintains `size` pre-created containers.
func (*WarmPool) Acquire ¶
Acquire gets a pre-warmed container ID from the pool. Returns empty string if pool is empty (caller should create normally).