Skip to content

Convert SWIMActorShell to distributed actor #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ce9d69e
Convert SWIMActorShell to distributed actor
yim-lee Jun 15, 2022
387fb6b
__secretlyKnownToBeLocal
yim-lee Jun 21, 2022
a14a628
Change how SWIMActorShell gets initialized in ClusterShell
yim-lee Jun 21, 2022
16a5f72
Remove SWIM.Actor typealias
yim-lee Jun 21, 2022
a8639ec
Add TODOs to rename __secretlyKnownToBeLocal
yim-lee Jun 21, 2022
df9e3f7
Remove usage of continuation
yim-lee Jun 21, 2022
63fcfa7
Regen protobufs
yim-lee Jun 21, 2022
05ca273
Clean up unused code
yim-lee Jun 21, 2022
a99804e
Disable non-compiling tests
yim-lee Jun 22, 2022
24bea1b
Make confirmDead nonisolated
yim-lee Jun 22, 2022
6d7d944
Use consistent ActorPath for SWIM shell
yim-lee Jun 22, 2022
785adcc
Fix SWIM tick not getting triggered
yim-lee Jun 22, 2022
4480377
Clean up and formatting
yim-lee Jun 22, 2022
54a5723
Update SWIMSerializationTests
yim-lee Jun 22, 2022
ea26337
Update SWIM metrics tests
yim-lee Jun 23, 2022
109caeb
Update SWIM metrics tests
yim-lee Jun 23, 2022
8990e27
SWIM tests
yim-lee Jun 23, 2022
75bfbdc
More SWIM tests
yim-lee Jun 24, 2022
e9f19e0
Fix formatting and Samples
yim-lee Jun 24, 2022
fa325fb
Minor code cleanup
yim-lee Jun 24, 2022
4154cd7
Clean up SWIM tests
yim-lee Jun 25, 2022
ee5e6c1
Clean up SWIM tests
yim-lee Jun 25, 2022
8e5d98e
Update SWIM tests
yim-lee Jun 25, 2022
581aef7
Fix rebase problems
yim-lee Jul 29, 2022
592af38
require latest cluster-membership; remove casts
ktoso Aug 2, 2022
dd39636
adjust for latest swim impl - it is now a struct
ktoso Aug 2, 2022
3a6327c
validate against "main" swift cluster membership after async changes
ktoso Aug 3, 2022
a188dff
=swim Rename to SWIMActor
ktoso Aug 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ var targets: [PackageDescription.Target] = [
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-atomics", from: "1.0.2"),

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

.package(url: "https://github.com/apple/swift-nio", from: "2.40.0"),
.package(url: "https://github.com/apple/swift-nio-extras", from: "1.2.0"),
Expand Down
23 changes: 1 addition & 22 deletions Protos/Cluster/SWIM/SWIM.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift Distributed Actors open source project
//
// Copyright (c) 2019 Apple Inc. and the Swift Distributed Actors project authors
// Copyright (c) 2019-2022 Apple Inc. and the Swift Distributed Actors project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -20,27 +20,6 @@ option swift_prefix = "_Proto";

import "ActorID.proto";

message SWIMRemoteMessage {
oneof message {
SWIMPing ping = 1;
SWIMPingRequest pingRequest = 2;
SWIMPingResponse pingResponse = 3;
}
}

message SWIMPing {
ActorID origin = 1;
SWIMGossipPayload payload = 2;
uint32 sequenceNumber = 3;
}

message SWIMPingRequest {
ActorID target = 1;
ActorID origin = 2;
SWIMGossipPayload payload = 3;
uint32 sequenceNumber = 4;
}

message SWIMPingResponse {
message Ack {
ActorID target = 1;
Expand Down
4 changes: 0 additions & 4 deletions Sources/DistributedActors/ActorID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -395,27 +395,23 @@ extension ActorID {
}

extension ActorID {
/// :nodoc:
public var _isLocal: Bool {
switch self._location {
case .local: return true
default: return false
}
}

/// :nodoc:
public var _isRemote: Bool {
!self._isLocal
}

/// :nodoc:
public var _asRemote: Self {
var remote = self
remote._location = .remote(remote.uniqueNode)
return remote
}

/// :nodoc:
public var _asLocal: Self {
var local = self
local._location = .local(self.uniqueNode)
Expand Down
4 changes: 2 additions & 2 deletions Sources/DistributedActors/ActorLogging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import DistributedActorsConcurrencyHelpers
import Foundation
import Logging

/// :nodoc:
/// - Warning: NOT thread safe! Only use from Actors, properly synchronize access, or create multiple instances for each execution context.
// TODO: deprecate, we should not need this explicit type
internal final class LoggingContext {
// TODO: deprecate, we should not need this explicit type

let identifier: String

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