Erpc

Processes

Call functions on another BEAM node (OTP erpc).

Prefer this over raw erlang "erpc" "call". Nodes must share a cookie and be connected (Node.connect, or started with the same --cookie / SELM_COOKIE).

Erpc.call0 other 5000 "erlang" "node"

Erpc.call2 other 5000 "lists" "seq" 1 10

call / cast take a homogeneous List a of arguments. Use call1 / call2 / call3 when argument types differ.

Types

Error

type Error
= Nodedown
| Timeout
| Exception String

Why a remote call failed.

Examples

Erpc.call node "mod" "fun" []  -- Result Error Value

Values

call

call : Node -> Int -> String -> String -> List a -> Result Error b

Call module.function(args) on node, waiting up to timeout ms.

Examples

Erpc.call other 5000 "lists" "seq" [1, 10]

call0

call0 : Node -> Int -> String -> String -> Result Error a

Call with no arguments.

Examples

Erpc.call0 other 5000 "erlang" "node"

call1

call1 : Node -> Int -> String -> String -> a -> Result Error b

Call with one argument.

Examples

Erpc.call1 other 5000 "erlang" "whereis" "selm_jobs"

call2

call2 : Node -> Int -> String -> String -> a -> b -> Result Error c

Call with two arguments.

Examples

Erpc.call2 other 5000 "lists" "seq" 1 10

call3

call3 : Node -> Int -> String -> String -> a -> b -> c -> Result Error d

Call with three arguments.

Examples

Erpc.call3 other 5000 "erlang" "setelement" 1 tuple 0

cast

cast : Node -> String -> String -> List a -> Result Error ()

Cast module.function(args) on node (no reply).

Examples

Erpc.cast other "erlang" "garbage_collect" []

cast0

cast0 : Node -> String -> String -> Result Error ()

Cast with no arguments.

Examples

Erpc.cast0 other "erlang" "garbage_collect"

cast1

cast1 : Node -> String -> String -> a -> Result Error ()

Cast with one argument.

Examples

Erpc.cast1 other "erlang" "garbage_collect" pid

cast2

cast2 : Node -> String -> String -> a -> b -> Result Error ()

Cast with two arguments.

Examples

Erpc.cast2 other "erlang" "process_flag" "trap_exit" True

multicall

multicall : List Node -> Int -> String -> String -> List a -> List (Result Error b)

Call the same MFA on every node in the list.

Examples

Erpc.multicall nodes 5000 "erlang" "node" []