distribute/remote_call

Types

pub type RpcError {
  RpcTimeout
  RpcBadRpc(String)
  RpcFailed(String)
  DecodeFailed(codec.DecodeError)
  NotBinary(String)
}

Constructors

  • RpcTimeout

    The RPC call timed out.

  • RpcBadRpc(String)

    The RPC returned a badrpc error.

  • RpcFailed(String)

    The RPC failed for another reason.

  • DecodeFailed(codec.DecodeError)

    The result could not be decoded.

  • NotBinary(String)

    The result was not a binary (for typed RPC).

Values

pub fn call(
  node: String,
  module: String,
  function: String,
  args: List(dynamic.Dynamic),
) -> Result(dynamic.Dynamic, RpcError)

Deprecated: Use call_typed or call_typed_with_timeout with codecs for type-safe RPC

Perform a remote procedure call on a node. Calls module:function(args) on the given node. This function bypasses all type checking and encoding validation.

pub fn call_typed(
  node: String,
  module: String,
  function: String,
  args: List(dynamic.Dynamic),
  decoder: fn(BitArray) -> Result(a, codec.DecodeError),
  expected_tag: String,
  expected_version: Int,
) -> Result(a, RpcError)

Perform a typed remote procedure call on a node. The remote function must return envelope-wrapped binary data. The result is decoded using the provided Decoder with tag and version validation.

Uses a default timeout of 5000ms.

pub fn call_typed_with_timeout(
  node: String,
  module: String,
  function: String,
  args: List(dynamic.Dynamic),
  decoder: fn(BitArray) -> Result(a, codec.DecodeError),
  expected_tag: String,
  expected_version: Int,
  timeout_ms: Int,
) -> Result(a, RpcError)

Perform a typed remote procedure call with an explicit timeout. The remote function must return envelope-wrapped binary data. The result is decoded using the provided Decoder with tag and version validation.

pub fn call_with_timeout(
  node: String,
  module: String,
  function: String,
  args: List(dynamic.Dynamic),
  timeout_ms: Int,
) -> Result(dynamic.Dynamic, RpcError)

Deprecated: Use call_typed_with_timeout with codecs for type-safe RPC

Call with an explicit timeout in milliseconds. This function bypasses all type checking and encoding validation.

Search Document