View Source cets_call (cets v0.3.0)

Helper module for extended gen_server API.

Summary

Types

Message type.

Return result.

Operations are messages which could be buffered when a server is paused. Operations are also broadcasted to the whole cluster.

Asynchronous request reference.

Server name or pid.

Functions

Contacts the local server to broadcast multinode operation.

Makes gen_server:call with better error reporting.

Makes gen_server:call with better error reporting.

Sends all requests to a single node in the cluster.

Contacts the local server to broadcast multinode operation.

Waits for multiple responses at once.

Types

-type long_msg() :: cets:long_msg().

Message type.

-type ok_or_error() :: ok | {error, Reason :: term()}.

Return result.

-type op() :: cets:op().

Operations are messages which could be buffered when a server is paused. Operations are also broadcasted to the whole cluster.

-type request_id() :: cets:request_id().

Asynchronous request reference.

-type server_ref() :: cets:server_ref().

Server name or pid.

Functions

Link to this function

async_operation(Server, Op)

View Source
-spec async_operation(server_ref(), op()) -> request_id().

Contacts the local server to broadcast multinode operation.

Returns immediately. You can wait for response from all nodes by calling wait_response/2.

-spec long_call(server_ref(), long_msg()) -> term().

Makes gen_server:call with better error reporting.

It would log a warning if the call takes too long.

Link to this function

long_call(Server, Msg, Info)

View Source
-spec long_call(server_ref(), long_msg(), map()) -> term().

Makes gen_server:call with better error reporting.

Link to this function

send_leader_op(Server, Op)

View Source
-spec send_leader_op(server_ref(), op()) -> ok_or_error().

Sends all requests to a single node in the cluster.

Link to this function

sync_operation(Server, Op)

View Source
-spec sync_operation(server_ref(), op()) -> ok.

Contacts the local server to broadcast multinode operation.

Blocks until the operation is applied on all nodes.

Link to this function

wait_responses(ReqIds, Timeout)

View Source

Waits for multiple responses at once.