Jido.Signal.Bus.State (Jido v1.1.0-rc.2)
View SourceDefines the state structure for the signal bus.
This module contains the type definitions and operations for managing the internal state of the signal bus, including signal logs, subscriptions, snapshots, and router configuration. It provides functions for manipulating and querying this state.
Summary
Functions
Merges a list of recorded signals into the existing log. Signals are added to the log keyed by their IDs. If a signal with the same ID already exists, it will be overwritten.
Clears all signals from the log.
Truncates the signal log to the specified maximum size. Keeps the most recent signals and discards older ones.
Types
@type t() :: %Jido.Signal.Bus.State{ child_supervisor: pid() | nil, log: %{required(String.t()) => Jido.Signal.t()}, name: atom(), router: Jido.Signal.Router.Router.t(), snapshots: %{required(String.t()) => Jido.Signal.t()}, subscriptions: %{required(String.t()) => Jido.Signal.Bus.Subscriber.t()} }
Functions
@spec append_signals(t(), [Jido.Signal.t() | {:ok, Jido.Signal.t()} | map()]) :: {:ok, t(), [Jido.Signal.t()]} | {:error, term()}
Merges a list of recorded signals into the existing log. Signals are added to the log keyed by their IDs. If a signal with the same ID already exists, it will be overwritten.
Parameters
- state: The current bus state
- signals: List of recorded signals to merge
Returns
- with signals merged into log
- if there was an error processing the signals
Clears all signals from the log.
Truncates the signal log to the specified maximum size. Keeps the most recent signals and discards older ones.