workflowkernel

package
v0.0.0-...-1e7ba32 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package workflowkernel implements the database-independent bounded combinators exposed to MVM workflow programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateState

type AggregateState uint8

AggregateState summarizes terminal item outcomes.

const (
	AggregateSuccess AggregateState = iota
	AggregatePartial
	AggregateFailed
)

Aggregate terminal states.

func (AggregateState) MarshalText

func (state AggregateState) MarshalText() ([]byte, error)

MarshalText supplies stable JSON strings for aggregate states.

func (AggregateState) String

func (state AggregateState) String() string

String returns the stable public name of an aggregate state.

type Callback

type Callback func(any) (any, error)

Callback is one parallel operation or pipeline stage.

type ItemOutcome

type ItemOutcome struct {
	Value any       `json:"value"`
	Error string    `json:"error"`
	Index int       `json:"index"`
	Stage int       `json:"stage"`
	State ItemState `json:"state"`
}

ItemOutcome is one terminal callback outcome. Stage is present only when a pipeline stage failed or was canceled. Outcomes retain input order.

type ItemState

type ItemState uint8

ItemState is the lifecycle state of one input item.

const (
	StateNotStarted ItemState = iota
	StateQueued
	StateRunning
	StateCompleted
	StateFailed
	StateCanceled
	StateSkipped
)

Item lifecycle states.

func (ItemState) MarshalText

func (state ItemState) MarshalText() ([]byte, error)

MarshalText supplies stable JSON strings for item states and count keys.

func (ItemState) String

func (state ItemState) String() string

String returns the stable public name of an item state.

type Outcome

type Outcome struct {
	Counts map[ItemState]int `json:"counts"`
	Items  []ItemOutcome     `json:"items"`
	Total  int               `json:"total"`
	State  AggregateState    `json:"state"`
}

Outcome is the structured terminal result of a combinator invocation.

func Parallel

func Parallel(ctx context.Context, items []any, callback Callback, concurrency int) (Outcome, error)

Parallel applies callback to each item with bounded admission.

func Pipeline

func Pipeline(ctx context.Context, items []any, stages []Callback, concurrency int) (Outcome, error)

Pipeline applies every stage sequentially to each admitted item while processing distinct items concurrently.

Jump to

Keyboard shortcuts

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