activator

package
v0.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAppDisabled = fmt.Errorf("app is disabled")

ErrAppDisabled means the app was disabled with `miren app disable`. No capacity will arrive until it is enabled, so callers fail fast instead of waiting out the pool timeout.

View Source
var ErrCrashCooldown = fmt.Errorf("%w: application in crash cooldown", ErrSandboxDiedEarly)

ErrCrashCooldown means the pool is backing off after repeated crashes and the activator refused to start another sandbox. It wraps ErrSandboxDiedEarly so existing checks still match. The sandboxpool manager reports the cooldown once when it begins; callers seeing this per request should stay quiet.

View Source
var ErrPoolTimeout = fmt.Errorf("timeout waiting for sandbox from pool")
View Source
var ErrSandboxDiedEarly = fmt.Errorf("sandbox died while booting")

Functions

This section is empty.

Types

type AppActivator

type AppActivator interface {
	AcquireLease(ctx context.Context, ver *core_v1alpha.AppVersion, service string) (*Lease, error)
	ReleaseLease(ctx context.Context, lease *Lease) error
	RenewLease(ctx context.Context, lease *Lease) (*Lease, error)

	// Invalidations returns a channel that receives notifications when
	// sandboxes become non-RUNNING. Consumers should invalidate any cached
	// leases referencing the invalidated sandbox.
	Invalidations() <-chan SandboxInvalidation

	// SetPoolCreator registers a callback for on-demand pool creation.
	// This is used by ephemeral deployments where the DeploymentLauncher
	// doesn't pre-create pools.
	SetPoolCreator(pc PoolCreator)
}

type Lease

type Lease struct {
	Size int
	URL  string

	// Overflow marks a lease admitted over target. It should carry only the
	// request that acquired it, so over-target load doesn't outlive it.
	Overflow bool
	// contains filtered or unexported fields
}

func NewTestLease added in v0.6.0

func NewTestLease(sb *compute_v1alpha.Sandbox, size int, url string) *Lease

NewTestLease creates a Lease with the given sandbox, size, and URL. This is only intended for use in tests outside the activator package.

func (*Lease) Pool

func (l *Lease) Pool() string

func (*Lease) Sandbox

func (l *Lease) Sandbox() *compute_v1alpha.Sandbox

func (*Lease) SandboxEntity

func (l *Lease) SandboxEntity() *entity.Entity

func (*Lease) Version

func (l *Lease) Version() *core_v1alpha.AppVersion

type PoolCreator added in v0.8.0

type PoolCreator interface {
	CreatePoolForVersion(ctx context.Context, ver *core_v1alpha.AppVersion, service string) (entity.Id, error)
}

PoolCreator creates sandbox pools on demand for versions that don't have one pre-created by the DeploymentLauncher (e.g., ephemeral versions).

type SandboxInvalidation added in v0.6.0

type SandboxInvalidation struct {
	SandboxID entity.Id
}

SandboxInvalidation is sent when a sandbox transitions away from RUNNING, signaling that any cached leases pointing to it should be invalidated.

Jump to

Keyboard shortcuts

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