FixAlchemy.SessionDirectory (FIXAlchemy v0.3.0)

View Source

The sessions a connection is running, and the roles each one serves.

Every session registers its supervisor under {connection_id, name, :supervisor} with its roles as the registration value, so the sessions of a connection and their purposes are read from the registry rather than from the connection's config, and are forgotten the moment a session stops.

Names are returned sorted, so a role that two sessions declare resolves to the same one on every call.

Summary

Functions

The names of every running session of connection_id, sorted.

The name of the session serving role.

The roles session name of connection_id serves.

The {name, roles} of every running session of connection_id.

Functions

names(connection_id)

@spec names(binary()) :: [FixAlchemy.SessionConfig.name()]

The names of every running session of connection_id, sorted.

resolve(connection_id, role)

@spec resolve(binary(), FixAlchemy.SessionConfig.role()) ::
  {:ok, FixAlchemy.SessionConfig.name()} | :error

The name of the session serving role.

Falls back to a session serving :trading when none declares role, so a connection with no session of its own for a purpose uses its trading session for it. Returns :error when neither exists.

roles(connection_id, name)

The roles session name of connection_id serves.

sessions(connection_id)

The {name, roles} of every running session of connection_id.