Bargad v1.0.1 Bargad.Utils View Source
Utility functions required by Bargad.Merkle, Bargad.Log, Bargad.Map.
Link to this section Summary
Functions
Decodes a binary into a tree_node/0 using exprotobuf
Decodes a binary into a tree/0 using exprotobuf
Encodes tree_node/0 into a binary using exprotobuf
Encodes tree/0 into a binary using exprotobuf
Generates a unique TreeId for every tree
Utility function to retrieve the backend module from backend
Utility function for retrieving a tree node
Hashes the binary data supplied based on the hash algorithm hash_algorithm/0 specified in t:tree
Creates an inner node in the tree of type tree_node/0
Creates a new node in the tree of type tree_node/0
Creates a new tree of type tree/0
Utility function for persisting a tree node
Helper function to convert a Tuple List into a map
Link to this section Types
Link to this section Functions
Decodes a binary into a tree_node/0 using exprotobuf.
Decodes a binary into a tree/0 using exprotobuf.
Encodes tree_node/0 into a binary using exprotobuf.
Encodes tree/0 into a binary using exprotobuf.
Generates a unique TreeId for every tree.
This TreeId is used by Storage and Bargad.TreeStorage for persisting tree/0 and tree_node/0
Utility function to retrieve the backend module from backend.
Utility function for retrieving a tree node.
Calls Storage.get_node/2.
Hashes the binary data supplied based on the hash algorithm hash_algorithm/0 specified in t:tree.
Creates an inner node in the tree of type tree_node/0.
Creates a new node with its children as left and right.
Creates a new node in the tree of type tree_node/0.
make_tree(tree_type(), binary(), hash_algorithm(), backend()) :: tree()
Creates a new tree of type tree/0.
Called by Bargad.Merkle.new/4 when a new Bargad.Map or Bargad.Log has to be created.
Utility function for persisting a tree node.
Calls Storage.set_node/3.
Helper function to convert a Tuple List into a map.
This is required as Bargad.Trees stores a map as a List of Tuple.