class
Obsctl::Server::StateStore
- Obsctl::Server::StateStore
- Reference
- Object
Overview
Authoritative OBS snapshot cache owned by the local daemon.
Defined in:
obsctl/server/state_store.crConstructors
-
.new(on_update : Proc(JSON::Any, Nil) | Nil = nil)
Creates a disconnected state store with an optional update callback.
Class Method Summary
-
.snapshot_to_json(snapshot : OBS::State::ObsSnapshot) : JSON::Any
Converts a snapshot into the stable IPC state-event JSON shape.
Instance Method Summary
-
#mark_connected(snapshot : OBS::State::ObsSnapshot, at : Time = Time.utc) : Nil
Records a successful OBS connection and publishes its fresh snapshot.
-
#mark_disconnected(error : String | Nil = nil, reconnecting : Bool = false, at : Time = Time.utc, connection_failed : Bool = true) : Nil
Marks OBS unavailable while preserving the last known lists and versions.
-
#mark_reconnect_attempt(at : Time = Time.utc) : Nil
Records that the supervisor is attempting to establish an OBS session.
-
#mark_reconnect_requested(at : Time = Time.utc) : Nil
Records a public operator reconnect request without treating it as an OBS connection failure.
-
#mark_reconnect_requested_and_build_payload(at : Time = Time.utc) : JSON::Any
Mutates authoritative reconnect state for a public operator reconnect request and returns the precomputed state-event payload so callers can defer subscriber fanout until their own locks are released.
-
#publish_snapshot_payload(payload : JSON::Any) : Nil
Publishes a precomputed state-event payload to subscribers.
-
#snapshot : OBS::State::ObsSnapshot
Returns the latest cached OBS snapshot.
-
#snapshot_json : JSON::Any
Returns the latest snapshot as the IPC state-event JSON payload.
-
#telemetry : ServerTelemetry
Returns the current daemon-side OBS connection telemetry.
-
#update(snapshot : OBS::State::ObsSnapshot) : Nil
Replaces the cached snapshot and publishes it to subscribers.
Constructor Detail
Creates a disconnected state store with an optional update callback.
Class Method Detail
Converts a snapshot into the stable IPC state-event JSON shape.
Instance Method Detail
Records a successful OBS connection and publishes its fresh snapshot.
Marks OBS unavailable while preserving the last known lists and versions.
Records that the supervisor is attempting to establish an OBS session.
Records a public operator reconnect request without treating it as an OBS connection failure.
Mutates authoritative reconnect state for a public operator reconnect request and returns the precomputed state-event payload so callers can defer subscriber fanout until their own locks are released.
Publishes a precomputed state-event payload to subscribers.
Replaces the cached snapshot and publishes it to subscribers.