mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update stdlib/public/Distributed/DistributedActorSystem.swift
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
This commit is contained in:
committed by
GitHub
parent
20e1834627
commit
e1527ff9b6
@@ -851,16 +851,16 @@ public struct RemoteCallArgument<Value> {
|
||||
/// ```
|
||||
///
|
||||
/// ### Decoding DistributedActor arguments using Codable
|
||||
/// When using the actor system's ``ActorID`` is ``Codable``, every distributed actor using that system
|
||||
/// When using an actor system where ``ActorID`` is ``Codable``, every distributed actor using that system
|
||||
/// is also implicitly ``Codable`` (see ``DistributedActorSystem``). Such distributed actors are encoded
|
||||
/// as their ``ActorID`` stored in a ``Encoder/singleValueContainer``. Since ``Codable`` is being used
|
||||
/// by this such system, it means that the ``decodeNextArgument`` method will be using ``Decoder`` to
|
||||
/// decode the incoming values, some of which may be distributed actors.
|
||||
/// as their ``ActorID`` stored in an ``Encoder/singleValueContainer``. When ``Codable`` is being used
|
||||
/// by such a system, the ``decodeNextArgument`` method will be using ``Decoder`` to
|
||||
/// decode the incoming values, which may themselves be distributed actors.
|
||||
///
|
||||
/// In order for a distributed actor's ``Decodable/init(from:)`` to be able to return an existing instance,
|
||||
/// i.e. when the being-decoded ``ActorID`` actually references a locally hosted distributed actor, that the
|
||||
/// current actor system can return from `resolve(id:as:)`, an actor system must be provided to the ``Decoder``.
|
||||
/// This is done by setting the actor system the decoding is performed for, on the decoder's `userInfo`, as follows:
|
||||
/// An actor system must be provided to the ``Decoder`` in order for a distributed actor's ``Decodable/init(from:)``
|
||||
/// to be able to return the instance of the actor. Specifically, the decoded``ActorID`` is passed to the actor system's `resolve(id:as:)` method in order to
|
||||
/// return either a local instance identified by this ID, or creating a remote actor reference.
|
||||
/// Thus, you must set the actor system the decoding is performed for, on the decoder's `userInfo`, as follows:
|
||||
///
|
||||
/// ```
|
||||
/// mutating func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
|
||||
@@ -869,7 +869,7 @@ public struct RemoteCallArgument<Value> {
|
||||
/// decoder.userInfo[.actorSystemKey] = self.actorSystem
|
||||
/// return try Argument.decode(
|
||||
/// }
|
||||
// ```
|
||||
/// ```
|
||||
@available(SwiftStdlib 5.7, *)
|
||||
public protocol DistributedTargetInvocationDecoder {
|
||||
/// The serialization requirement that the types passed to `decodeNextArgument` are required to conform to.
|
||||
|
||||
Reference in New Issue
Block a user