Dfa.Instant (dfa v0.2.1)
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 Functions
Link to this function
flushall()
Specs
flushall() :: :ok
Flush all data.
Link to this function
initialize!(key_name, db_index, initial_state)
Initializes state of automaton.
Link to this function
on!(key_name, db_index, event, current_state, next_state)
Defines how automaton changes the state.
Link to this function
rm!(key_name, db_index, event)
Removes a pattern of state change.
Link to this function
state!(key_name, db_index)
Return current state.
Link to this function
trigger!(key_name, db_index, event)
Triggers state change.