partisan_util (partisan v6.0.0)

View Source

Summary

Functions

Returns the erlang:term_to_iovec/2 options implied by a channel's compression option.

If pid_encoding or ref_encoding configuration options are enabled, this function will ignore Opts and return an iolist(). Otherwise, the function calls erlang:term_to_iovec(Term, Opts).'

Given a POSIX error reason see inet and file, returns a descriptive binary string of the error in English and adding Reason at the end of the description inside parenthesis.

Functions

apply(Mod, Fun, Args, Default)

-spec apply(Mod :: module(), Fun :: atom(), Args :: list(), Default :: any()) -> any() | no_return().

channel_encode_opts(ChannelOpts)

-spec channel_encode_opts(ChannelOpts :: partisan:channel_opts()) -> list().

Returns the erlang:term_to_iovec/2 options implied by a channel's compression option.

This is the single source of truth for the derivation. It is used both by partisan_peer_service_client when it caches the options for a connection, and by the dispatch path when it encodes a message in the *calling* process before handing it to that connection. Those two must agree: if the caller encodes with different options than the connection would have, the bytes on the wire change depending on which path a message took.

encode(Term)

encode(Term, Opts)

-spec encode(Term :: term(), Opts :: list()) -> erlang:ext_iovec() | iolist().

If pid_encoding or ref_encoding configuration options are enabled, this function will ignore Opts and return an iolist(). Otherwise, the function calls erlang:term_to_iovec(Term, Opts).'

encode_(T)

format_posix_error(Reason)

-spec format_posix_error(Reason :: inet:posix() | system_limit) ->
                            Message :: binary() | (Reason :: inet:posix() | system_limit).

Given a POSIX error reason see inet and file, returns a descriptive binary string of the error in English and adding Reason at the end of the description inside parenthesis.

get(Key, Arg)

-spec get(Key :: term(), Arg :: list() | map()) -> Value :: any() | no_return().

get(Key, Arg, Default)

-spec get(Key :: term(), Arg :: list() | map(), Default :: any()) -> Value :: any().

maps_append(Key, Value, Map)

maybe_connect_disterl(Node)

-spec maybe_connect_disterl(Node :: node()) -> ok.

maybe_pad_term(Term)

-spec maybe_pad_term(Term :: term()) -> term() | {'$partisan_padded', Padding :: term(), Term :: term()}.

parse_listen_address(Term)

-spec parse_listen_address(Term :: map() | list() | binary() | tuple()) ->
                              partisan:listen_addr() | no_return().

safe_apply(Mod, Fun, Args, Default)

-spec safe_apply(Mod :: module(), Fun :: atom(), Args :: list(), Default :: any()) -> any().