CoAkka Runtime · Swift 3.3.2
CoAkka Runtime · Swift cheat sheet
Look up the package, API shape, outcomes, and lifecycle; open the full lesson when you need the failure law.
Version and package
Package.swift
.package(
url: "https://github.com/phuong-tran/coakka-runtime-swift.git",
exact: "3.3.2"
)- Connector
3.3.2: Core generation 3.3, connector revision 2.- Toolchain
- Swift 6+.
- Stable native targets
- macOS ARM64, Linux ARM64/x64, Windows x64. Windows ARM64 remains preview/evaluation; wording must not promote it to stable.
- Owner
RuntimeHost;close()may throw.
Embedded request/reply
Swift
let runtime = try RuntimeHost.startLocal(
systemName: "orders",
target: "orders.quote",
nodeID: "orders-1"
)
try runtime.registerTextHandler("orders.quote") { quantity in quote(quantity) }
let reply = try runtime.askText(
source: "checkout",
target: "orders.quote",
payload: "2",
timeoutMs: 2_000
)Outcomes and Deadletter
- Reply
askTextandaskreturn a correlated terminal response.- Deadletter
- Match
RuntimeError.deadletter(let value); the value carries the reason and original-envelope facts. - Timeout/cancel
- A separate failure boundary; it does not prove that the handler never ran.
- OneWay
- Waits for no business response but still has admission and observability evidence.
- Classification
- Switch on typed
RuntimeError; do not parsedescription.
Direct peers
Service
network: .networkNode(
bindHost: "0.0.0.0",
bindPort: 19_321,
advertiseHost: "pricing.internal",
advertisePort: 19_321
)Caller
routes: [.remote(
"orders.quote",
host: "pricing.internal",
port: 19_321
)],
network: .outboundOnly()File Lane and Stream Lane
- File: hash → receiver grant → sender submit → both terminals succeeded → forget → close.
- Stream: publisher grant → subscriber window → bounded callbacks → both terminals succeeded → forget → close.
- A grant names an exact owner; it is not load-balanced through a Service address.
- Raw buffer pointers are borrowed only during the callback; copy before retaining.
- Lane owners are independent from
RuntimeHost; close may throw and must not run inside a callback.
Monitor and effective state
enableMonitor: true- Startup intent.
startupConfig()- Core-accepted Monitor and default facts.
health()/stats()- Observed runtime state and counters.
runtimeConfig()- Generation, routes, and state.
- API boundary
- Swift 3.3.2 does not project a Monitor wait API; do not copy methods from another connector.
Integration checklist
- Pin the exact SwiftPM tag and inspect the artifact for the real OS/CPU.
- Own one
RuntimeHostfor the app lifecycle, not one per request. - Keep
AppScopeso operation and close failures remain observable. - Read capability and effective state before advanced transport or tuning.
- File/Stream Lane has an independent lifecycle; root callback owners until confirmed retirement.
- Do not block the UI/main actor with lane waits.
- Windows ARM64 remains preview/evaluation in this generation.