sandboxexec

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

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

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 New

func New(o Options) (*Executor, error)

New returns an executor.

func (*Executor) AccountLimit

func (e *Executor) AccountLimit() int32

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) Cancel

func (e *Executor) Cancel(taskID string)

Cancel implements the node's executor.

func (*Executor) Close

func (e *Executor) Close() error

Close implements the node's executor.

func (*Executor) GatewayPorts

func (e *Executor) GatewayPorts(context.Context, string) (map[int]int, error)

GatewayPorts has nothing to say: a sandbox preview's URLs come from the provider.

func (*Executor) HeldExit

func (e *Executor) HeldExit(taskID string) (int, bool)

HeldExit implements the node's executor.

func (*Executor) Holds

func (e *Executor) Holds(_ context.Context, taskID string) bool

Holds implements the node's executor.

func (*Executor) Inject

func (e *Executor) Inject(taskID, text string) error

Inject implements the node's executor.

func (*Executor) ListOwned

func (e *Executor) ListOwned(context.Context) ([]docker.OwnedContainer, error)

ListOwned is every task this node recorded a sandbox for.

func (*Executor) ListPreviews

func (e *Executor) ListPreviews(ctx context.Context) ([]docker.HeldPreview, error)

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) OnDeleted

func (e *Executor) OnDeleted(fn func(id string))

OnDeleted is called with every sandbox Teardown deletes.

func (*Executor) PruneImages

PruneImages implements the node's executor.

func (*Executor) Reap

func (e *Executor) Reap(ctx context.Context, id string) error

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

func (e *Executor) ServerVersion() string

ServerVersion implements the node's executor.

func (*Executor) SetTemplate

func (e *Executor) SetTemplate(t string)

SetTemplate changes the snapshot image tasks start from, for every task planned after it.

func (*Executor) TaskDir

func (e *Executor) TaskDir(taskID string) string

TaskDir implements the node's executor.

func (*Executor) Teardown

func (e *Executor) Teardown(ctx context.Context, taskID string, _ bool) error

Teardown deletes the task's sandbox and forgets it. keepWorkspace has nothing to keep: the workspace lives and dies with the sandbox.

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
}

Options configures New.

Directories

Path Synopsis
Package agentbin carries podium-sandbox-agent inside podium-node, the way the docker executor carries podium-runner.
Package agentbin carries podium-sandbox-agent inside podium-node, the way the docker executor carries podium-runner.

Jump to

Keyboard shortcuts

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