khepri_machine (khepri v0.6.0)
Khepri private low-level API.
This module exposes the private "low-level" API to the Khepri database and state machine. Main functions correspond to Ra commands implemented by the state machine. All functions in khepri
are built on top of this module.
Link to this section Summary
Types
Per-node
keep_while
conditions.Internal reverse index of the keep_while conditions. If node A depends on a condition on node B, then this reverse index will have a "node B => node A" entry.
Configuration record, holding read-only or rarely changing fields.
Internal mapping between
khepri_projection:projection()
records and the native path patterns which trigger updates to each projection.Properties attached to each node in the tree structure.
State of this Ra state machine.
A node in the tree structure.
Functions
Deletes all tree nodes matching the path pattern.
Returns all tree nodes matching the given path pattern.
Registers a projection.
Registers a trigger.
Runs a transaction and returns the result.
Link to this section Types
Link to this type
async_ret/0
-type async_ret() :: ok.
Link to this type
common_ret/0
-type common_ret() :: khepri:ok(khepri_adv:node_props_map()) | khepri:error().
Link to this type
keep_while_conds_map/0
-type keep_while_conds_map() :: #{khepri_path:native_path() => khepri_condition:native_keep_while()}.
keep_while
conditions.
Link to this type
keep_while_conds_revidx/0
-type keep_while_conds_revidx() :: #{khepri_path:native_path() => #{khepri_path:native_path() => ok}}.
Link to this type
machine_config/0
-type machine_config() :: #config{}.
Link to this type
projections_map/0
-type projections_map() :: #{khepri_projection:projection() => khepri_path:native_pattern()}.
khepri_projection:projection()
records and the native path patterns which trigger updates to each projection.
Link to this type
props/0
-type props() :: #{payload_version := khepri:payload_version(), child_list_version := khepri:child_list_version()}.
Link to this type
state/0
-type state() :: #khepri_machine{}.
Link to this type
tree_node/0
-type tree_node() :: #node{}.
Link to this type
triggered/0
-type triggered() :: #triggered{}.
Link to this type
tx_ret/0
-type tx_ret() :: khepri:ok(khepri_tx:tx_fun_result()) | khepri_tx:tx_abort() | no_return().
Link to this section Functions
Link to this function
delete(StoreId, PathPattern, Options)
-spec delete(StoreId, PathPattern, Options) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), Ret :: khepri_machine:common_ret() | khepri_machine:async_ret().
Link to this function
fold(StoreId, PathPattern, Fun, Acc, Options)
-spec fold(StoreId, PathPattern, Fun, Acc, Options) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Fun :: khepri:fold_fun(), Acc :: khepri:fold_acc(), Options :: khepri:query_options() | khepri:tree_options(), Ret :: khepri:ok(NewAcc) | khepri:error(), NewAcc :: Acc.
Link to this function
handle_tx_exception(_)
Link to this function
register_projection(StoreId, PathPattern, Projection, Options)
-spec register_projection(StoreId, PathPattern, Projection, Options) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Projection :: khepri_projection:projection(), Options :: khepri:command_options(), Ret :: ok | khepri:error().
Link to this function
register_trigger(StoreId, TriggerId, EventFilter, StoredProcPath, Options)
-spec register_trigger(StoreId, TriggerId, EventFilter, StoredProcPath, Options) -> Ret when StoreId :: khepri:store_id(), TriggerId :: khepri:trigger_id(), EventFilter :: khepri_evf:event_filter() | khepri_path:pattern(), StoredProcPath :: khepri_path:path(), Options :: khepri:command_options(), Ret :: ok | khepri:error().
Link to this function
transaction(StoreId, FunOrPath, Args, ReadWrite, Options)
-spec transaction(StoreId, FunOrPath, Args, ReadWrite, Options) -> Ret when StoreId :: khepri:store_id(), FunOrPath :: Fun | PathPattern, Fun :: khepri_tx:tx_fun(), PathPattern :: khepri_path:pattern(), Args :: list(), ReadWrite :: ro | rw | auto, Options :: khepri:command_options() | khepri:query_options(), Ret :: khepri_machine:tx_ret() | khepri_machine:async_ret().