152152 child_list_version := child_list_version ()}.
153153% % Stats attached to each node in the tree structure.
154154
155- -type payload () :: ? NO_PAYLOAD | ? DATA_PAYLOAD ( data ()) .
155+ -type payload () :: none | # kpayload_data {} .
156156% % All types of payload stored in the nodes of the tree structure.
157157% %
158158% % Beside the absence of payload, the only type of payload supported is data.
@@ -281,16 +281,16 @@ put(StoreId, PathPattern, Payload) ->
281281% %
282282% % The payload must be one of the following form:
283283% % <ul>
284- % % <li>`?NO_PAYLOAD', meaning there will be no payload attached to the
284+ % % <li>`none', meaning there will be no payload attached to the node</li>
285+ % % <li>`#kpayload_data{data = Term}' to store any type of term in the
285286% % node</li>
286- % % <li>`?DATA_PAYLOAD(Term)' to store any type of term in the node</li>
287287% % </ul>
288288% %
289289% % Example:
290290% % ```
291291% % %% Insert a node at `/foo/bar', overwriting the previous value.
292292% % Result = khepri_machine:put(
293- % % ra_cluster_name, [foo, bar], ?DATA_PAYLOAD( new_value) ),
293+ % % ra_cluster_name, [foo, bar], #kpayload_data{data = new_value} ),
294294% %
295295% % %% Here is the content of `Result'.
296296% % {ok, #{[foo, bar] => #{data => old_value,
@@ -307,7 +307,7 @@ put(StoreId, PathPattern, Payload) ->
307307% %
308308% % @returns an "ok" tuple with a map with one entry, or an "error" tuple.
309309
310- put (StoreId , PathPattern , Payload , Extra ) when ? IS_PAYLOAD (Payload ) ->
310+ put (StoreId , PathPattern , Payload , Extra ) when ? IS_KHEPRI_PAYLOAD (Payload ) ->
311311 khepri_path :ensure_is_valid (PathPattern ),
312312 Command = # put {path = PathPattern ,
313313 payload = Payload ,
@@ -728,11 +728,13 @@ set_node_payload(#node{stat = #{payload_version := DVersion} = Stat} = Node,
728728-spec remove_node_payload (tree_node ()) -> tree_node ().
729729% % @private
730730
731- remove_node_payload (# node {payload = ? NO_PAYLOAD } = Node ) ->
731+ remove_node_payload (
732+ # node {payload = none } = Node ) ->
732733 Node ;
733- remove_node_payload (# node {stat = #{payload_version := DVersion } = Stat } = Node ) ->
734+ remove_node_payload (
735+ # node {stat = #{payload_version := DVersion } = Stat } = Node ) ->
734736 Stat1 = Stat #{payload_version => DVersion + 1 },
735- Node # node {stat = Stat1 , payload = ? NO_PAYLOAD }.
737+ Node # node {stat = Stat1 , payload = none }.
736738
737739-spec add_node_child (tree_node (), khepri_path :component (), tree_node ()) ->
738740 tree_node ().
@@ -790,8 +792,8 @@ gather_node_props(#node{stat = #{payload_version := DVersion,
790792 Result0
791793 end ,
792794 case Payload of
793- ? DATA_PAYLOAD ( Data ) -> Result1 #{data => Data };
794- _ -> Result1
795+ # kpayload_data { data = Data } -> Result1 #{data => Data };
796+ _ -> Result1
795797 end .
796798
797799-spec to_absolute_keep_while (BasePath , KeepWhile ) -> KeepWhile when
0 commit comments