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
Context - Action’s handle to the saga subsystem
- Action
Func - Implementation of
Action
that uses ordinary functions for the action and undo action - Action
Name - Unique name for a saga
Action
- Action
Registry - A registry of saga actions that can be used across multiple sagas.
- Dag
- Describes a directed acyclic graph (DAG) to be used as a saga or subsaga
- DagBuilder
- Used to build a
Dag
that can then be executed as either a saga or subsaga - DagBuilder
Error - InMemory
SecStore - Implementation of
SecStore
that doesn’t store any state persistently - Node
- Describes a node in the saga DAG
- Node
Name - Unique name for a saga
Node
- Repeat
Injected - Arguments which can be passed to the SEC instructing it to change the number of times a node is executed.
- Saga
Create Params - Describes what an impl of
SecStore
needs to store for a persistent saga record. - SagaDag
- A
Dag
plus saga input parameters that together can be used to execute a saga - Saga
Exec Status - Summarizes in-progress execution state of a saga
- SagaId
- Unique identifier for a Saga (an execution of a saga template)
- SagaLog
- Write to a saga’s log
- Saga
Name - Human-readable name for a particular saga
- Saga
Node Event - An entry in the saga log
- Saga
Node Id - Unique identifier for a saga node
- Saga
Result - Summarizes the final state of a saga execution
- Saga
Result Err - Provides access to failure details for a saga that failed
- Saga
Result Ok - Provides access to outputs from a saga that completed successfully
- Saga
Serialized - Simple file-based serialization and deserialization of a whole saga, intended only for testing and debugging
- Saga
View - External consumer’s view of a saga
- SecClient
- Client handle for a Saga Execution Coordinator (SEC)
- SecExec
Client - Handle used by
SagaExecutor
for sending messages back to the SEC
Enums§
- Action
Error - An error produced by a saga action
- Action
Registry Error - An error returned from
ActionRegistry::get()
- Saga
Cached State - Describes the cacheable state of the saga
- Saga
Node Event Type - Event types that may be found in the log for a particular action
- Saga
State View - State-specific parts of a consumer’s view of a saga
- Undo
Action Error - An error produced by a failed undo action
Traits§
- Action
- Building blocks of sagas
- Action
Data - Data produced by the consumer that may need to be serialized to the saga log
- Saga
Type - Collection of consumer-provided types, effectively defining the type signature of a saga
- SecStore
- Interfaces implemented by the Steno consumer to storing saga state and saga log state persistently
Functions§
- new_
action_ noop_ undo - Given a function
f
, return anActionFunc
that usesf
as the action and provides a no-op undo function (which does nothing and always succeeds). - sec
- Creates a new Saga Execution Coordinator
Type Aliases§
- Action
Func Result - Result of a function that implements a saga action
- Action
Result - Result of a saga action
- Undo
Result - Result of a saga undo action