actionstate

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 2 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

Overview

Package actionstate keeps the state each action leaves between its runs, for the runs of a job and for the calls of an action caller alike.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sendable

type Sendable func(map[string]any) (map[string]any, error)

Sendable turns a state into the form it takes when it is sent to an action in a process of its own, as sdk.Sendable does. It is given to New for this package not to import the sdk package, which imports this one.

type Store

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

Store holds the state each action leaves, keyed by the name of the action. A nil Store keeps nothing. Its methods may be called concurrently.

func New

func New(sendable Sendable) *Store

New returns an empty Store that keeps each state as sendable turns it.

func (*Store) Get

func (s *Store) Get(name string) map[string]any

Get returns a copy of the state the action left, or nil when it left none. A runner in this process may change what it is given, and the state kept must not change with it, should the step then fail or time out.

func (*Store) Set

func (s *Store) Set(name string, state map[string]any) error

Set records the state the action leaves, in the form it takes when it is sent, which is a copy of it: a runner in this process may still hold the state it returned. A nil state keeps the one there was. A state that cannot be sent is an error, as it is for an action in a process of its own.

Jump to

Keyboard shortcuts

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