Skip to content

Commit cfdffb1

Browse files
committed
remove child related types, cleanup version
1 parent 280b74e commit cfdffb1

File tree

7 files changed

+37
-22
lines changed

7 files changed

+37
-22
lines changed

Sources/DistributedActors/Cluster/HandshakeStateMachine.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ import NIO
1717
// ==== ----------------------------------------------------------------------------------------------------------------
1818
// MARK: Protocol version
1919

20-
/// Wire Protocol version of this Swift Distributed Actors build.
21-
public let DistributedActorsProtocolVersion: ClusterSystem.Version = .init(reserved: 0, major: 1, minor: 0, patch: 0)
20+
extension ClusterSystem {
21+
/// Wire protocol version of this `ClusterSystem`.
22+
///
23+
/// This version does not have to match the project version, i.e. a library version `1.5.0` may still be using the protocol version `1.0.0`,
24+
/// as this version number is more about the _wire_ compatibility of the underlying protocol, rather than the library capabilities
25+
public static let protocolVersion: ClusterSystem.Version = ClusterSystem.Version(reserved: 0, major: 1, minor: 0, patch: 0)
26+
}
2227

2328
// ==== ----------------------------------------------------------------------------------------------------------------
2429
// MARK: Constants for Cluster
2530

2631
/// Magic 2 byte value for use as initial bytes in connections (before handshake).
27-
/// Reads as: `5AC7 == SACT == S Act == Swift/Swift Distributed Actors Act == Swift/Swift Distributed Actors`
32+
/// Reads as: `5AC7 == SACT == S Act == Swift/ (Distributed) Actors
2833
internal let HandshakeMagicBytes: UInt16 = 0x5AC7
2934

3035
// ==== ----------------------------------------------------------------------------------------------------------------

Sources/DistributedActors/Cluster/Reception/_OperationLogClusterReceptionistBehavior.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ import Logging
1717
// ==== ----------------------------------------------------------------------------------------------------------------
1818
// MARK: Cluster (OpLog) Receptionist
1919

20-
/// ClusterReceptionist namespace
21-
public enum ClusterReceptionist {}
22-
2320
public final class _OperationLogClusterReceptionist {
2421
typealias Message = Receptionist.Message
2522
typealias ReceptionistRef = _ActorRef<Message>

Sources/DistributedActors/ClusterSystemSettings.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct ClusterSystemSettings {
4040

4141
public var receptionist: ReceptionistSettings = .default
4242

43-
public var transports: [_InternalActorTransport] = []
43+
internal var transports: [_InternalActorTransport] = []
4444
public var serialization: Serialization.Settings = .default
4545

4646
// ==== ------------------------------------------------------------------------------------------------------------
@@ -124,6 +124,7 @@ public struct ClusterSystemSettings {
124124
)
125125

126126
/// Defines the Time-To-Live of an association, i.e. when it shall be completely dropped from the tombstones list.
127+
///
127128
/// An association ("unique connection identifier between two nodes") is kept as tombstone when severing a connection between nodes,
128129
/// in order to avoid accidental re-connections to given node. Once a node has been downed, removed, and disassociated, it MUST NOT be
129130
/// communicated with again. Tombstones are used to ensure this, even if the downed ("zombie") node, attempts to reconnect.
@@ -141,7 +142,7 @@ public struct ClusterSystemSettings {
141142
}
142143

143144
/// FOR TESTING ONLY: Exposed for testing handshake negotiation while joining nodes of different versions.
144-
internal var _protocolVersion: ClusterSystem.Version = DistributedActorsProtocolVersion
145+
internal var _protocolVersion: ClusterSystem.Version = ClusterSystem.protocolVersion
145146

146147
// ==== ------------------------------------------------------------------------------------------------------------
147148
// MARK: Cluster.Membership Gossip

Sources/DistributedActors/DistributedActors.docc/Clustering.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,24 @@ distributed actor Boss: LifecycleWatch {
268268
}
269269
}
270270
```
271+
272+
## Customizing Remote Calls
273+
274+
Remote calls are at the heart of what makes distributed actors actually distributed.
275+
276+
A call made on a remote distributed actor reference, will cross network boundaries, and therefore may way due to
277+
network issues, message loss, serialization errors, or other reasons such as the recipient node crashing as it
278+
processes the message. Even replies to remote calls could sometimes fail being delivered, so you might need to
279+
design your distributed actors with idempotency (the resilience of a method being called more than once, e.g. due to a retry) in mind.
280+
281+
By default, to avoid "hanging" a remote caller forever on a suspended remote call as the recipient node fails to reply to it,
282+
for example because it (or the network itself), are currently unresponsive, remote calls have a default timeout configured,
283+
and if no reply is received within this duration, the call will fail with a ``RemoteCallError``.
284+
285+
You can configure the default timeout used by the cluster system during its initialization:
286+
287+
```swift
288+
ClusterSystem() { settings in
289+
settings.
290+
}
291+
```

Sources/DistributedActors/Plugins/ClusterSystemSettings+Plugins.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,6 @@ public struct PluginsSettings {
6060
}
6161
}
6262

63-
// /// Stops all plugins in the *reversed* order as they were added.
64-
// internal func stopAll(_ transport: ActorClusterTransport) async {
65-
// // Shut down in reversed order so plugins with the fewest dependencies are stopped first!
66-
// for plugin in self.plugins.reversed() {
67-
// do {
68-
// try await plugin.stop(transport)
69-
// } catch {
70-
// fatalError("Failed to stop plugin \(plugin.key)! Error: \(error)")
71-
// }
72-
// }
73-
// }
7463
}
7564

7665
extension PluginsSettings {

Sources/DistributedActors/SystemMessages.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public enum _SystemMessage: Equatable {
6464

6565
/// Child actor has terminated. This system message by itself does not necessarily cause a DeathPact and termination of the parent.
6666
/// If the message carries an `escalated` failure, the failure should apply to the parent as well, potentially tearing it down as well.
67-
case childTerminated(ref: _AddressableActorRef, TerminationCircumstances)
67+
case childTerminated(ref: _AddressableActorRef, _TerminationCircumstances)
6868

6969
/// Node has terminated, and all actors of this node shall be considered as terminated.
7070
/// This system message does _not_ have a direct counter part as `Signal`, and instead results in the sending of multiple
@@ -92,8 +92,9 @@ public enum _SystemMessage: Equatable {
9292
case tombstone
9393
}
9494

95+
// TODO: Child actors are being removed
9596
/// The circumstances under which a child actor has terminated.
96-
public enum TerminationCircumstances {
97+
public enum _TerminationCircumstances {
9798
/// The actor stopped naturally, by becoming `.stop`
9899
case stopped
99100
/// The actor has failed during message processing.

Sources/DistributedActors/Version.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
extension ClusterSystem {
16-
/// Version of the cluster system, as advertised to other nodes while joining the cluster.
16+
/// Version advertised to other nodes while joining the cluster.
17+
///
1718
/// Can be used to determine wire of feature compatibility of nodes joining a cluster.
1819
public struct Version: Equatable, CustomStringConvertible {
1920
/// Exact semantics of the reserved field remain to be defined.

0 commit comments

Comments
 (0)