mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
78 lines
3.2 KiB
Markdown
78 lines
3.2 KiB
Markdown
# Distributed
|
|
|
|
Build systems that run distributed code across multiple processes and devices.
|
|
|
|
Distributed actors share many characteristics with Swift actors,
|
|
and include additional isolation checks to ensure
|
|
location transparency and safety in a distributed environment.
|
|
Similar to how actors make it easier to write concurrent code
|
|
that's safe and correct to run on a single computer,
|
|
distributed actors make it easier to write code
|
|
that runs across multiple computers.
|
|
|
|

|
|
|
|
You use three main parts when writing code with distributed actors:
|
|
|
|
- Swift language support for distributed actors and for building distributed or RPC systems integrated into the language.
|
|
For more information,
|
|
see [Concurrency][concurrency] in [The Swift Programming Language][tspl].
|
|
|
|
- The Distributed module, which includes the types and protocols you need
|
|
to declare and use distributed actors.
|
|
For example, it has
|
|
protocols to which distributed actors and distributed actor systems conform,
|
|
and structures that encapsulate information about calls to a distributed actor.
|
|
|
|
- A *distributed actor system* provides an implementation of the
|
|
``Distributed/DistributedActorSystem`` protocol
|
|
and coordinates between the cluster's nodes.
|
|
A distributed actor is always part of some distributed actor system;
|
|
that distributed actor system handles the serialization and networking
|
|
necessary to perform remote method calls.
|
|
For local testing, you can use ``Distributed/LocalTestingDistributedActorSystem``.
|
|
For production,
|
|
you can use `ClusterSystem` offered by
|
|
the [Swift Distributed Actors][cluster] library,
|
|
use another library,
|
|
or [write your own distributed actor system](<doc:implementing-a-custom-distributed-actor-system>).
|
|
|
|
[concurrency]: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html
|
|
[tspl]: https://docs.swift.org/swift-book/
|
|
[cluster]: https://github.com/apple/swift-distributed-actors/
|
|
|
|
## Topics
|
|
|
|
### Distributed actors
|
|
|
|
- ``Distributed/DistributedActor``
|
|
- ``Distributed/Resolvable()``
|
|
- ``Distributed/buildDefaultDistributedRemoteActorExecutor(_:)``
|
|
|
|
### Distributed actor system
|
|
|
|
- <doc:implementing-a-custom-distributed-actor-system>
|
|
- ``Distributed/DistributedActorSystem``
|
|
- ``Distributed/RemoteCallTarget``
|
|
- ``Distributed/RemoteCallArgument``
|
|
- ``Distributed/DistributedTargetInvocationEncoder``
|
|
- ``Distributed/DistributedTargetInvocationDecoder``
|
|
- ``Distributed/DistributedTargetInvocationResultHandler``
|
|
|
|
|
|
### Local testing
|
|
|
|
- ``Distributed/LocalTestingDistributedActorSystem``
|
|
- ``Distributed/LocalTestingActorID``
|
|
- ``Distributed/LocalTestingActorAddress``
|
|
- ``Distributed/LocalTestingInvocationEncoder``
|
|
- ``Distributed/LocalTestingInvocationDecoder``
|
|
- ``Distributed/LocalTestingInvocationResultHandler``
|
|
|
|
### Errors
|
|
|
|
- ``Distributed/DistributedActorCodingError``
|
|
- ``Distributed/DistributedActorSystemError``
|
|
- ``Distributed/ExecuteDistributedTargetError``
|
|
- ``Distributed/LocalTestingDistributedActorSystemError``
|