stub

package
v0.4.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package stub is an in-memory runtime for tests and for the conformance suite's first target. It creates no processes. It does model the parts of the contract the ledger and the protocol depend on: fake endpoints, parked deltas, a per-fiber dirtied working set taken from the clone payload (`{"dirty_bytes": N}`), and a kernel-style OOM exit when that working set exceeds the grant's w_budget_bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

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

func New

func New() *Runtime

New returns a runtime advertising TierCheckpoint (park/resume works).

func NewWithTier

func NewWithTier(t core.Tier) *Runtime

NewWithTier lets tests and the conformance driver pick the advertised tier, for example TierWarm to exercise the tier-floor cases.

func (*Runtime) Clone

func (r *Runtime) Clone(_ context.Context, spec core.CloneSpec) (core.FiberHandle, error)

func (*Runtime) DeviceOffer

func (r *Runtime) DeviceOffer(string) (string, uint64)

DeviceOffer implements core.DeviceCapable: the stub simulates an engine of class sim for every grant, so device budgets of that class are admitted and enforced on the payload's device_bytes.

func (*Runtime) DiscardDelta

func (r *Runtime) DiscardDelta(_ context.Context, ref string) error

DiscardDelta implements core.DeltaDiscarder: the delta a session was resumed from is dropped once nothing will resume it again.

func (*Runtime) Exits

func (r *Runtime) Exits() <-chan core.FiberExit

func (*Runtime) HasDelta

func (r *Runtime) HasDelta(ref string) bool

HasDelta implements core.DeltaChecker. The stub keeps deltas in memory, so after a restart none exist: parked sessions are dropped, which is what the conformance suite expects of a target without durable deltas.

func (*Runtime) HoldsWorkspaces

func (r *Runtime) HoldsWorkspaces() bool

HoldsWorkspaces implements core.WorkspaceHolder. The stub models the contract, so grants with a disk budget are admitted.

func (*Runtime) IsolatesTenants

func (r *Runtime) IsolatesTenants() bool

IsolatesTenants implements core.Isolator. The stub runs no code, so no fiber can reach the host and untrusted grants are admitted.

func (*Runtime) List

func (r *Runtime) List(context.Context) ([]core.FiberHandle, error)

func (*Runtime) Park

func (r *Runtime) Park(_ context.Context, fiberID string, _ bool) (string, error)

func (*Runtime) PrepareTemplate

func (r *Runtime) PrepareTemplate(_ context.Context, g core.Grant) error

func (*Runtime) Pressure

func (r *Runtime) Pressure(string) (float64, error)

Pressure implements core.PressureSource. The stub has no kernel and no memory, so no grant is ever under pressure.

func (*Runtime) Release

func (r *Runtime) Release(_ context.Context, fiberID string, discard bool) error

func (*Runtime) Stats

func (r *Runtime) Stats(_ context.Context, fiberID string) (core.FiberStats, error)

func (*Runtime) Tier

func (r *Runtime) Tier() core.Tier

Jump to

Keyboard shortcuts

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