@@ -153,6 +153,80 @@ public struct FakeActorSystem: DistributedActorSystem, CustomStringConvertible {
153
153
}
154
154
}
155
155
156
+ @available ( SwiftStdlib 5 . 7 , * )
157
+ //@_spi(FakeDistributedActorSystems)
158
+ public struct FakeActorSystemWithSPI : DistributedActorSystem , CustomStringConvertible {
159
+ public typealias ActorID = ActorAddress
160
+ public typealias InvocationDecoder = FakeInvocationDecoder
161
+ public typealias InvocationEncoder = FakeInvocationEncoder
162
+ public typealias SerializationRequirement = Codable
163
+ public typealias ResultHandler = FakeRoundtripResultHandler
164
+
165
+ // just so that the struct does not become "trivial"
166
+ let someValue : String = " "
167
+ let someValue2 : String = " "
168
+ let someValue3 : String = " "
169
+ let someValue4 : String = " "
170
+
171
+ public init ( ) {
172
+ print ( " Initialized new FakeActorSystem " )
173
+ }
174
+
175
+ public func resolve< Act> ( id: ActorID , as actorType: Act . Type ) throws -> Act ?
176
+ where Act: DistributedActor ,
177
+ Act. ID == ActorID {
178
+ nil
179
+ }
180
+
181
+ public func assignID< Act> ( _ actorType: Act . Type ) -> ActorID
182
+ where Act: DistributedActor ,
183
+ Act. ID == ActorID {
184
+ ActorAddress ( parse: " xxx " )
185
+ }
186
+
187
+ public func actorReady< Act> ( _ actor : Act )
188
+ where Act: DistributedActor ,
189
+ Act. ID == ActorID {
190
+ }
191
+
192
+ public func resignID( _ id: ActorID ) {
193
+ }
194
+
195
+ public func makeInvocationEncoder( ) -> InvocationEncoder {
196
+ . init( )
197
+ }
198
+
199
+ public func remoteCall< Act, Err, Res> (
200
+ on actor : Act ,
201
+ target: RemoteCallTarget ,
202
+ invocation invocationEncoder: inout InvocationEncoder ,
203
+ throwing: Err . Type ,
204
+ returning: Res . Type
205
+ ) async throws -> Res
206
+ where Act: DistributedActor ,
207
+ Act. ID == ActorID ,
208
+ Err: Error ,
209
+ Res: SerializationRequirement {
210
+ throw ExecuteDistributedTargetError ( message: " \( #function) not implemented. " )
211
+ }
212
+
213
+ public func remoteCallVoid< Act, Err> (
214
+ on actor : Act ,
215
+ target: RemoteCallTarget ,
216
+ invocation invocationEncoder: inout InvocationEncoder ,
217
+ throwing: Err . Type
218
+ ) async throws
219
+ where Act: DistributedActor ,
220
+ Act. ID == ActorID ,
221
+ Err: Error {
222
+ throw ExecuteDistributedTargetError ( message: " \( #function) not implemented. " )
223
+ }
224
+
225
+ public nonisolated var description : Swift . String {
226
+ " \( Self . self) () "
227
+ }
228
+ }
229
+
156
230
@available ( SwiftStdlib 5 . 7 , * )
157
231
public struct FakeNotLoadableAddressActorSystem : DistributedActorSystem , CustomStringConvertible {
158
232
public typealias ActorID = NotLoadableActorAddress
0 commit comments