@@ -45,16 +45,6 @@ import Foundation
4545 #expect( try await remoteActor. greet ( " John Doe " ) == " Hello, John Doe! " )
4646 }
4747
48- @StableNames
49- distributed actor StableNameTestActor {
50- typealias ActorSystem = ErlangActorSystem
51-
52- @StableName ( " ping " )
53- distributed func ping( ) -> String {
54- return " pong "
55- }
56- }
57-
5848 @Test func stableNameRemoteCall( ) async throws {
5949 let cookie = UUID ( ) . uuidString
6050
@@ -117,23 +107,6 @@ import Foundation
117107 #expect( try await remote. count == 2 )
118108 }
119109
120- @StableNames
121- distributed actor StableNameCounterActor {
122- typealias ActorSystem = ErlangActorSystem
123-
124- private var _count : Int = 0
125-
126- @StableName ( " count " )
127- distributed var count : Int {
128- _count
129- }
130-
131- @StableName ( " increment " )
132- distributed func increment( ) {
133- _count += 1
134- }
135- }
136-
137110 @Test func stableNameRemoteComputedProperty( ) async throws {
138111 let cookie = UUID ( ) . uuidString
139112
@@ -181,20 +154,6 @@ import Foundation
181154 ) == 2 )
182155 }
183156
184- @StableNames
185- distributed actor ProcessGroupTestActor : HasRemoteCallAdapter {
186- typealias ActorSystem = ErlangActorSystem
187-
188- nonisolated var remoteCallAdapter : ProcessGroupRemoteCallAdapter {
189- . processGroup
190- }
191-
192- @StableName ( " test " )
193- distributed func test( ) {
194-
195- }
196- }
197-
198157 @Test func processGroups( ) async throws {
199158 let cookie = UUID ( ) . uuidString
200159 let actorSystem1 = try await ErlangActorSystem ( name: UUID ( ) . uuidString, cookie: cookie)
@@ -238,60 +197,107 @@ import Foundation
238197 }
239198 }
240199
241- @StableNames
242- distributed actor Counter : CounterProtocol {
243- var _count = 0
244-
245- @StableName ( " count " )
246- distributed var count : Int {
247- _count
248- }
249-
250- @StableName ( " increment " )
251- distributed func increment( ) {
252- _count += 1
253- }
254-
255- @StableName ( " decrement " )
256- distributed func decrement( ) {
257- _count -= 1
258- }
259- }
200+ // @Test func protocols() async throws {
201+ // let cookie = UUID().uuidString
202+ // let actorSystem1 = try await ErlangActorSystem(name: UUID().uuidString, cookie: cookie)
203+ // let actorSystem2 = try await ErlangActorSystem(name: UUID().uuidString, cookie: cookie)
204+ //
205+ // try await actorSystem1.connect(to: actorSystem2.name)
206+ //
207+ // let local = Counter(actorSystem: actorSystem1)
208+ // actorSystem1.register(local, name: "counter")
209+ //
210+ // let remote: some CounterProtocol = try $CounterProtocol.resolve(
211+ // id: .name("counter", node: actorSystem1.name),
212+ // using: actorSystem2
213+ // )
214+ //
215+ // #expect(try await remote.count == 0)
216+ // try await remote.increment()
217+ // try await remote.increment()
218+ // try await remote.increment()
219+ // #expect(try await remote.count == 3)
220+ // try await remote.decrement()
221+ // #expect(try await remote.count == 2)
222+ // }
223+ }
224+
225+ @StableNames
226+ distributed actor StableNameTestActor {
227+ typealias ActorSystem = ErlangActorSystem
260228
261- @Test func protocols( ) async throws {
262- let cookie = UUID ( ) . uuidString
263- let actorSystem1 = try await ErlangActorSystem ( name: UUID ( ) . uuidString, cookie: cookie)
264- let actorSystem2 = try await ErlangActorSystem ( name: UUID ( ) . uuidString, cookie: cookie)
265-
266- try await actorSystem1. connect ( to: actorSystem2. name)
267-
268- let local = Counter ( actorSystem: actorSystem1)
269- actorSystem1. register ( local, name: " counter " )
270-
271- let remote : some CounterProtocol = try $CounterProtocol. resolve (
272- id: . name( " counter " , node: actorSystem1. name) ,
273- using: actorSystem2
274- )
275-
276- #expect( try await remote. count == 0 )
277- try await remote. increment ( )
278- try await remote. increment ( )
279- try await remote. increment ( )
280- #expect( try await remote. count == 3 )
281- try await remote. decrement ( )
282- #expect( try await remote. count == 2 )
229+ @StableName ( " ping " )
230+ distributed func ping( ) -> String {
231+ return " pong "
283232 }
284233}
285234
286- @Resolvable
287235@StableNames
288- protocol CounterProtocol : DistributedActor , HasStableNames where ActorSystem == ErlangActorSystem {
236+ distributed actor StableNameCounterActor {
237+ typealias ActorSystem = ErlangActorSystem
238+
239+ private var _count : Int = 0
240+
289241 @StableName ( " count " )
290- distributed var count : Int { get }
242+ distributed var count : Int {
243+ _count
244+ }
291245
292246 @StableName ( " increment " )
293- distributed func increment( )
247+ distributed func increment( ) {
248+ _count += 1
249+ }
250+ }
251+
252+ @StableNames
253+ distributed actor ProcessGroupTestActor : HasRemoteCallAdapter {
254+ typealias ActorSystem = ErlangActorSystem
294255
295- @StableName ( " decrement " )
296- distributed func decrement( )
256+ nonisolated var remoteCallAdapter : ProcessGroupRemoteCallAdapter {
257+ . processGroup
258+ }
259+
260+ @StableName ( " test " )
261+ distributed func test( ) {
262+
263+ }
297264}
265+
266+ //@StableNames
267+ //distributed actor Counter {
268+ // typealias ActorSystem = ErlangActorSystem
269+ //
270+ // var _count = 0
271+ //
272+ // init(actorSystem: ActorSystem) {
273+ // self.actorSystem = actorSystem
274+ // }
275+ //
276+ // @StableName("count")
277+ // distributed var count: Int {
278+ // _count
279+ // }
280+ //
281+ // @StableName("increment")
282+ // distributed func increment() {
283+ // _count += 1
284+ // }
285+ //
286+ // @StableName("decrement")
287+ // distributed func decrement() {
288+ // _count -= 1
289+ // }
290+ //}
291+
292+ //@StableNames
293+ //@Resolvable
294+ //protocol CounterProtocol: DistributedActor, HasStableNames where ActorSystem == ErlangActorSystem {
295+ // @StableName("count")
296+ // distributed var count: Int { get }
297+ //
298+ // @StableName("increment")
299+ // distributed func increment()
300+ //
301+ // @StableName("decrement")
302+ // distributed func decrement()
303+ //}
0 commit comments