DalaDev.Remote.Rpc (dala_dev v0.0.7)

Copy Markdown View Source

Generic RPC call functions for executing arbitrary functions on remote nodes.

These functions automatically use the node selected via DalaDev.Remote.select_node/1.

Usage

iex> DalaDev.Remote.Rpc.call(MyModule, :my_function, [arg1, arg2])
{:ok, result}

iex> DalaDev.Remote.Rpc.call(MyModule, :my_function, [arg1, arg2], timeout: 10_000)
{:ok, result}

Summary

Functions

Calls a function on the selected remote node.

Functions

call(module, function, args, opts \\ [])

@spec call(module(), atom(), [term()], keyword()) :: {:ok, term()} | {:error, term()}

Calls a function on the selected remote node.

Parameters

  • module - The module containing the function
  • function - The function name (atom)
  • args - List of arguments to pass to the function
  • opts - Options:
    • :timeout - RPC timeout in ms (defaults to remote timeout)

Returns

  • {:ok, result} on success
  • {:error, reason} on failure

Examples

# Call a function with no arguments
iex> DalaDev.Remote.Rpc.call(MyModule, :get_status, [])
{:ok, :online}

# Call a function with arguments
iex> DalaDev.Remote.Rpc.call(MyModule, :add, [1, 2])
{:ok, 3}

# Call a function with custom timeout
iex> DalaDev.Remote.Rpc.call(MyModule, :slow_function, [], timeout: 30_000)
{:ok, result}