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]
def update_audio_inputs(audio_inputs : Array(OBS::State::AudioState)) : Nil #

Replaces the audio input list in the cached snapshot and publishes.


[View source]
def update_current_scene(scene_name : String) : Nil #

Updates the current program scene without a full snapshot refetch.


[View source]
def update_input_mute(input_name : String, muted : Bool) : Nil #

Updates one audio input's mute state without a full snapshot refetch.


[View source]
def update_input_volume(input_name : String, volume_mul : Float64 | Nil, volume_db : Float64 | Nil) : Nil #

Updates one audio input's volume without a full snapshot refetch.


[View source]
def update_scenes(current_scene : String | Nil, scenes : Array(OBS::State::SceneState)) : Nil #

Replaces the scene list in the cached snapshot and publishes.


[View source]