testfixture

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testfixture provides an explicitly driven durable host executor for control tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrashPoint

type CrashPoint string

CrashPoint names a durable boundary for deterministic process crash injection.

const (
	// BeforeAcceptance precedes any durable request binding.
	BeforeAcceptance CrashPoint = "before_acceptance"
	// AfterAcceptance follows durable request binding, before acknowledgement.
	AfterAcceptance CrashPoint = "after_acceptance"
	// AfterClaim follows a durable claim and precedes entry to the runner.
	AfterClaim CrashPoint = "after_claim"
	// AfterEffect is called by the host runner after its real external effect.
	AfterEffect CrashPoint = "after_effect"
	// BeforeCompletion precedes terminal commit and permits cancellation arbitration.
	BeforeCompletion CrashPoint = "before_completion"
	// AfterCompletion follows durable terminal commit, before returning to the host.
	AfterCompletion CrashPoint = "after_completion"
)

type DurableExecutor

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

DurableExecutor retains scoped request identity and job state across host replacement. Only RunQueued dispatches work; opening or accepting never starts a worker.

func OpenExecutor

func OpenExecutor(cfg ExecutorConfig) (_ *DurableExecutor, err error)

OpenExecutor acquires exclusive host ownership and interrupts lost execution claims.

func (*DurableExecutor) Accept

func (e *DurableExecutor) Accept(ctx context.Context, submission control.Submission) (control.JobRecord, error)

Accept atomically binds a scoped request key before acknowledging a job.

func (*DurableExecutor) Cancel

func (e *DurableExecutor) Cancel(ctx context.Context, scope, id string) (control.JobRecord, error)

Cancel persists cancellation intent before signaling owned execution.

func (*DurableExecutor) Close

func (e *DurableExecutor) Close() error

Close fences this owner and releases exclusive directory ownership. In-flight runners may return later, but can no longer publish their results.

func (*DurableExecutor) RunQueued

func (e *DurableExecutor) RunQueued(ctx context.Context, scope, id string) (control.JobRecord, error)

RunQueued explicitly claims and executes one queued job; no worker starts implicitly.

func (*DurableExecutor) Status

func (e *DurableExecutor) Status(ctx context.Context, scope, id string) (control.JobRecord, error)

Status returns the persisted job only within its accepted scope.

type ExecutorConfig

type ExecutorConfig struct {
	Dir        string
	Run        RunFunc
	Checkpoint func(CrashPoint) error
}

ExecutorConfig binds one exclusively owned disk directory and a host runner.

type Result

type Result struct {
	Stopped      bool
	Finalized    bool
	Canceled     bool
	ExperimentID string
	Attempt      eval.AttemptKey
	Manifest     inspect.ManifestRef
}

Result describes established execution and finalization facts, not cancellation intent.

type RunFunc

type RunFunc func(context.Context, control.Submission) (Result, error)

RunFunc executes a host-resolved immutable submission and finalizes its evidence. The host must reject unavailable recorded task/binding versions before effects.

Jump to

Keyboard shortcuts

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