Skip to content

Commit ec72733

Browse files
yim-leektoso
andauthored
Convert SWIMActorShell to distributed actor (#977)
* Convert SWIMActorShell to distributed actor Resolves #973 * __secretlyKnownToBeLocal * Change how SWIMActorShell gets initialized in ClusterShell * Remove SWIM.Actor typealias * Add TODOs to rename __secretlyKnownToBeLocal * Remove usage of continuation * Regen protobufs * Clean up unused code * Disable non-compiling tests * Make confirmDead nonisolated * Use consistent ActorPath for SWIM shell * Fix SWIM tick not getting triggered * Clean up and formatting * Update SWIMSerializationTests * Update SWIM metrics tests * Update SWIM metrics tests * SWIM tests * More SWIM tests * Fix formatting and Samples * Minor code cleanup * Clean up SWIM tests * Clean up SWIM tests * Update SWIM tests * Fix rebase problems * require latest cluster-membership; remove casts * adjust for latest swim impl - it is now a struct * validate against "main" swift cluster membership after async changes * =swim Rename to SWIMActor Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
1 parent 811d2e8 commit ec72733

40 files changed

+2464
-3949
lines changed

Package.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ var targets: [PackageDescription.Target] = [
140140
var dependencies: [Package.Dependency] = [
141141
.package(url: "https://github.com/apple/swift-atomics", from: "1.0.2"),
142142

143-
.package(url: "https://github.com/apple/swift-cluster-membership", from: "0.3.0"),
143+
// .package(url: "https://github.com/apple/swift-cluster-membership", from: "0.3.0"),
144+
// .package(name: "swift-cluster-membership", path: "Packages/swift-cluster-membership"), // FIXME: just work in progress
145+
.package(url: "https://github.com/apple/swift-cluster-membership", branch: "main"),
144146

145147
.package(url: "https://github.com/apple/swift-nio", from: "2.40.0"),
146148
.package(url: "https://github.com/apple/swift-nio-extras", from: "1.2.0"),

Protos/Cluster/SWIM/SWIM.proto

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift Distributed Actors open source project
44
//
5-
// Copyright (c) 2019 Apple Inc. and the Swift Distributed Actors project authors
5+
// Copyright (c) 2019-2022 Apple Inc. and the Swift Distributed Actors project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -20,27 +20,6 @@ option swift_prefix = "_Proto";
2020

2121
import "ActorID.proto";
2222

23-
message SWIMRemoteMessage {
24-
oneof message {
25-
SWIMPing ping = 1;
26-
SWIMPingRequest pingRequest = 2;
27-
SWIMPingResponse pingResponse = 3;
28-
}
29-
}
30-
31-
message SWIMPing {
32-
ActorID origin = 1;
33-
SWIMGossipPayload payload = 2;
34-
uint32 sequenceNumber = 3;
35-
}
36-
37-
message SWIMPingRequest {
38-
ActorID target = 1;
39-
ActorID origin = 2;
40-
SWIMGossipPayload payload = 3;
41-
uint32 sequenceNumber = 4;
42-
}
43-
4423
message SWIMPingResponse {
4524
message Ack {
4625
ActorID target = 1;

Sources/DistributedActors/ActorID.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,27 +395,23 @@ extension ActorID {
395395
}
396396

397397
extension ActorID {
398-
/// :nodoc:
399398
public var _isLocal: Bool {
400399
switch self._location {
401400
case .local: return true
402401
default: return false
403402
}
404403
}
405404

406-
/// :nodoc:
407405
public var _isRemote: Bool {
408406
!self._isLocal
409407
}
410408

411-
/// :nodoc:
412409
public var _asRemote: Self {
413410
var remote = self
414411
remote._location = .remote(remote.uniqueNode)
415412
return remote
416413
}
417414

418-
/// :nodoc:
419415
public var _asLocal: Self {
420416
var local = self
421417
local._location = .local(self.uniqueNode)

Sources/DistributedActors/ActorLogging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import DistributedActorsConcurrencyHelpers
1717
import Foundation
1818
import Logging
1919

20-
/// :nodoc:
2120
/// - Warning: NOT thread safe! Only use from Actors, properly synchronize access, or create multiple instances for each execution context.
22-
// TODO: deprecate, we should not need this explicit type
2321
internal final class LoggingContext {
22+
// TODO: deprecate, we should not need this explicit type
23+
2424
let identifier: String
2525

2626
// TODO: want to eventually not have this; also move to more structured logging perhaps...

0 commit comments

Comments
 (0)