~/bend-docscommunity

model.bend checks

raw source on the hub · import bend-kit-commands@0.6.0.3/model.bend as Model

1 import
import Base

Types

type Outcome source · line 3 · raw

@-R:Type -> Type

type Record source · line 8 · raw

@-P:Type -> @-R:Type -> Type

What the store keeps for one command id: its payload, its outcome, and when it was recorded.

type Reply source · line 11 · raw

@-R:Type -> Type

type Decision source · line 17 · raw

@-S:Type -> @-R:Type -> @-E:Type -> Type

The domain's answer to a new command.

type Step source · line 22 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> Type

Write: commit the state, the record, and the effects together. Note: commit only the record. Keep: write nothing.

Definitions

def accepted source · line 27 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @rr:Pair(R, R) -> @s2:S -> @p:P -> @at:U32 -> @es:List<&1, E> -> Step<S, P, R, E>

def refused source · line 31 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @rr:Pair(R, R) -> @p:P -> @at:U32 -> Step<S, P, R, E>

def replayed source · line 49 · raw

@-R:Type -> @same:Bool -> @o:Outcome<R> -> Reply<R>

Templates

template decided source · line 35 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @-dup_r:(@_:R -> Pair(R, R)) -> @d:Decision<S, R, E> -> @p:P -> @at:U32 -> Step<S, P, R, E>

template fresh source · line 42 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @-dup_r:(@_:R -> Pair(R, R)) -> @-decide:(@_:S -> @_:P -> Decision<S, R, E>) -> @pp:Pair(P, P) -> @s:S -> @at:U32 -> Step<S, P, R, E>

template step source · line 58 · raw

@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @-eq:(@_:P -> @_:P -> Bool) -> @-dup_p:(@_:P -> Pair(P, P)) -> @-dup_r:(@_:R -> Pair(R, R)) -> @-decide:(@_:S -> @_:P -> Decision<S, R, E>) -> @found:Maybe<&1, Record<P, R>> -> @s:S -> @p:P -> @at:U32 -> Step<S, P, R, E>

One command, given the record that the store holds for its id and the domain state s. dup_p and dup_r copy a payload and a result: a new command's payload goes to decide and to the record.