Documentation
¶
Overview ¶
Package sandboxexec runs tasks in cloud sandboxes for podium-node. For each task it makes one sandbox through a sandbox.Provider, starts podium-sandbox-agent in it, and relays the agent's events and transfers. It never knows which provider it is driving.
Index ¶
- type Executor
- func (e *Executor) AccountLimit() int32
- func (e *Executor) Adopt(ctx context.Context, req docker.AdoptRequest, events chan<- docker.Event) (docker.Result, error)
- func (e *Executor) Cancel(taskID string)
- func (e *Executor) Close() error
- func (e *Executor) EndWait(taskID string) error
- func (e *Executor) GatewayPorts(context.Context, string) (map[int]int, error)
- func (e *Executor) HeldExit(taskID string) (int, bool)
- func (e *Executor) Holds(_ context.Context, taskID string) bool
- func (e *Executor) Inject(taskID, text string) error
- func (e *Executor) KeepsWorkspaceImages() (string, bool)
- func (e *Executor) ListOwned(context.Context) ([]docker.OwnedContainer, error)
- func (e *Executor) ListPreviews(ctx context.Context) ([]docker.HeldPreview, error)
- func (e *Executor) OnDeleted(fn func(id string))
- func (e *Executor) PoolReady() int
- func (e *Executor) PruneImages(context.Context, docker.PruneRequest) ([]docker.ImageRecord, error)
- func (e *Executor) Reap(ctx context.Context, id string) error
- func (e *Executor) Run(ctx context.Context, req docker.Request, events chan<- docker.Event) (docker.Result, error)
- func (e *Executor) ServerVersion() string
- func (e *Executor) SetTemplate(t string)
- func (e *Executor) TaskDir(taskID string) string
- func (e *Executor) Teardown(ctx context.Context, taskID string, _ bool) error
- type Options
- type PoolOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor implements podium-node's executor on a sandbox provider.
func (*Executor) AccountLimit ¶
AccountLimit is the most sandboxes the provider account allows at once, 0 when unknown. It answers from the last read and reads again in the background at most once a minute, so a heartbeat never waits on the provider.
func (*Executor) Adopt ¶
func (e *Executor) Adopt(ctx context.Context, req docker.AdoptRequest, events chan<- docker.Event) (docker.Result, error)
Adopt reattaches to a run whose sandbox outlived the previous daemon.
func (*Executor) Close ¶
Close implements the node's executor. A pool's waiting sandboxes are deleted: nothing would take them before the node is back, and they cost what any sandbox costs.
func (*Executor) GatewayPorts ¶
GatewayPorts has nothing to say: a sandbox preview's URLs come from the provider.
func (*Executor) KeepsWorkspaceImages ¶ added in v0.9.0
KeepsWorkspaceImages reports whether this executor keeps a session's workspace as an image of its provider's own, and which provider that is.
func (*Executor) ListPreviews ¶
ListPreviews is every recorded task that publishes ports. Their URLs are the provider's, so there is no address or slot to give back.
func (*Executor) PoolReady ¶ added in v0.8.0
PoolReady is how many pooled sandboxes are ready right now, in every pool.
func (*Executor) PruneImages ¶
func (e *Executor) PruneImages(context.Context, docker.PruneRequest) ([]docker.ImageRecord, error)
PruneImages implements the node's executor.
func (*Executor) Reap ¶
Reap deletes a sandbox this node does not hold, for a task the control plane gave up on. One that is already gone is not an error.
func (*Executor) Run ¶
func (e *Executor) Run(ctx context.Context, req docker.Request, events chan<- docker.Event) (docker.Result, error)
Run makes the task's sandbox, starts the agent in it and relays the run.
func (*Executor) ServerVersion ¶
ServerVersion implements the node's executor.
func (*Executor) SetTemplate ¶
SetTemplate changes the snapshot image tasks start from, for every task planned after it.
type Options ¶
type Options struct {
Provider sandbox.Provider
DataDir string
// Template is the provider snapshot a task that names none starts from.
Template string
// Agent returns podium-sandbox-agent for linux/amd64.
Agent func() ([]byte, error)
Logger *slog.Logger
// Pool keeps sandboxes of one shape ready before any task asks. See pool.go.
Pool PoolOptions
}
Options configures New.
type PoolOptions ¶ added in v0.8.0
type PoolOptions struct {
// Size is how many ready sandboxes to keep. Zero is no pool.
Size int
// Image is the image the pooled sandboxes boot, on a provider that boots images. Empty
// with a provider that cannot is the node's template.
Image string
// Images keeps a pool of Size for each image instead, in this order. A conversation's
// playbooks run on a handful of images, and each that is pooled starts at once.
Images []string
// TTL is how long an unclaimed sandbox lives before the provider stops it; a taken one
// gets its task's own. Zero is poolTTL.
TTL time.Duration
}
PoolOptions configures a pool.