Train Methods

The members of Train<TInput, TReturn> (Trax.Core), inherited by ServiceTrain<TIn, TOut> (Trax.Effect), that declare a chain inside Junctions(), run a train, and read its chain without running it. The types themselves are under Trains and Junctions.

Declaring a chain

MethodDescription
JunctionsThe override that declares the train's chain
ChainRuns a junction, its input from Memory and its output stored back
IChainRuns a junction resolved by its interface from Memory or the container
ShortCircuitRuns a junction whose success becomes the result Resolve returns; its failure is ignored
ExtractCopies a member of a Memory value into its own Memory slot
AddServicesStores services in Memory under their interfaces
ResolveEnds the chain, taking the result out of Memory

Deciding and routing

MethodDescription
DecideAsks a decider several typed questions about a value in Memory and stores the decisions
SwitchSends the train down one of several tracks, one per enum member
GateRoutes on the probability that a yes/no answer is yes
ScaleRoutes on where the state falls on an ordered scale
ParallelRuns named branches side by side and joins them
CheckpointStores a declared state, so a later run of the same input resumes after it

Running a train

MethodDescription
RunRuns the train and throws its failure
RunEitherRuns the train and returns its failure as Left

Reading a chain

MemberDescription
DeclaredChainReads the declared chain without running it; ChainVerification.Verify checks it
ChainGraphThe declared chain as a graph with stable node ids, canonical JSON and a hash