View Source Chorex.Proxy (Chorex v0.4.3)

Proxy for singletons in a choreography.

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Send a message to a proxied service.

Updates the session state for the current process.

Types

@type session_key() :: term()
@type session_state() :: any()
@type state() :: %{
  pid_session: %{required(pid()) => session_key()},
  session_data: any(),
  session_handler: %{required(session_key()) => pid()}
}

Functions

Link to this function

begin_session(proxy, session_pids, proxy_module, start_func, start_args)

View Source

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.

Link to this function

send_proxied(proxy_pid, msg)

View Source
@spec send_proxied(pid(), any()) :: any()

Send a message to a proxied service.

Handles the wrapping of the message with the {:chorex, self(), ...} tuple so that the proxy knows which session to send the message on to.

Link to this function

set_state(proxy, new_state)

View Source
Link to this function

update_state(config, update_fn)

View Source
@spec update_state(map(), (session_state() -> {any(), session_state()})) :: any()

Updates the session state for the current process.

For use by proxied processes.