diff --git a/src/khepri.erl b/src/khepri.erl index 1e76b9e5..bac226bf 100644 --- a/src/khepri.erl +++ b/src/khepri.erl @@ -240,6 +240,10 @@ %% exposed by {@link khepri_adv}. The list of returned properties can be %% configured using the `props_to_return' option (see {@link tree_options()}). +-type node_props_map() :: #{khepri_path:native_path() => khepri:node_props()}. +%% Structure used to return a map of nodes and their associated properties, +%% payload and child nodes. + -type trigger_id() :: atom(). %% An ID to identify a registered trigger. @@ -462,7 +466,7 @@ %% %% `undefined' is returned if a tree node has no payload attached to it. --type async_ret() :: khepri_adv:many_results() | +-type async_ret() :: khepri_machine:write_ret() | khepri_tx:tx_fun_result() | khepri:error({not_leader, ra:server_id()}). %% The value returned from of a command function which was executed @@ -478,7 +482,7 @@ %% commands could not be applied since they were sent to a non-leader member. %% %% Note that when commands are successfully applied, the return values are -%% {@link khepri_adv:many_results()} rather than {@link khepri:minimal_ret()}, +%% {@link khepri_machine:write_ret()} rather than {@link khepri:minimal_ret()}, %% even if the command was sent using a function from the {@link khepri} API %% such as {@link khepri:put/4}. %% @@ -494,6 +498,7 @@ child_list_length/0, delete_reason/0, node_props/0, + node_props_map/0, trigger_id/0, async_option/0, diff --git a/src/khepri_adv.erl b/src/khepri_adv.erl index 969071df..37e961ff 100644 --- a/src/khepri_adv.erl +++ b/src/khepri_adv.erl @@ -48,23 +48,13 @@ unregister_projections/1, unregister_projections/2, unregister_projections/3]). --type node_props_map() :: #{khepri_path:native_path() => khepri:node_props()}. -%% Structure used to return a map of nodes and their associated properties, -%% payload and child nodes. - --type many_results() :: khepri_machine:common_ret(). -%% Return value of a query or synchronous command targeting many tree nodes. - --export_type([node_props_map/0, - many_results/0]). - %% ------------------------------------------------------------------- %% get(). %% ------------------------------------------------------------------- -spec get(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns the properties and payload of the tree node pointed to by the %% given path pattern. %% @@ -83,11 +73,11 @@ get(PathPattern) -> (StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(); + Ret :: khepri_machine:write_ret(); (PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:query_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns the properties and payload of the tree node pointed to by the %% given path pattern. %% @@ -112,7 +102,7 @@ get(PathPattern, Options) when is_map(Options) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:query_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns the properties and payload of the tree node pointed to by the %% given path pattern. %% @@ -170,7 +160,7 @@ get(StoreId, PathPattern, Options) -> -spec get_many(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns properties and payloads of all the tree nodes matching the %% given path pattern. %% @@ -189,11 +179,11 @@ get_many(PathPattern) -> (StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(); + Ret :: khepri_machine:write_ret(); (PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:query_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns properties and payloads of all the tree nodes matching the %% given path pattern. %% @@ -218,7 +208,7 @@ get_many(PathPattern, Options) when is_map(Options) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:query_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns properties and payloads of all the tree nodes matching the %% given path pattern. %% @@ -267,7 +257,7 @@ get_many(StoreId, PathPattern, Options) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Ret :: khepri:minimal_ret() | - khepri_adv:many_results(). + khepri_machine:write_ret(). %% @doc Sets the payload of the tree node pointed to by the given path %% pattern. %% @@ -287,7 +277,7 @@ put(PathPattern, Data) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Ret :: khepri:minimal_ret() | - khepri_adv:many_results(). + khepri_machine:write_ret(). %% @doc Sets the payload of the tree node pointed to by the given path %% pattern. %% @@ -307,7 +297,7 @@ put(StoreId, PathPattern, Data) -> khepri:tree_options() | khepri:put_options(), Ret :: khepri:minimal_ret() | - khepri_adv:many_results() | + khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Sets the payload of the tree node pointed to by the given path %% pattern. @@ -406,7 +396,7 @@ put(StoreId, PathPattern, Data, Options) -> -spec put_many(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of all the tree nodes matching the given path pattern. %% %% Calling this function is the same as calling `put_many(StoreId, PathPattern, @@ -424,7 +414,7 @@ put_many(PathPattern, Data) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of all the tree nodes matching the given path pattern. %% %% Calling this function is the same as calling `put_many(StoreId, PathPattern, @@ -442,7 +432,7 @@ put_many(StoreId, PathPattern, Data) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Sets the payload of all the tree nodes matching the given path pattern. %% %% The `PathPattern' can be provided as a native path pattern (a list of tree @@ -533,7 +523,7 @@ put_many(StoreId, PathPattern, Data, Options) -> -spec create(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Creates a tree node with the given payload. %% %% Calling this function is the same as calling `create(StoreId, PathPattern, @@ -551,7 +541,7 @@ create(PathPattern, Data) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Creates a tree node with the given payload. %% %% Calling this function is the same as calling `create(StoreId, PathPattern, @@ -569,7 +559,7 @@ create(StoreId, PathPattern, Data) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Creates a tree node with the given payload. %% %% The behavior is the same as {@link put/4} except that if the tree node @@ -608,7 +598,7 @@ create(StoreId, PathPattern, Data, Options) -> -spec update(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload. %% %% Calling this function is the same as calling `update(StoreId, PathPattern, @@ -626,7 +616,7 @@ update(PathPattern, Data) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload. %% %% Calling this function is the same as calling `update(StoreId, PathPattern, @@ -644,7 +634,7 @@ update(StoreId, PathPattern, Data) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Updates an existing tree node with the given payload. %% %% The behavior is the same as {@link put/4} except that if the tree node @@ -685,7 +675,7 @@ update(StoreId, PathPattern, Data, Options) -> PathPattern :: khepri_path:pattern(), DataPattern :: ets:match_pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload only if its data %% matches the given pattern. %% @@ -705,7 +695,7 @@ compare_and_swap(PathPattern, DataPattern, Data) -> PathPattern :: khepri_path:pattern(), DataPattern :: ets:match_pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload only if its data %% matches the given pattern. %% @@ -726,7 +716,7 @@ compare_and_swap(StoreId, PathPattern, DataPattern, Data) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Updates an existing tree node with the given payload only if its data %% matches the given pattern. %% @@ -770,7 +760,7 @@ compare_and_swap(StoreId, PathPattern, DataPattern, Data, Options) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Prepares the payload and calls {@link khepri_machine:put/4}. %% %% @private @@ -785,7 +775,7 @@ do_put(StoreId, PathPattern, Payload, Options) -> -spec delete(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the tree node pointed to by the given path pattern. %% %% Calling this function is the same as calling `delete(StoreId, PathPattern)' @@ -803,11 +793,11 @@ delete(PathPattern) -> (StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(); + Ret :: khepri_machine:write_ret(); (PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the tree node pointed to by the given path pattern. %% %% This function accepts the following two forms: @@ -831,7 +821,7 @@ delete(PathPattern, Options) when is_map(Options) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Deletes the tree node pointed to by the given path pattern. %% %% The `PathPattern' can be provided as a native path pattern (a list of tree @@ -889,7 +879,7 @@ delete(StoreId, PathPattern, Options) -> -spec delete_many(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes all tree nodes matching the given path pattern. %% %% Calling this function is the same as calling `delete_many(StoreId, @@ -907,11 +897,11 @@ delete_many(PathPattern) -> (StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(); + Ret :: khepri_machine:write_ret(); (PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes all tree nodes matching the given path pattern. %% @@ -936,7 +926,7 @@ delete_many(PathPattern, Options) when is_map(Options) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Deletes all tree nodes matching the given path pattern. %% %% The `PathPattern' can be provided as a native path pattern (a list of tree @@ -988,7 +978,7 @@ delete_many(StoreId, PathPattern, Options) -> -spec clear_payload(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of the tree node pointed to by the given path %% pattern. %% @@ -1006,7 +996,7 @@ clear_payload(PathPattern) -> -spec clear_payload(StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of the tree node pointed to by the given path %% pattern. %% @@ -1024,7 +1014,7 @@ clear_payload(StoreId, PathPattern) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Deletes the payload of the tree node pointed to by the given path %% pattern. %% @@ -1057,7 +1047,7 @@ clear_payload(StoreId, PathPattern, Options) -> -spec clear_many_payloads(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of all tree nodes matching the given path pattern. %% %% Calling this function is the same as calling `clear_many_payloads(StoreId, @@ -1074,7 +1064,7 @@ clear_many_payloads(PathPattern) -> -spec clear_many_payloads(StoreId, PathPattern) -> Ret when StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of all tree nodes matching the given path pattern. %% %% Calling this function is the same as calling `clear_many_payloads(StoreId, @@ -1092,7 +1082,7 @@ clear_many_payloads(StoreId, PathPattern) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Deletes the payload of all tree nodes matching the given path pattern. %% %% In other words, the payload is set to {@link khepri_payload:no_payload()}. diff --git a/src/khepri_machine.erl b/src/khepri_machine.erl index 7b196535..c4ff62bc 100644 --- a/src/khepri_machine.erl +++ b/src/khepri_machine.erl @@ -206,8 +206,8 @@ -type query_fun() :: fun((state()) -> any()). %% Function representing a query and used {@link process_query/3}. --type common_ret() :: khepri:ok(khepri_adv:node_props_map()) | - khepri:error(). +-type write_ret() :: khepri:ok(khepri:node_props_map()) | + khepri:error(). -type tx_ret() :: khepri:ok(khepri_tx:tx_fun_result()) | khepri_tx:tx_abort() | @@ -223,7 +223,7 @@ %% A mapping between the names of projections and patterns to which each %% projection is registered. --export_type([common_ret/0, +-export_type([write_ret/0, tx_ret/0, async_ret/0, @@ -327,7 +327,7 @@ fence(StoreId, Timeout) -> Options :: khepri:command_options() | khepri:tree_options() | khepri:put_options(), - Ret :: khepri_machine:common_ret() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Creates or modifies a specific tree node in the tree structure. %% %% @param StoreId the name of the Ra cluster. @@ -361,7 +361,7 @@ put(_StoreId, PathPattern, Payload, _Options) -> StoreId :: khepri:store_id(), PathPattern :: khepri_path:pattern(), Options :: khepri:command_options() | khepri:tree_options(), - Ret :: khepri_machine:common_ret() | khepri_machine:async_ret(). + Ret :: khepri_machine:write_ret() | khepri_machine:async_ret(). %% @doc Deletes all tree nodes matching the path pattern. %% %% @param StoreId the name of the Ra cluster. @@ -1818,7 +1818,7 @@ failed_to_locate_sproc(Reason) -> TreeOptions :: khepri:tree_options(), SideEffects :: ra_machine:effects(), Ret :: {State, Result, ra_machine:effects()}, - Result :: khepri_machine:common_ret(). + Result :: khepri_machine:write_ret(). %% @private insert_or_update_node( @@ -1844,7 +1844,7 @@ insert_or_update_node( TreeOptions :: khepri:tree_options(), SideEffects :: ra_machine:effects(), Ret :: {State, Result, ra_machine:effects()}, - Result :: khepri_machine:common_ret(). + Result :: khepri_machine:write_ret(). %% @private delete_matching_nodes(State, PathPattern, TreeOptions, SideEffects) -> @@ -2539,8 +2539,8 @@ update_projection(Pattern, Projection, OldTree, NewTree) -> end. -spec diff_matching_nodes(OldNodeProps, NewNodeProps) -> Changes when - OldNodeProps :: khepri_adv:node_props_map(), - NewNodeProps :: khepri_adv:node_props_map(), + OldNodeProps :: khepri:node_props_map(), + NewNodeProps :: khepri:node_props_map(), OldProps :: khepri:node_props(), NewProps :: khepri:node_props(), Changes :: #{khepri_path:native_path() => {OldProps, NewProps}}. diff --git a/src/khepri_tree.erl b/src/khepri_tree.erl index 3371a542..6907233d 100644 --- a/src/khepri_tree.erl +++ b/src/khepri_tree.erl @@ -437,7 +437,7 @@ update_keep_while_conds_revidx_v1( Tree :: tree(), PathPattern :: khepri_path:native_pattern(), TreeOptions :: khepri:tree_options(), - Ret :: khepri_machine:common_ret(). + Ret :: khepri_machine:write_ret(). %% @private find_matching_nodes(Tree, PathPattern, TreeOptions) -> @@ -450,7 +450,7 @@ find_matching_nodes(Tree, PathPattern, TreeOptions) -> Ret when Path :: khepri_path:native_path(), NodeProps :: khepri:node_props(), - Map :: khepri_adv:node_props_map(), + Map :: khepri:node_props_map(), Ret :: Map. %% @private @@ -578,7 +578,7 @@ maybe_add_delete_reason_prop(NodeProps, _TreeOptions, _DeleteReason) -> Payload :: khepri_payload:payload(), PutOptions :: khepri:put_options(), TreeOptions :: khepri:tree_options(), - NodeProps :: khepri_adv:node_props_map(), + NodeProps :: khepri:node_props_map(), AppliedChanges :: applied_changes(), Ret :: ok(Tree, AppliedChanges, NodeProps) | khepri:error(). diff --git a/src/khepri_tx_adv.erl b/src/khepri_tx_adv.erl index 5ab4efa0..730257b2 100644 --- a/src/khepri_tx_adv.erl +++ b/src/khepri_tx_adv.erl @@ -64,7 +64,7 @@ -spec get(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns the payload of the tree node pointed to by the given path %% pattern. %% @@ -79,7 +79,7 @@ get(PathPattern) -> -spec get(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns the payload of the tree node pointed to by the given path %% pattern. %% @@ -98,7 +98,7 @@ get(PathPattern, Options) -> -spec get_many(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns payloads of all the tree nodes matching the given path %% pattern. %% @@ -113,7 +113,7 @@ get_many(PathPattern) -> -spec get_many(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Returns payloads of all the tree nodes matching the given path %% pattern. %% @@ -147,7 +147,7 @@ do_get_many(PathPattern, Fun, Acc, Options) -> -spec put(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of the tree node pointed to by the given path %% pattern. %% @@ -163,7 +163,7 @@ put(PathPattern, Data) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of the tree node pointed to by the given path %% pattern. %% @@ -183,7 +183,7 @@ put(PathPattern, Data, Options) -> -spec put_many(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of all the tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:put_many/3} but inside the context of @@ -198,7 +198,7 @@ put_many(PathPattern, Data) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Sets the payload of all the tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:put_many/4} but inside the context of @@ -229,7 +229,7 @@ put_many(PathPattern, Data, Options) -> -spec create(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Creates a tree node with the given payload. %% %% This is the same as {@link khepri_adv:create/3} but inside the context of a @@ -244,7 +244,7 @@ create(PathPattern, Data) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Creates a tree node with the given payload. %% %% This is the same as {@link khepri_adv:create/4} but inside the context of a @@ -266,7 +266,7 @@ create(PathPattern, Data, Options) -> -spec update(PathPattern, Data) -> Ret when PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload. %% %% This is the same as {@link khepri_adv:update/3} but inside the context of a @@ -281,7 +281,7 @@ update(PathPattern, Data) -> PathPattern :: khepri_path:pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload. %% %% This is the same as {@link khepri_adv:update/4} but inside the context of a @@ -304,7 +304,7 @@ update(PathPattern, Data, Options) -> PathPattern :: khepri_path:pattern(), DataPattern :: ets:match_pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload only if its data %% matches the given pattern. %% @@ -322,7 +322,7 @@ compare_and_swap(PathPattern, DataPattern, Data) -> DataPattern :: ets:match_pattern(), Data :: khepri_payload:payload() | khepri:data() | fun(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Updates an existing tree node with the given payload only if its data %% matches the given pattern. %% @@ -344,7 +344,7 @@ compare_and_swap(PathPattern, DataPattern, Data, Options) -> -spec delete(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the tree node pointed to by the given path pattern. %% %% This is the same as {@link khepri_adv:delete/2} but inside the context of a @@ -358,7 +358,7 @@ delete(PathPattern) -> -spec delete(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the tree node pointed to by the given path pattern. %% %% This is the same as {@link khepri_adv:delete/3} but inside the context of a @@ -376,7 +376,7 @@ delete(PathPattern, Options) -> -spec delete_many(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes all tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:delete_many/2} but inside the context @@ -390,7 +390,7 @@ delete_many(PathPattern) -> -spec delete_many(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes all tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:delete_many/3} but inside the context @@ -417,7 +417,7 @@ delete_many(PathPattern, Options) -> -spec clear_payload(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of the tree node pointed to by the given path %% pattern. %% @@ -432,7 +432,7 @@ clear_payload(PathPattern) -> -spec clear_payload(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of the tree node pointed to by the given path %% pattern. %% @@ -454,7 +454,7 @@ clear_payload(PathPattern, Options) -> -spec clear_many_payloads(PathPattern) -> Ret when PathPattern :: khepri_path:pattern(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of all tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:clear_many_payloads/2} but inside the @@ -468,7 +468,7 @@ clear_many_payloads(PathPattern) -> -spec clear_many_payloads(PathPattern, Options) -> Ret when PathPattern :: khepri_path:pattern(), Options :: khepri:tree_options() | khepri:put_options(), - Ret :: khepri_adv:many_results(). + Ret :: khepri_machine:write_ret(). %% @doc Deletes the payload of all tree nodes matching the given path pattern. %% %% This is the same as {@link khepri_adv:clear_many_payloads/3} but inside the diff --git a/src/khepri_utils.erl b/src/khepri_utils.erl index 511b2a7c..b5726b8a 100644 --- a/src/khepri_utils.erl +++ b/src/khepri_utils.erl @@ -100,14 +100,14 @@ node_props_to_payload(#{sproc := StandaloneFun}, _Default) -> StandaloneFun; node_props_to_payload(_NodeProps, Default) -> Default. -spec flat_struct_to_tree(NodePropsMap) -> DisplayTree when - NodePropsMap :: khepri_adv:node_props_map(), + NodePropsMap :: khepri:node_props_map(), DisplayTree :: display_tree(). flat_struct_to_tree(FlatStruct) -> flat_struct_to_tree(FlatStruct, fun(NodeProps) -> NodeProps end). -spec flat_struct_to_tree(NodePropsMap, MapFun) -> DisplayTree when - NodePropsMap :: khepri_adv:node_props_map(), + NodePropsMap :: khepri:node_props_map(), MapFun :: fun((khepri:node_props()) -> khepri:node_props()), DisplayTree :: display_tree().