Module leo_rpc

leo_rpc is an original RPC library whose interface is similar to Erlang's buildin RPC.

References

Description

leo_rpc is an original RPC library whose interface is similar to Erlang's buildin RPC.

Function Index

async_call/4Implements call streams with promises, a type of RPC which does not suspend the caller until the result is finished.
call/4Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.
call/5Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.
call/6Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.
cast/4No response is delivered and the calling process is not suspended until the evaluation is complete, as is the case with call/4,5.
multicall/4A multicall is an RPC which is sent concurrently from one client to multiple servers.
multicall/5A multicall is an RPC which is sent concurrently from one client to multiple servers.
nb_yield/1This is able to call non-blocking.
nb_yield/2This is able to call non-blocking.
node/0Returns the name of the local node.
nodes/0Returns a list of all connected nodes in the system, excluding the local node.
ping/1Tries to set up a connection to Node.
port/0Returns the port number of the local node.
start/0Launch leo-rpc.
status/0Retrieve status of active connections.

Function Details

async_call/4

async_call(Node, Mod, Method, Args) -> pid()

Implements call streams with promises, a type of RPC which does not suspend the caller until the result is finished. Instead, a key is returned which can be used at a later stage to collect the value. The key can be viewed as a promise to deliver the answer.

call/4

call(Node, Mod, Method, Args) -> Ret | {badrpc, any()}

Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.

call/5

call(Node, Mod, Method, Args, Timeout) -> Ret | {badrpc, any()}

Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.

call/6

call(From, Node, Mod, Method, Args, Timeout) -> Ret | {badrpc, any()}

Evaluates apply(Module, Function, Args) on the node Node and returns the corresponding value Res, or {badrpc, Reason} if the call fails.

cast/4

cast(Node, Mod, Method, Args) -> true

No response is delivered and the calling process is not suspended until the evaluation is complete, as is the case with call/4,5.

multicall/4

multicall(Nodes, Mod, Method, Args) -> Ret | {badrpc, any()}

A multicall is an RPC which is sent concurrently from one client to multiple servers. This is useful for collecting some information from a set of nodes.

multicall/5

multicall(Nodes, Mod, Method, Args, Timeout) -> Ret | {badrpc, any()}

A multicall is an RPC which is sent concurrently from one client to multiple servers. This is useful for collecting some information from a set of nodes.

nb_yield/1

nb_yield(Key) -> {value, any()} | timeout

This is able to call non-blocking. It returns the tuple {value, Val} when the computation has finished, or timeout when Timeout milliseconds has elapsed.

nb_yield/2

nb_yield(Key, Timeout) -> {value, any()} | timeout

This is able to call non-blocking. It returns the tuple {value, Val} when the computation has finished, or timeout when Timeout milliseconds has elapsed.

node/0

node() -> Node

Returns the name of the local node. The default name is nonode@nohost.

nodes/0

nodes() -> Nodes

Returns a list of all connected nodes in the system, excluding the local node.

ping/1

ping(Node) -> pong | pang

Tries to set up a connection to Node. Returns pang if it fails, or pong if it is successful.

port/0

port() -> pos_integer()

Returns the port number of the local node.

start/0

start() -> ok | {error, any()}

Launch leo-rpc

status/0

status() -> {ok, [#rpc_info{}]} | {error, any()}

Retrieve status of active connections.


Generated by EDoc