pub struct RoomManager {
directory: RwLock<RoomDirectory>,
factory: RoomFactory,
reservation_ttl: Duration,
}Expand description
Coordinates current room admission and lifecycle.
Fields§
§directory: RwLock<RoomDirectory>§factory: RoomFactory§reservation_ttl: DurationImplementations§
Source§impl RoomManager
impl RoomManager
Sourcepub fn new(
runtime_policy: RoomRuntimePolicy,
metrics: Arc<RuntimeMetrics>,
reservation_ttl: Duration,
) -> RoomManager
pub fn new( runtime_policy: RoomRuntimePolicy, metrics: Arc<RuntimeMetrics>, reservation_ttl: Duration, ) -> RoomManager
builds a room manager with an empty directory
Sourcepub async fn serve_room(
&self,
issuer: &str,
key: &str,
config: &RoomConfig,
remote_address: Option<&str>,
) -> Result<Arc<Room>, RoomManagerServeError>
pub async fn serve_room( &self, issuer: &str, key: &str, config: &RoomConfig, remote_address: Option<&str>, ) -> Result<Arc<Room>, RoomManagerServeError>
Returns the current room for issuer or publishes a new reservation.
The first reservation fixes key, config and remote_address.
Matching requests return the same room and renew an outstanding
reservation without rearming one retired by a successful join.
§Errors
Returns RoomManagerServeError::ConflictingReservation when the
current room has a different key or config.
Sourcepub async fn get_by_uuid(&self, uuid: &str) -> Option<Arc<Room>>
pub async fn get_by_uuid(&self, uuid: &str) -> Option<Arc<Room>>
returns the current room for a public room uuid
Sourcepub async fn stats_snapshots(
&self,
media_transport: &MediaTransport,
) -> Vec<RuntimeRoomStatsSnapshot>
pub async fn stats_snapshots( &self, media_transport: &MediaTransport, ) -> Vec<RuntimeRoomStatsSnapshot>
builds /v1/stats rows from one directory snapshot
the directory lock is released before transport stats are read, so the returned rows are best-effort runtime observations rather than a global transaction across room and media state
Sourcepub async fn directory_snapshots(&self) -> Vec<RuntimeRoomDirectorySnapshot>
pub async fn directory_snapshots(&self) -> Vec<RuntimeRoomDirectorySnapshot>
returns current directory rows for room diagnostics
Sourcepub async fn room_gauges(&self) -> RoomGaugeValues
pub async fn room_gauges(&self) -> RoomGaugeValues
Returns counts from rooms in one directory snapshot.
Room states are read sequentially after the directory lock is released. Removed rooms may contribute once. New rooms appear on the next call.
Sourcepub async fn directory_snapshot(
&self,
room_id: &str,
) -> Option<RuntimeRoomDirectorySnapshot>
pub async fn directory_snapshot( &self, room_id: &str, ) -> Option<RuntimeRoomDirectorySnapshot>
returns one current directory row for room diagnostics
Sourcepub async fn sync_source_packet_selection_policies_for_runtime_ids(
&self,
room_instance_ids: &BTreeSet<RoomInstanceId>,
media_transport: &MediaTransport,
)
pub async fn sync_source_packet_selection_policies_for_runtime_ids( &self, room_instance_ids: &BTreeSet<RoomInstanceId>, media_transport: &MediaTransport, )
recalculates packet-selection policy for rooms dirtied by media activity
empty input is a no-op. rooms that left the current directory before the drain are skipped. committed route work is executed after each policy plan so transport routing and accepted selector state stay in sync
Sourcepub async fn join_user(
&self,
room_id: &str,
request: JoinUserRequest,
media_transport: &MediaTransport,
) -> Result<RoomUserAdmission, RoomManagerJoinError>
pub async fn join_user( &self, room_id: &str, request: JoinUserRequest, media_transport: &MediaTransport, ) -> Result<RoomUserAdmission, RoomManagerJoinError>
Admits one WebSocket connection into a current room.
Returns after join-side room effects complete.
§Errors
Returns RoomManagerJoinError::MissingRoom when room_id is not
current. Returns RoomManagerJoinError::RoomFull when a new user
exceeds room capacity. Returns RoomManagerJoinError::RouterState when
router placement cannot commit.
§Panics
Panics when existing relay state refers to an uncommitted source placement.
Sourcepub async fn close_session(
&self,
room_id: &str,
user_id: &UserId,
connection_id: ConnectionId,
media_transport: &MediaTransport,
) -> bool
pub async fn close_session( &self, room_id: &str, user_id: &UserId, connection_id: ConnectionId, media_transport: &MediaTransport, ) -> bool
closes one room connection and then re-checks empty-room removal
returns false when the room is missing or the connection was not
removed by this call. the empty current room can still be removed after
stale or already-completed teardown
Sourcepub async fn disconnect_users(
&self,
room_id: &str,
user_ids: &[UserId],
media_transport: &MediaTransport,
)
pub async fn disconnect_users( &self, room_id: &str, user_ids: &[UserId], media_transport: &MediaTransport, )
disconnects selected users from a current room and removes it if empty
missing rooms are ignored because the caller’s disconnect intent is already satisfied
Sourcepub async fn check_expired_room_reservations(&self)
pub async fn check_expired_room_reservations(&self)
Claims and removes expired reservations with no active room mutations.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RoomManager
impl !RefUnwindSafe for RoomManager
impl Send for RoomManager
impl Sync for RoomManager
impl Unpin for RoomManager
impl UnsafeUnpin for RoomManager
impl !UnwindSafe for RoomManager
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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