Giocci (giocci v0.6.4)

Copy Markdown

Client API for Giocci.

Summary

Functions

Execute a function on an engine via the relay.

Execute a function asynchronously and send the result to server.

Register this client to a relay.

Save a module to the relay.

Unregister this client's name from a relay without deleting saved modules.

Functions

exec_func(relay_name, mfargs, opts \\ [])

@spec exec_func(String.t(), tuple(), keyword()) :: result :: term()

Execute a function on an engine via the relay.

Options:

  • :timeout - Client call timeout in milliseconds.
  • :measure_to - When set to a pid, sends measurement timestamps as {:giocci_measurements, timestamps} to that process.

exec_func_async(relay_name, mfargs, server, opts \\ [])

@spec exec_func_async(String.t(), tuple(), GenServer.server(), keyword()) ::
  :ok | {:error, reason :: term()}

Execute a function asynchronously and send the result to server.

The result is delivered to server as {:giocci, result}.

Options:

  • :timeout - Client call timeout in milliseconds.
  • :measure_to - When set to a pid, sends measurement timestamps as {:giocci_measurements, timestamps} to that process.

register_client(relay_name, opts \\ [])

@spec register_client(
  String.t(),
  keyword()
) :: :ok | {:error, reason :: term()}

Register this client to a relay.

Options:

  • :timeout - Client call timeout in milliseconds.
  • :measure_to - When set to a pid, sends measurement timestamps as {:giocci_measurements, timestamps} to that process.

save_module(relay_name, module, opts \\ [])

@spec save_module(String.t(), module(), keyword()) :: :ok | {:error, reason :: term()}

Save a module to the relay.

For modules compiled without a BEAM file, use Giocci.DynamicModule inside the module definition. Redefinitions must use it again; otherwise this function returns {:error, "dynamic_module_stale"} instead of sending the previously retained BEAM.

Options:

  • :timeout - Client call timeout in milliseconds.
  • :measure_to - When set to a pid, sends measurement timestamps as {:giocci_measurements, timestamps} to that process.

unregister_client(relay_name, opts \\ [])

@spec unregister_client(
  String.t(),
  keyword()
) :: :ok | {:error, reason :: term()}

Unregister this client's name from a relay without deleting saved modules.

An already unregistered name is treated as success. A failed request does not remove the relay from this client's local registration list; retrying is safe even if the relay processed the request before the reply was lost. Other clients using the same name are also affected by unregistration. Running executions are not cancelled or waited for.

Options:

  • :timeout - Client call timeout in milliseconds.
  • :measure_to - When set to a pid, sends measurement timestamps as {:giocci_measurements, timestamps} to that process.