Expand description
Steno is an in-progress prototype implementation of distributed sagas. Sagas orchestrate the execution of a set of asynchronous tasks that can fail. The saga pattern provides useful semantics for unwinding the whole operation when any task fails. For more on distributed sagas, see this 2017 JOTB talk by Caitie McCaffrey.
Overview
- Write some functions that will be used as actions and undo actions for
your saga. Package these up with
ActionFunc::new_action()
. - Add these actions to an
ActionRegistry
- Use
DagBuilder
to construct a graph of these actions. Wrap this up in aSagaDag
. - Construct a saga execution coordinator with
sec()
and use that to run the saga. You can start with anInMemorySecStore
or impl your ownSecStore
.
This crate is necessarily somewhat complex to use. For a detailed, documented example, see examples/trip.rs.
Structs
Action’s handle to the saga subsystem
Implementation of
Action
that uses ordinary functions for the action and
undo actionUnique name for a saga
Action
A registry of saga actions that can be used across multiple sagas.
Describes a directed acyclic graph (DAG) to be used as a saga or subsaga
Used to build a
Dag
that can then be executed as either a saga or
subsagaImplementation of
SecStore
that doesn’t store any state persistentlyDescribes a node in the saga DAG
Arguments which can be passed to the SEC instructing it to change
the number of times a node is executed.
Describes what an impl of
SecStore
needs to store for a persistent saga
record.Summarizes in-progress execution state of a saga
Unique identifier for a Saga (an execution of a saga template)
Write to a saga’s log
Human-readable name for a particular saga
An entry in the saga log
Unique identifier for a saga node
Summarizes the final state of a saga execution
Provides access to failure details for a saga that failed
Provides access to outputs from a saga that completed successfully
Simple file-based serialization and deserialization of a whole saga,
intended only for testing and debugging
External consumer’s view of a saga
Client handle for a Saga Execution Coordinator (SEC)
Handle used by
SagaExecutor
for sending messages back to the SECEnums
An error produced by a saga action
An error returned from
ActionRegistry::get()
Describes the cacheable state of the saga
Event types that may be found in the log for a particular action
State-specific parts of a consumer’s view of a saga
Traits
Building blocks of sagas
Data produced by the consumer that may need to be serialized to the saga log
Collection of consumer-provided types, effectively defining the type
signature of a saga
Interfaces implemented by the Steno consumer to storing saga state and saga
log state persistently
Functions
Given a function
f
, return an ActionFunc
that uses f
as the action and
provides a no-op undo function (which does nothing and always succeeds).Creates a new Saga Execution Coordinator
Type Definitions
Result of a function that implements a saga action
Result of a saga action
Result of a saga undo action