pub struct DaemonState { /* private fields */ }Expand description
Multi-room daemon state.
Implementations§
Source§impl DaemonState
impl DaemonState
Sourcepub fn new(config: DaemonConfig) -> Self
pub fn new(config: DaemonConfig) -> Self
Create a new daemon with the given configuration and no rooms.
Sourcepub async fn create_room(&self, room_id: &str) -> Result<(), String>
pub async fn create_room(&self, room_id: &str) -> Result<(), String>
Create a room and register it. Returns Err if the room ID is invalid
or the room already exists.
Sourcepub async fn create_room_with_config(
&self,
room_id: &str,
config: RoomConfig,
) -> Result<(), String>
pub async fn create_room_with_config( &self, room_id: &str, config: RoomConfig, ) -> Result<(), String>
Create a room with explicit configuration. Returns Err if the room ID
is invalid or the room already exists.
Sourcepub async fn get_room_config(&self, room_id: &str) -> Option<RoomConfig>
pub async fn get_room_config(&self, room_id: &str) -> Option<RoomConfig>
Get a room’s config, if it exists.
Sourcepub async fn destroy_room(&self, room_id: &str) -> Result<(), String>
pub async fn destroy_room(&self, room_id: &str) -> Result<(), String>
Destroy a room. Returns Err if the room does not exist.
Signals the room’s shutdown so connected clients receive EOF.
Sourcepub fn shutdown_handle(&self) -> Arc<Sender<bool>>
pub fn shutdown_handle(&self) -> Arc<Sender<bool>>
Get a handle to the daemon-level shutdown sender.
Sourcepub async fn list_rooms(&self) -> Vec<String>
pub async fn list_rooms(&self) -> Vec<String>
List all active room IDs.
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Run the daemon: listen on UDS, dispatch connections to rooms.
When the last UDS connection closes, starts a grace period timer
(config.grace_period_secs). If no new connection arrives before the
timer fires, sends a shutdown signal. Any new connection during the
grace period cancels the timer. On exit, cleans up the PID file and
socket file.
Auto Trait Implementations§
impl Freeze for DaemonState
impl !RefUnwindSafe for DaemonState
impl Send for DaemonState
impl Sync for DaemonState
impl Unpin for DaemonState
impl UnsafeUnpin for DaemonState
impl !UnwindSafe for DaemonState
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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