Struct TuiRegistry
pub struct TuiRegistry { /* private fields */ }Expand description
Daemon-wide registry of connected TUI clients.
Source of truth for live TUI connection state. Not persisted —
rebuilt on each daemon start from incoming initialize handshakes.
Implementations§
Source§impl TuiRegistry
impl TuiRegistry
Sourcepub fn new(config_dir: &Path) -> Self
pub fn new(config_dir: &Path) -> Self
Create a registry, attempting to load the signing key from
<config_dir>/.secret_key. If the file is missing or
unreadable, signing is silently disabled.
Sourcepub fn signing_is_enabled(&self) -> bool
pub fn signing_is_enabled(&self) -> bool
Whether HMAC signing is enabled (.secret_key was loaded).
Sourcepub fn generate_tui_id() -> String
pub fn generate_tui_id() -> String
Generate a short TUI ID: tui_ + 8 hex chars (4 random bytes).
Sourcepub fn generate_unique_tui_id(&self) -> String
pub fn generate_unique_tui_id(&self) -> String
Generate a TUI ID that is not currently in the registry.
Sourcepub fn sign(&self, tui_id: &str) -> Option<String>
pub fn sign(&self, tui_id: &str) -> Option<String>
Sign a TUI ID with HMAC-SHA256. Returns None if signing is
disabled.
Sourcepub fn verify(&self, tui_id: &str, sig: &str) -> bool
pub fn verify(&self, tui_id: &str, sig: &str) -> bool
Verify a TUI ID + signature. Returns true if:
- Signing is disabled (trust all), OR
- The signature is valid.
Sourcepub fn register(&self, entry: TuiEntry) -> TuiEpoch
pub fn register(&self, entry: TuiEntry) -> TuiEpoch
Register a connected TUI, displacing any earlier registration of the same
id. Returns the epoch this registration owns; the caller must quote it
back to Self::unregister so a late teardown cannot evict a successor.
Sourcepub fn unregister(&self, tui_id: &str, epoch: TuiEpoch)
pub fn unregister(&self, tui_id: &str, epoch: TuiEpoch)
Unregister a disconnected TUI, but ONLY while epoch is still the live
registration for that id.
A reconnect adopts the same id under a new epoch, and the displaced connection’s teardown can run at any point after that — it may still be draining, or parked in a bounded write. Removing by key alone would let that late teardown evict the connection that replaced it.
Auto Trait Implementations§
impl !Freeze for TuiRegistry
impl RefUnwindSafe for TuiRegistry
impl Send for TuiRegistry
impl Sync for TuiRegistry
impl Unpin for TuiRegistry
impl UnsafeUnpin for TuiRegistry
impl UnwindSafe for TuiRegistry
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more