Khepri payloads.
Payloads are the structure used to attach something to a tree node in the store. Khepri supports the following payloads:no_payload()
data()
)sproc()
)wrap/1
function already
called internally.
data() = #p_data{data = khepri:data()}
Internal structure to wrap any Erlang term before it can be stored in a tree node.
The only constraint is the conversion to an Erlang binary must be supported by this term.no_payload() = '$__NO_PAYLOAD__'
Internal value used to mark that a tree node has no payload attached.
payload() = no_payload() | data() | sproc()
All types of payload stored in the nodes of the tree structure.
Beside the absence of payload, the only type of payload supported is data.sproc() = #p_sproc{sproc = horus:horus_fun(), is_valid_as_tx_fun = ro | rw | false}
Internal structure to wrap an anonymous function before it can be stored in a tree node and later executed.
none/0 | Returns the internal value used to mark that a tree node has no payload attached. |
data/1 | Returns the same term wrapped into an internal structure ready to be stored in the tree. |
sproc/1 | Returns the same function wrapped into an internal structure ready to be stored in the tree. |
wrap/1 | Automatically detects the payload type and ensures it is wrapped in one of the internal types. |
none() -> no_payload()
Returns the internal value used to mark that a tree node has no payload attached.
See also: no_payload().
data(Term) -> Payload
Term = khepri:data()
Payload = data()
Returns the same term wrapped into an internal structure ready to be stored in the tree.
See also: data().
sproc(Fun) -> Payload
Fun = horus:horus_fun() | function()
Payload = sproc()
Returns the same function wrapped into an internal structure ready to be stored in the tree.
See also: sproc().
wrap(Payload) -> WrappedPayload
Payload = payload() | khepri:data() | function()
WrappedPayload = payload()
Payload
: an already wrapped payload, or any term which needs to be
wrapped.
returns: the wrapped payload.
Automatically detects the payload type and ensures it is wrapped in one of the internal types.
The internal types make sure we avoid any collision between any user-provided terms and internal structures.Generated by EDoc