Module khepri_payload

Khepri payloads.

Description

Khepri payloads.

Payloads are the structure used to attach something to a tree node in the store. Khepri supports the following payloads: Usually, there is no need to explicitly use this module as the type of payload will be autodetected, thanks to the wrap/1 function already called internally.

Data Types

data()

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() = '$__NO_PAYLOAD__'

Internal value used to mark that a tree node has no payload attached.

payload()

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()

sproc() = #p_sproc{sproc = khepri_fun:standalone_fun()}

Internal structure to wrap an anonymous function before it can be stored in a tree node and later executed.

Function Index

none/0Returns the internal value used to mark that a tree node has no payload attached.
data/1Returns the same term wrapped into an internal structure ready to be stored in the tree.
sproc/1Returns the same function wrapped into an internal structure ready to be stored in the tree.
wrap/1Automatically detects the payload type and ensures it is wrapped in one of the internal types.

Function Details

none/0

none() -> no_payload()

Returns the internal value used to mark that a tree node has no payload attached.

See also: no_payload().

data/1

data(Term) -> Payload

Returns the same term wrapped into an internal structure ready to be stored in the tree.

See also: data().

sproc/1

sproc(Fun) -> Payload

Returns the same function wrapped into an internal structure ready to be stored in the tree.

See also: sproc().

wrap/1

wrap(Payload) -> WrappedPayload

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