pub struct Room {
pub(super) definition: RoomDefinition,
pub(super) metrics: Arc<RuntimeMetrics>,
pub(super) source_policy_turn: Mutex<()>,
pub(super) state: RwLock<RoomState>,
}Fields§
§definition: RoomDefinition§metrics: Arc<RuntimeMetrics>§source_policy_turn: Mutex<()>Serializes publication commits and activity changes with source-policy turns so their transport effects cannot overtake each other.
state: RwLock<RoomState>Implementations§
Source§impl Room
impl Room
pub(super) fn new(init: RoomInit) -> Self
pub(crate) fn user_operation<'a>( &'a self, user_id: &'a UserId, connection_id: ConnectionId, media_transport: &'a MediaTransport, ) -> RoomUserOperation<'a>
pub fn uuid(&self) -> &str
pub fn issuer(&self) -> &str
pub fn key(&self) -> &str
pub(crate) fn available_features(&self) -> AvailableFeatures
pub async fn recording_state(&self) -> RecordingState
pub(crate) async fn user_snapshots_except( &self, excluded_user_id: &UserId, ) -> Vec<PeerSnapshot>
pub fn web_rtc_enabled(&self) -> bool
Sourcepub async fn transport_user_key(
&self,
user_id: &UserId,
connection_id: ConnectionId,
) -> TransportSessionKey
pub async fn transport_user_key( &self, user_id: &UserId, connection_id: ConnectionId, ) -> TransportSessionKey
Returns the transport key for an exact committed router placement.
§Panics
Panics when user_id and connection_id have no committed router
placement.
pub fn room_worker_policy(&self) -> RoomWorkerPolicy
pub(crate) fn instance_id(&self) -> RoomInstanceId
Source§impl Room
impl Room
Sourcepub(super) async fn commit_admission(
&self,
admission: JoinAdmissionTurn<'_, impl FnOnce() -> RouterId>,
context: RoomEffectContext<'_>,
) -> Result<JoinCommit, RoomJoinError>
pub(super) async fn commit_admission( &self, admission: JoinAdmissionTurn<'_, impl FnOnce() -> RouterId>, context: RoomEffectContext<'_>, ) -> Result<JoinCommit, RoomJoinError>
Commits the admission turn with the room router.
§Errors
Returns RoomJoinError::RoomFull when a new user exceeds capacity.
Returns RoomJoinError::RouterState when placement cannot commit.
Sourcepub(super) async fn finalize_admission(
&self,
commit: JoinCommit,
context: RoomEffectContext<'_>,
) -> CommittedTransportReceipt
pub(super) async fn finalize_admission( &self, commit: JoinCommit, context: RoomEffectContext<'_>, ) -> CommittedTransportReceipt
Executes context-enabled RoomEffects before returning the committed receipt
§Panics
Panics when existing relay state refers to an uncommitted source placement.
Sourcepub(crate) async fn remove_user(
&self,
user_id: &UserId,
connection_id: ConnectionId,
media_transport: &MediaTransport,
) -> bool
pub(crate) async fn remove_user( &self, user_id: &UserId, connection_id: ConnectionId, media_transport: &MediaTransport, ) -> bool
Returns true only when connection_id removed the current room user.
§Panics
Panics when detached relay state refers to an uncommitted source placement.
Sourcepub async fn remove_user_with_teardown(
&self,
user_id: &UserId,
connection_id: ConnectionId,
context: RoomEffectContext<'_>,
) -> bool
pub async fn remove_user_with_teardown( &self, user_id: &UserId, connection_id: ConnectionId, context: RoomEffectContext<'_>, ) -> bool
Returns true only when connection_id was current. A stale committed
placement may still be retired before returning false.
§Panics
Panics when detached relay state refers to an uncommitted source placement.
Sourcepub(crate) async fn broadcast(
&self,
sender_id: &UserId,
connection_id: ConnectionId,
message: Value,
) -> Result<(), BroadcastPayloadError>
pub(crate) async fn broadcast( &self, sender_id: &UserId, connection_id: ConnectionId, message: Value, ) -> Result<(), BroadcastPayloadError>
Captures recipients in the state snapshot that validates connection_id
as current for sender_id. Missing or stale senders are ignored.
§Errors
Returns BroadcastPayloadError when the payload exceeds the room
broadcast byte limit or cannot be measured as serialized JSON.
pub(crate) async fn has_connection( &self, user_id: &UserId, connection_id: ConnectionId, ) -> bool
Sourcepub(crate) async fn update_user_info(
&self,
user_id: &UserId,
connection_id: ConnectionId,
media_transport: &MediaTransport,
info: UserInfo,
)
pub(crate) async fn update_user_info( &self, user_id: &UserId, connection_id: ConnectionId, media_transport: &MediaTransport, info: UserInfo, )
Ignores missing or stale connections. Publication transitions remain authoritative for camera and screen-sharing presence.
Sourcepub(crate) async fn disconnect_users(
&self,
user_ids: &[UserId],
media_transport: &MediaTransport,
)
pub(crate) async fn disconnect_users( &self, user_ids: &[UserId], media_transport: &MediaTransport, )
Missing users are ignored.
§Panics
Panics if a current room user has no committed router placement or detached relay state refers to an uncommitted source placement.
Sourcepub async fn disconnect_users_with_teardown(
&self,
user_ids: &[UserId],
context: RoomEffectContext<'_>,
)
pub async fn disconnect_users_with_teardown( &self, user_ids: &[UserId], context: RoomEffectContext<'_>, )
Removes current sessions in one state commit and ignores missing users.
§Panics
Panics if a current room user has no committed router placement or detached relay state refers to an uncommitted source placement.
pub(super) async fn is_empty(&self) -> bool
Source§impl Room
impl Room
pub(crate) async fn session_stats_snapshot( &self, transport: &MediaTransport, ) -> RoomUserStatsSnapshot
pub async fn diagnostics_overview_capture(&self) -> RoomOverviewCapture
pub async fn diagnostics_users_capture(&self) -> RoomUsersCapture
pub async fn diagnostics_detail_capture(&self) -> RoomDetailCapture
pub async fn diagnostics_user_capture( &self, user_key: &str, ) -> Option<RoomUserCapture>
Source§impl Room
impl Room
pub(crate) fn apply_recording_start( &self, _user_id: &UserId, _connection_id: ConnectionId, _options: RecordingOptions, ) -> bool
pub(crate) fn apply_recording_stop( &self, _user_id: &UserId, _connection_id: ConnectionId, ) -> bool
fn reject_recording_start(&self) -> bool
fn reject_recording_stop(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Room
impl !RefUnwindSafe for Room
impl Send for Room
impl Sync for Room
impl Unpin for Room
impl UnsafeUnpin for Room
impl UnwindSafe for Room
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