execution

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package execution provides effect admission for the durable agent harness.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGate

func CreateGate() (*Gate, *GateControl)

CreateGate creates separate procedure-facing and owner-facing views of an open gate. Its signal has no parent; the caller composes it with invocation context.

Types

type AbortRequested

type AbortRequested struct {
	Cancellation func() error
}

AbortRequested is expected control flow when cancellation wins effect admission. Cancellation waits for the owner's shared cancellation operation and returns its error. The owner supplies a repeatable wait function, not the operation itself. Waiting does not cancel the operation or depend on the invoking context.

func (*AbortRequested) Error

func (*AbortRequested) Error() string

type Gate

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

Gate is the procedure-facing admission capability for one drive pass. Obtain it and its separate owner controls through CreateGate.

func (*Gate) Admit

func (gate *Gate) Admit(invoke func() error) error

Admit checks admission synchronously and invokes the effect on the calling goroutine. Refusal does not invoke it. An admitted callback owns its work and error; lifecycle controls do not wait for it and can be called from it. The locked check is the admission point when owners and procedures run concurrently.

func (*Gate) Signal

func (gate *Gate) Signal() context.Context

Signal is canceled only by SignalAbort or Close, not by BeginAbort.

type GateControl

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

GateControl owns the abort and close transitions for one drive pass.

func (*GateControl) BeginAbort

func (control *GateControl) BeginAbort(cancellation func() error)

BeginAbort refuses new effects without signaling admitted work. Only the first abort while open takes effect. cancellation waits for the owner's shared operation; it must be non-nil and safe to call repeatedly and concurrently.

func (*GateControl) Close

func (control *GateControl) Close(err error)

Close permanently refuses effects with err and signals admitted work unless an earlier signal already won. The first close error wins; err must be non-nil.

func (*GateControl) SignalAbort

func (control *GateControl) SignalAbort()

SignalAbort signals admitted work after the owner commits cancellation. It does nothing while open or closed and does not itself wait for the cancellation.

Jump to

Keyboard shortcuts

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