From 86893cc6441564b19bcc3996dcbf7cabc4bee248 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Tue, 26 Jul 2022 20:28:39 +0900 Subject: [PATCH] -build remove toy "exec app" app --- Package.swift | 8 ------ Sources/ExecApp/boot.swift | 56 -------------------------------------- 2 files changed, 64 deletions(-) delete mode 100644 Sources/ExecApp/boot.swift diff --git a/Package.swift b/Package.swift index 13d521832..17094f9eb 100644 --- a/Package.swift +++ b/Package.swift @@ -178,14 +178,6 @@ let products: [PackageDescription.Product] = [ name: "DistributedActors", targets: ["DistributedActors"] ), - - // TODO(distributed): remove the exec app, it was just a toy example - .executable( - name: "ExecApp", - targets: [ - "ExecApp", - ] - ), ] if ProcessInfo.processInfo.environment["VALIDATE_DOCS"] != nil { diff --git a/Sources/ExecApp/boot.swift b/Sources/ExecApp/boot.swift deleted file mode 100644 index 6a5656e6c..000000000 --- a/Sources/ExecApp/boot.swift +++ /dev/null @@ -1,56 +0,0 @@ -import DistributedActors -import Distributed - -distributed actor Greeter: CustomStringConvertible { - typealias ID = ClusterSystem.ActorID - typealias ActorSystem = ClusterSystem - distributed func hi(name: String) -> String { - let message = "HELLO \(name)!" - print(">>> \(self): \(message)") - return message - } - - nonisolated var description: String { - "\(Self.self)(\(self.id))" - } -} - -@main -enum Main { - static func main() async throws { -// LoggingSystem.bootstrap(_SWIMPrettyMetadataLogHandler.init) - - let system = await ClusterSystem("FirstSystem") { settings in - settings.node.host = "127.0.0.1" - settings.node.port = 7337 - } - let second = await ClusterSystem("SecondSystem") { settings in - settings.node.host = "127.0.0.1" - settings.node.port = 8228 - } - - system.cluster.join(node: second.cluster.uniqueNode) - - print("LOCAL:") - let greeter = Greeter(actorSystem: system) - let localGreeting = try await greeter.hi(name: "Caplin") - print("Got local greeting: \(localGreeting)") - - print("RESOLVE:") - let resolved = try Greeter.resolve(id: greeter.id, using: system) - print("Resolved: \(resolved)") - let greeting = try await resolved.hi(name: "Caplin") - print("Got remote greeting: \(greeting)") - - // ------------------------------------------ - print("REMOTE:") - let remote = try Greeter.resolve(id: greeter.id, using: second) - print("Resolve remote: \(remote)") - - let reply = try await remote.hi(name: "Remotely") - print("Received reply from remote \(remote): \(reply)") - - try await Task.sleep(until: .now + .seconds(5), clock: .continuous) - print("================ DONE ================") - } -}