Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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.
var ErrPoolTimeout = fmt.Errorf("timeout waiting for sandbox from pool")
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)
}
func NewLocalActivator ¶
func NewLocalActivator(ctx context.Context, log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient) AppActivator
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) Sandbox ¶
func (l *Lease) Sandbox() *compute_v1alpha.Sandbox
func (*Lease) SandboxEntity ¶
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
SandboxInvalidation is sent when a sandbox transitions away from RUNNING, signaling that any cached leases pointing to it should be invalidated.