terminal

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package terminal implements the pure-domain request/attempt terminal owner state machine (requirements 7.1–7.8, design D8, D13).

One CAS Claim(command) wins per owner; the winner snapshots accumulators once and publishes an Outcome. Concurrent losers observe the same result without re-running effects. Domain code has no SQL, HTTP, or filesystem I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccumulatorSnapshot

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

AccumulatorSnapshot is an opaque immutable copy of mutable stream accumulators taken by the CAS claim winner.

func NewAccumulatorSnapshot

func NewAccumulatorSnapshot(data []byte, outputCommitted bool) AccumulatorSnapshot

NewAccumulatorSnapshot copies data into an opaque snapshot.

func (AccumulatorSnapshot) Bytes

func (s AccumulatorSnapshot) Bytes() []byte

Bytes returns a defensive copy of the snapshot bytes.

func (AccumulatorSnapshot) Clone

Clone returns a deep copy.

func (AccumulatorSnapshot) Equal

Equal reports whether two snapshots have identical bytes and flags.

func (AccumulatorSnapshot) OutputCommitted

func (s AccumulatorSnapshot) OutputCommitted() bool

OutputCommitted reports whether visible output was committed when snapped.

type Outcome

type Outcome struct {
	Code               sdk.OutcomeCode
	Command            sdk.Command
	Snapshot           AccumulatorSnapshot
	SettleCustomer     bool // request plane: customer authority
	ReleaseConcurrency bool // request plane: logical concurrency / request provider
	SettleOperator     bool // attempt plane: operator authority
	ReleaseAttempt     bool // attempt plane: attempt provider / attempt lease
	Scope              sdk.Scope
}

Outcome is the published terminal result for one owner.

type Owner

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

Owner is a CAS-owned terminal state machine for one request or attempt.

func NewOwner

func NewOwner(scope sdk.Scope) *Owner

NewOwner constructs an owner in StateOpen.

func (*Owner) Advance

func (o *Owner) Advance(to sdk.State) error

Advance moves the owner along the post-claim lifecycle.

func (*Owner) Claim

func (o *Owner) Claim(cmd sdk.Command, snap AccumulatorSnapshot) Result

Claim competes for the single terminalization outcome.

The winner snapshots accumulators once and publishes the outcome. Concurrent or subsequent callers observe the same outcome without re-running effects.

func (*Owner) Outcome

func (o *Owner) Outcome() (Outcome, bool)

Outcome returns the published outcome when claimed.

func (*Owner) Scope

func (o *Owner) Scope() sdk.Scope

Scope returns the owner scope.

func (*Owner) State

func (o *Owner) State() sdk.State

State returns the current owner state.

type Result

type Result struct {
	Won     bool
	Outcome Outcome
	State   sdk.State
	Err     error
}

Result is the Claim response observed by a caller.

Jump to

Keyboard shortcuts

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