FixAlchemy.SessionStatus (FIXAlchemy v0.2.0)

View Source

Tracks the live status of every named FIX session of a connection, including the last error that took a session down — e.g. the Text from a Logout rejecting a logon.

Backed by a public ETS table so client processes can record transitions without going through this process. All operations are safe no-ops when the table is not running (e.g. standalone Livebook usage).

Summary

Functions

Every session of connection_id that has a recorded status, by name.

Returns a specification to start this module under a supervisor.

Forget every session of connection_id.

Types

session_name()

@type session_name() :: FixAlchemy.SessionConfig.name()

session_state()

@type session_state() :: :connecting | :connected | :logged_in | :down

status()

@type status() :: %{state: session_state(), error: term() | nil, at: DateTime.t()}

Functions

all(connection_id)

@spec all(String.t()) :: %{required(session_name()) => status()}

Every session of connection_id that has a recorded status, by name.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(connection_id)

@spec clear(String.t()) :: :ok

Forget every session of connection_id.

Broadcasts each forgotten session as :down with reason :disconnected.

get(connection_id, session_name)

@spec get(String.t() | nil, session_name()) :: status() | nil

mark_down(connection_id, session_name, reason)

@spec mark_down(String.t() | nil, session_name(), term()) :: :ok

put(connection_id, session_name, state, error \\ nil)

@spec put(String.t() | nil, session_name(), session_state(), term() | nil) :: :ok

start_link(opts)

@spec start_link(term()) :: GenServer.on_start()