in Sources/DistributedActors/_ActorShell.swift [311:361]
func interpretSystemMessage(message: _SystemMessage) throws -> ActorRunResult {
traceLog_Cell("Interpret system message: \(message)")
switch message {
case .start:
try self.interpretStart()
// death watch
case .watch(_, let watcher):
self.interpretSystemWatch(watcher: watcher)
case .unwatch(_, let watcher):
self.interpretSystemUnwatch(watcher: watcher)
case .terminated(let ref, let existenceConfirmed, let nodeTerminated):
let terminated = Signals.Terminated(address: ref.address, existenceConfirmed: existenceConfirmed, nodeTerminated: nodeTerminated)
try self.interpretTerminatedSignal(who: ref.address, terminated: terminated)
case .childTerminated(let ref, let circumstances):
switch circumstances {
// escalation takes precedence over death watch in terms of how we report errors
case .escalating(let failure):
// we only populate `escalation` if the child is escalating
let terminated = Signals._ChildTerminated(address: ref.address, escalation: failure)
try self.interpretChildTerminatedSignal(who: ref, terminated: terminated)
case .stopped:
let terminated = Signals._ChildTerminated(address: ref.address, escalation: nil)
try self.interpretChildTerminatedSignal(who: ref, terminated: terminated)
case .failed:
let terminated = Signals._ChildTerminated(address: ref.address, escalation: nil)
try self.interpretChildTerminatedSignal(who: ref, terminated: terminated)
}
case .nodeTerminated(let remoteNode):
self.interpretNodeTerminated(remoteNode)
case .carrySignal(let signal):
try self.interpretCarrySignal(signal)
case .stop:
try self.interpretStop()
case .resume(let result):
return try self.interpretResume(result)
case .tombstone:
return self.finishTerminating()
}
return self.runState
}