Dfa.Instant (dfa v0.1.12)
Documentation for Dfa
.
Dfa.Instant module helps you define your original deterministic finite automaton by building it on redis by a given name.
Usage
Dfa.Instant.initialize!(key_name, db_index, state1)
Dfa.Instant.on!(key_name, db_index, trigger1, state1, state2)
Dfa.Instant.on!(key_name, db_index, trigger1, state2, state3)
Dfa.Instant.on!(key_name, db_index, trigger1, state3, state1)
Dfa.Instant.on!(key_name, db_index, trigger2, state1, state3)
assert Dfa.Instant.state!(key_name, db_index) == state1
assert {:ok, state3} = Dfa.Instant.trigger!(key_name, db_index, trigger1)
assert Dfa.Instant.state!(key_name, db_index) == state2
Link to this section Summary
Functions
Flush all data.
Initializes state of automaton.
Defines how automaton changes the state.
Removes a pattern of state change.
Return current state.
Triggers state change.
Link to this section Types
Link to this type
option()
Specs
Link to this section Functions
Link to this function
flushall(opts \\ [])
Specs
flushall([option()]) :: :ok
Flush all data.
Link to this function
initialize!(key_name, db_index, initial_state, opts \\ [])
Initializes state of automaton.
Link to this function
on!(key_name, db_index, event, current_state, next_state, opts \\ [])
Defines how automaton changes the state.
Link to this function
rm!(key_name, db_index, event, opts \\ [])
Removes a pattern of state change.
Link to this function
state!(key_name, db_index, opts \\ [])
Return current state.
Link to this function
trigger!(key_name, db_index, event, opts \\ [])
Triggers state change.