Skip to content

Commit

Permalink
Turn RoomLifecycleManager into a protocol
Browse files Browse the repository at this point in the history
Preparation for integrating the manager into the SDK in #47, in which
we’ll want to be able to mock a room’s lifecycle manager. Will fill in
the protocol’s methods as needed later.
  • Loading branch information
lawrence-forooghian committed Nov 10, 2024
1 parent 8ec25c2 commit d320404
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 46 deletions.
6 changes: 4 additions & 2 deletions Sources/AblyChat/RoomLifecycleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ internal protocol RoomLifecycleContributor: Identifiable, Sendable {
func emitDiscontinuity(_ error: ARTErrorInfo) async
}

internal actor RoomLifecycleManager<Contributor: RoomLifecycleContributor> {
internal protocol RoomLifecycleManager: Sendable {}

internal actor DefaultRoomLifecycleManager<Contributor: RoomLifecycleContributor>: RoomLifecycleManager {
// MARK: - Constant properties

private let logger: InternalLogger
Expand Down Expand Up @@ -583,7 +585,7 @@ internal actor RoomLifecycleManager<Contributor: RoomLifecycleContributor> {

/// Executes a function that represents a room lifecycle operation.
///
/// - Note: Note that `RoomLifecycleManager` does not implement any sort of mutual exclusion mechanism that _enforces_ that one room lifecycle operation must wait for another (e.g. it is _not_ a queue); each operation needs to implement its own logic for whether it should proceed in the presence of other in-progress operations.
/// - Note: Note that `DefaultRoomLifecycleManager` does not implement any sort of mutual exclusion mechanism that _enforces_ that one room lifecycle operation must wait for another (e.g. it is _not_ a queue); each operation needs to implement its own logic for whether it should proceed in the presence of other in-progress operations.
///
/// - Parameters:
/// - forcedOperationID: Forces the operation to have a given ID. In combination with the ``testsOnly_subscribeToOperationWaitEvents`` API, this allows tests to verify that one test-initiated operation is waiting for another test-initiated operation.
Expand Down
Loading

0 comments on commit d320404

Please sign in to comment.