execstate

package
v0.16.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSuperseded         = errors.New("execution attempt superseded")
	ErrStaleJob           = errors.New("execution is not dispatchable")
	ErrPendingApproval    = errors.New("pending approval")
	ErrExecutionCancelled = errors.New("execution cancelled")
)

Functions

This section is empty.

Types

type ActionState

type ActionState struct {
	Status     ActionStatus `json:"status"`
	Attempt    int32        `json:"attempt,omitempty"`
	StartedAt  *time.Time   `json:"started_at,omitempty"`
	FinishedAt *time.Time   `json:"finished_at,omitempty"`
	Error      string       `json:"error,omitempty"`
}

type ActionStatus

type ActionStatus string
const (
	ActionStatusPending   ActionStatus = "pending"
	ActionStatusRunning   ActionStatus = "running"
	ActionStatusCompleted ActionStatus = "completed"
	ActionStatusFailed    ActionStatus = "failed"
	ActionStatusSkipped   ActionStatus = "skipped"
	ActionStatusBlocked   ActionStatus = "blocked"
	ActionStatusCancelled ActionStatus = "cancelled"
)

type Event

type Event struct {
	ExecID    string
	Attempt   int32
	ActionID  string
	Type      EventType
	Error     string
	Outputs   map[string]any
	CreatedAt time.Time
}

type EventType

type EventType string
const (
	EventQueued          EventType = "queued"
	EventStarted         EventType = "started"
	EventWaitingApproval EventType = "waiting_approval"
	EventCompleted       EventType = "completed"
	EventErrored         EventType = "errored"
	EventCancelled       EventType = "cancelled"
	EventActionStarted   EventType = "action_started"
	EventActionCompleted EventType = "action_completed"
	EventActionFailed    EventType = "action_failed"
	EventActionBlocked   EventType = "action_blocked"
	EventActionSkipped   EventType = "action_skipped"
	EventActionCancelled EventType = "action_cancelled"
	EventActionReset     EventType = "action_reset"
)

type ExecutionState

type ExecutionState struct {
	Status          string
	Error           string
	StartedAt       *time.Time
	CompletedAt     *time.Time
	Outputs         map[string]any
	Actions         map[string]ActionState
	CurrentActionID string
}

func Fold

func Fold(events []Event) ExecutionState

func LoadState

func LoadState(ctx context.Context, store repo.Store, execID string) (ExecutionState, error)

type Recorder

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

func NewRecorder

func NewRecorder(ctx context.Context, store repo.Store, execID string) (*Recorder, error)

func (*Recorder) Attempt

func (r *Recorder) Attempt(id string) int32

func (*Recorder) BlockAction

func (r *Recorder) BlockAction(ctx context.Context, id string, err error) error

func (*Recorder) Finish

func (r *Recorder) Finish(ctx context.Context, err error) error

func (*Recorder) FinishAction

func (r *Recorder) FinishAction(ctx context.Context, id string, outputs map[string]any, err error) error

func (*Recorder) Runnable

func (r *Recorder) Runnable(id string) bool

func (*Recorder) SkipPending

func (r *Recorder) SkipPending(ctx context.Context, ids []string) error

func (*Recorder) Start

func (r *Recorder) Start(ctx context.Context) error

func (*Recorder) StartAction

func (r *Recorder) StartAction(ctx context.Context, id string) error

func (*Recorder) State

func (r *Recorder) State() ExecutionState

Jump to

Keyboard shortcuts

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