Search documentation of macula

# macula_routing_protocol (macula v0.44.2)

View Source

DHT protocol message encoding/decoding. Maps DHT operations to/from message format.

# Summary

## Types

message/0

## Functions

decode_find_node(_)

Decode FIND_NODE request.

decode_find_node_reply(_)

Decode FIND_NODE reply.

decode_find_value(_)

Decode FIND_VALUE request.

decode_find_value_reply(_)

Decode FIND_VALUE reply.

decode_node_info(_)

Decode node info.

decode_store(_)

Decode STORE request.

encode_find_node(Target)

Encode FIND_NODE request.

encode_find_node_reply(Nodes)

Encode FIND_NODE reply.

encode_find_value(Key)

Encode FIND_VALUE request.

encode_find_value_reply(_)

Encode FIND_VALUE reply.

encode_node_info(NodeInfo)

Encode node info (for transmission).

encode_store(Key, Value)

Encode STORE request.

is_find_node(_)

Check if message is FIND_NODE.

is_find_value(_)

Check if message is FIND_VALUE.

is_store(_)

Check if message is STORE.

# Types

# message/0

    -type message() :: map().

# Functions

# decode_find_node(_)

    -spec decode_find_node(message()) -> {ok, binary()} | {error, invalid_message}.

Decode FIND_NODE request.

# decode_find_node_reply(_)

    -spec decode_find_node_reply(message()) ->
                                    {ok, [macula_routing_bucket:node_info()]} | {error, invalid_message}.

Decode FIND_NODE reply.

# decode_find_value(_)

    -spec decode_find_value(message()) -> {ok, binary()} | {error, invalid_message}.

Decode FIND_VALUE request.

# decode_find_value_reply(_)

    -spec decode_find_value_reply(message()) ->
                                     {ok, {value, term()} | {nodes, [macula_routing_bucket:node_info()]}} |
                                     {error, invalid_message}.

Decode FIND_VALUE reply.

# decode_node_info(_)

    -spec decode_node_info(map()) -> {ok, macula_routing_bucket:node_info()} | {error, invalid_node_info}.

Decode node info.

# decode_store(_)

    -spec decode_store(message()) -> {ok, binary(), term()} | {error, invalid_message}.

Decode STORE request.

# encode_find_node(Target)

    -spec encode_find_node(binary()) -> message().

Encode FIND_NODE request.

# encode_find_node_reply(Nodes)

    -spec encode_find_node_reply([macula_routing_bucket:node_info()]) -> message().

Encode FIND_NODE reply.

# encode_find_value(Key)

    -spec encode_find_value(binary()) -> message().

Encode FIND_VALUE request.

# encode_find_value_reply(_)

    -spec encode_find_value_reply({value, term()} | {nodes, [macula_routing_bucket:node_info()]}) ->
                                     message().

Encode FIND_VALUE reply.

# encode_node_info(NodeInfo)

    -spec encode_node_info(macula_routing_bucket:node_info()) -> map().

Encode node info (for transmission).

# encode_store(Key, Value)

    -spec encode_store(binary(), term()) -> message().

Encode STORE request.

# is_find_node(_)

    -spec is_find_node(message()) -> boolean().

Check if message is FIND_NODE.

# is_find_value(_)

    -spec is_find_value(message()) -> boolean().

Check if message is FIND_VALUE.

# is_store(_)

    -spec is_store(message()) -> boolean().

Check if message is STORE.