SafeRPC.Protocol (safe_rpc v0.1.17)

Copy Markdown View Source

Term protocol encoding for SafeRPC.

Summary

Types

request_id()

@type request_id() :: non_neg_integer()

Functions

decode_reply(binary)

@spec decode_reply(binary()) :: {:ok, map()} | {:error, term()}

decode_reply(binary, id)

@spec decode_reply(binary(), request_id()) :: {:ok, term()} | {:error, term()}

decode_request(binary)

@spec decode_request(binary()) :: {:ok, map()} | {:error, term()}

default_max_frame_size()

@spec default_max_frame_size() :: pos_integer()

The default maximum encoded frame size in bytes.

encode_call(id, cap, op, payload, meta \\ %{})

@spec encode_call(request_id(), term(), term(), term(), map()) :: binary()

encode_cancel(id)

@spec encode_cancel(request_id()) :: binary()

encode_cast(id, cap, op, payload, meta \\ %{})

@spec encode_cast(request_id(), term(), term(), term(), map()) :: binary()

encode_reply(id, result)

@spec encode_reply(request_id(), term()) :: binary()

validate_frame_size(binary, max_size \\ 16_777_216)

@spec validate_frame_size(binary(), pos_integer()) :: :ok | {:error, term()}

Rejects an encoded frame larger than the configured limit.