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 ¶
- type Runtime
- func (r *Runtime) Clone(_ context.Context, spec core.CloneSpec) (core.FiberHandle, error)
- func (r *Runtime) DeviceOffer(string) (string, uint64)
- func (r *Runtime) DiscardDelta(_ context.Context, ref string) error
- func (r *Runtime) Exits() <-chan core.FiberExit
- func (r *Runtime) HasDelta(ref string) bool
- func (r *Runtime) HoldsWorkspaces() bool
- func (r *Runtime) IsolatesTenants() bool
- func (r *Runtime) List(context.Context) ([]core.FiberHandle, error)
- func (r *Runtime) Park(_ context.Context, fiberID string, _ bool) (string, error)
- func (r *Runtime) PrepareTemplate(_ context.Context, g core.Grant) error
- func (r *Runtime) Pressure(string) (float64, error)
- func (r *Runtime) Release(_ context.Context, fiberID string, discard bool) error
- func (r *Runtime) Stats(_ context.Context, fiberID string) (core.FiberStats, error)
- func (r *Runtime) Tier() core.Tier
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 ¶
NewWithTier lets tests and the conformance driver pick the advertised tier, for example TierWarm to exercise the tier-floor cases.
func (*Runtime) DeviceOffer ¶
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 ¶
DiscardDelta implements core.DeltaDiscarder: the delta a session was resumed from is dropped once nothing will resume it again.
func (*Runtime) HasDelta ¶
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 ¶
HoldsWorkspaces implements core.WorkspaceHolder. The stub models the contract, so grants with a disk budget are admitted.
func (*Runtime) IsolatesTenants ¶
IsolatesTenants implements core.Isolator. The stub runs no code, so no fiber can reach the host and untrusted grants are admitted.
func (*Runtime) PrepareTemplate ¶
func (*Runtime) Pressure ¶
Pressure implements core.PressureSource. The stub has no kernel and no memory, so no grant is ever under pressure.