model.bend checks
raw source on the hub · import bend-kit-commands@0.5.1.0/model.bend as Model
1 import
import Base
Types
type Outcome source · line 3 · raw
@-R:Type -> Type
Accepted@-R:Type -> @result:R -> Outcome<R>
Refused@-R:Type -> @result:R -> Outcome<R>
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.
Record@-P:Type -> @-R:Type -> @payload:P -> @outcome:Outcome<R> -> @at:U32 -> Record<P, R>
type Reply source · line 11 · raw
@-R:Type -> Type
Fresh@-R:Type -> @outcome:Outcome<R> -> Reply<R>
Replayed@-R:Type -> @outcome:Outcome<R> -> Reply<R>
Conflict@-R:Type -> Reply<R>
type Decision source · line 17 · raw
@-S:Type -> @-R:Type -> @-E:Type -> Type
The domain's answer to a new command.
Accept@-S:Type -> @-R:Type -> @-E:Type -> @state:S -> @result:R -> @effects:List<&1, E> -> Decision<S, R, E>
Refuse@-S:Type -> @-R:Type -> @-E:Type -> @result:R -> Decision<S, R, E>
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.
Write@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @state:S -> @record:Record<P, R> -> @reply:Reply<R> -> @effects:List<&1, E> -> Step<S, P, R, E>
Note@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @record:Record<P, R> -> @reply:Reply<R> -> Step<S, P, R, E>
Keep@-S:Type -> @-P:Type -> @-R:Type -> @-E:Type -> @reply:Reply<R> -> Step<S, P, R, E>
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.