compute

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SandboxActive added in v0.3.1

func SandboxActive(status compute_v1alpha.SandboxStatus) bool

SandboxActive reports whether a sandbox status indicates the sandbox may be actively running (PENDING, NOT_READY, or RUNNING).

func SandboxDead added in v0.3.1

func SandboxDead(status compute_v1alpha.SandboxStatus) bool

SandboxDead reports whether a sandbox status indicates the sandbox has stopped or failed (STOPPED or DEAD).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a domain-specific client for Sandbox entities

func NewClient

func NewClient(log *slog.Logger, client rpc.Client) *Client

NewClient creates a new Compute client from an RPC client

func (*Client) DeleteSandbox

func (c *Client) DeleteSandbox(ctx context.Context, sandboxID string) error

DeleteSandbox deletes a sandbox, but only if it's dead

func (*Client) GetSandbox

func (c *Client) GetSandbox(ctx context.Context, sandboxID string) (*compute_v1alpha.Sandbox, error)

GetSandbox retrieves a sandbox by name or ID

func (*Client) StopSandbox

func (c *Client) StopSandbox(ctx context.Context, sandboxID string) error

StopSandbox updates a sandbox status to stopped

type Kind added in v0.15.0

type Kind string

Kind classifies what a sandbox is for.

const (
	// KindApp is a sandbox running a deployed application service.
	KindApp Kind = "app"
	// KindAddon is managed infrastructure an app depends on, such as a
	// dedicated database, or a shared server no single app owns.
	KindAddon Kind = "addon"
	// KindRun is a one-off task run.
	KindRun Kind = "run"
	// KindOther is a sandbox none of the above describe.
	KindOther Kind = "other"
)

func SandboxKind added in v0.15.0

func SandboxKind(sb *compute_v1alpha.Sandbox) Kind

SandboxKind separates a user's own services from the platform running underneath them, so a usage report can tell a web process from the database sitting behind it.

This lives here rather than beside either caller because two of them need the same answer: the sandbox controller stamps it onto every metric series, and the usage service filters rows by it. When they were separate implementations they disagreed, which meant a --kind filter could select rows whose metrics said something else.

The classification is read back out of attributes the sandbox already carries rather than stored on it: appspec stamps miren.stage=app-run on deployed services and the run controller stamps miren.stage=run, while the addon framework passes the addon's own labels through as log attributes and sets no stage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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