[distributed] a number of ctor infra cleanups

1. We're no longer synthesizing the local
init. All designated inits of a dist actor
must have exactly one ActorTransport parameter.
This parameter is used in the init's prologue
to initialize some of its members.

2. We're synthesizing a factory function for
the resolve initialization, instead of an
actor-member named `init` to serve that
purpose.

As such, much of the earlier infrastructure
is no longer needed, etc.
This commit is contained in:
Kavon Farvardin
2021-08-03 14:31:50 -07:00
committed by Konrad `ktoso` Malawski
parent d5b7bb3572
commit c9bfccb3b4
9 changed files with 74 additions and 124 deletions

View File

@@ -36,7 +36,6 @@ public protocol AnyActor: AnyObject {}
public protocol DistributedActor:
AnyActor,
Identifiable, Hashable, Codable {
/// Resolves the passed in `identity` against the `transport`, returning
/// either a local or remote actor reference.
///
@@ -74,23 +73,6 @@ public protocol DistributedActor:
nonisolated var id: AnyActorIdentity { get }
}
@available(SwiftStdlib 5.5, *)
extension DistributedActor {
public static func resolve<Identity>(_ identity: Identity, using transport: ActorTransport)
throws -> Self where Identity: ActorIdentity {
switch try transport.resolve(AnyActorIdentity(identity), as: Self.self) {
case .resolved(let instance):
return instance
case .makeProxy:
// FIXME: this needs actual implementation of distributedActorRemoteCreate
let remote: Any = distributedActorRemoteCreate(identity: identity, transport: transport)
return remote as! Self
}
}
}
// ==== Hashable conformance ---------------------------------------------------
@available(SwiftStdlib 5.5, *)