class Obsctl::Server::StateStore

Overview

Authoritative OBS snapshot cache owned by the local daemon.

Defined in:

obsctl/server/state_store.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(on_update : Proc(JSON::Any, Nil) | Nil = nil) #

Creates a disconnected state store with an optional update callback.


[View source]

Class Method Detail

def self.snapshot_to_json(snapshot : OBS::State::ObsSnapshot) : JSON::Any #

Converts a snapshot into the stable IPC state-event JSON shape.


[View source]

Instance Method Detail

def mark_connected(snapshot : OBS::State::ObsSnapshot, at : Time = Time.utc) : Nil #

Records a successful OBS connection and publishes its fresh snapshot.


[View source]
def 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.


[View source]
def mark_reconnect_attempt(at : Time = Time.utc) : Nil #

Records that the supervisor is attempting to establish an OBS session.


[View source]
def mark_reconnect_requested(at : Time = Time.utc) : Nil #

Records a public operator reconnect request without treating it as an OBS connection failure.


[View source]
def 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.


[View source]
def publish_snapshot_payload(payload : JSON::Any) : Nil #

Publishes a precomputed state-event payload to subscribers.


[View source]
def snapshot : OBS::State::ObsSnapshot #

Returns the latest cached OBS snapshot.


[View source]
def snapshot_json : JSON::Any #

Returns the latest snapshot as the IPC state-event JSON payload.


[View source]
def telemetry : ServerTelemetry #

Returns the current daemon-side OBS connection telemetry.


[View source]
def update(snapshot : OBS::State::ObsSnapshot) : Nil #

Replaces the cached snapshot and publishes it to subscribers.


[View source]