Unifex.CNode (Unifex v1.2.2)

View Source

Wraps Bundlex.CNode functionalities to support Unifex-specific CNode behaviours

Summary

Functions

Makes a synchronous call to CNode and waits for its reply.

Starts monitoring CNode from the calling process.

Works the same way as start_link/1, but does not link to CNode's associated server.

Works the same way as start_link/2, but does not link to CNode's associated server.

Spawns and connects to CNode cnode_name.

Spawns and connects to CNode cnode_name from application app.

Disconnects from CNode.

Types

on_start_t()

@type on_start_t() :: {:ok, t()} | {:error, :spawn_cnode | :connect_to_cnode}

t()

@type t() :: %Unifex.CNode{
  bundlex_cnode: Bundlex.CNode.t(),
  node: node(),
  server: pid()
}

Functions

call(c_node, fun_name, args \\ [], timeout \\ 5000)

@spec call(
  t(),
  fun_name :: atom(),
  args :: list(),
  timeout :: non_neg_integer() | :infinity
) ::
  response :: term()

Makes a synchronous call to CNode and waits for its reply.

If the response doesn't come in within timeout, error is raised. Messages are exchanged directly (without interacting with CNode's associated server).

monitor(c_node)

@spec monitor(t()) :: reference()

Starts monitoring CNode from the calling process.

start(native_name)

(macro)

Works the same way as start_link/1, but does not link to CNode's associated server.

start(app, native_name)

@spec start(app :: Application.app(), Unifex.Specs.native_name_t()) :: on_start_t()

Works the same way as start_link/2, but does not link to CNode's associated server.

start_link(native_name)

(macro)

Spawns and connects to CNode cnode_name.

For details, see Bundlex.CNode.start_link/2.

start_link(app, native_name)

@spec start_link(app :: Application.app(), Unifex.Specs.native_name_t()) ::
  on_start_t()

Spawns and connects to CNode cnode_name from application app.

For details, see Bundlex.CNode.start_link/2.

stop(c_node)

@spec stop(t()) :: :ok | {:error, :disconnect_cnode}

Disconnects from CNode.