@@ -43,7 +43,7 @@ public protocol DistributedReceptionist: DistributedActor {
4343 ///
4444 /// It emits both values for already existing, checked-in before the listing was created,
4545 /// actors; as well as new actors which are checked-in while the listing was already subscribed to.
46- func listing< Guest> ( of key: DistributedReception . Key < Guest > ) async -> DistributedReception . GuestListing < Guest >
46+ func listing< Guest> ( of key: DistributedReception . Key < Guest > , file : String , line : UInt ) async -> DistributedReception . GuestListing < Guest >
4747 where Guest: DistributedActor , Guest. ActorSystem == ClusterSystem
4848
4949 /// Perform a *single* lookup for a distributed actor identified by the passed in `key`.
@@ -54,26 +54,49 @@ public protocol DistributedReceptionist: DistributedActor {
5454 where Guest: DistributedActor , Guest. ActorSystem == ClusterSystem
5555}
5656
57+ extension DistributedReceptionist {
58+ /// Returns a "listing" asynchronous sequence which will emit actor references,
59+ /// for every distributed actor that the receptionist discovers for the specific key.
60+ ///
61+ /// It emits both values for already existing, checked-in before the listing was created,
62+ /// actors; as well as new actors which are checked-in while the listing was already subscribed to.
63+ func listing< Guest> ( of key: DistributedReception . Key < Guest > , file: String = #file, line: UInt = #line) async -> DistributedReception . GuestListing < Guest >
64+ where Guest: DistributedActor , Guest. ActorSystem == ClusterSystem
65+ {
66+ await self . listing ( of: key, file: file, line: line)
67+ }
68+ }
69+
5770extension DistributedReception {
5871 public struct GuestListing < Guest: DistributedActor > : AsyncSequence , Sendable where Guest. ActorSystem == ClusterSystem {
5972 public typealias Element = Guest
6073
6174 let receptionist : OpLogDistributedReceptionist
6275 let key : DistributedReception . Key < Guest >
6376
64- init ( receptionist: OpLogDistributedReceptionist , key: DistributedReception . Key < Guest > ) {
77+ // Location where the subscription was created
78+ let file : String
79+ let line : UInt
80+
81+ init ( receptionist: OpLogDistributedReceptionist , key: DistributedReception . Key < Guest > ,
82+ file: String , line: UInt )
83+ {
6584 self . receptionist = receptionist
6685 self . key = key
86+ self . file = file
87+ self . line = line
6788 }
6889
6990 public func makeAsyncIterator( ) -> AsyncIterator {
70- AsyncIterator ( receptionist: self . receptionist, key: self . key)
91+ AsyncIterator ( receptionist: self . receptionist, key: self . key, file : self . file , line : self . line )
7192 }
7293
7394 public class AsyncIterator : AsyncIteratorProtocol {
7495 var underlying : AsyncStream < Element > . Iterator !
7596
76- init ( receptionist __secretlyKnownToBeLocal: OpLogDistributedReceptionist , key: DistributedReception . Key < Guest > ) {
97+ init ( receptionist __secretlyKnownToBeLocal: OpLogDistributedReceptionist , key: DistributedReception . Key < Guest > ,
98+ file: String , line: UInt )
99+ {
77100 self . underlying = AsyncStream< Element> { continuation in
78101 let anySubscribe = AnyDistributedReceptionListingSubscription (
79102 subscriptionID: ObjectIdentifier ( self ) ,
@@ -89,7 +112,7 @@ extension DistributedReception {
89112 )
90113
91114 Task {
92- await __secretlyKnownToBeLocal. _listing ( subscription: anySubscribe)
115+ await __secretlyKnownToBeLocal. _listing ( subscription: anySubscribe, file : file , line : line )
93116 }
94117
95118 continuation. onTermination = { @Sendable termination in
0 commit comments