Table of Contents

Class CellSupervisor

Namespace
KernLab.Cell
Assembly
KernLab.Cell.dll

容器监督器(§5.2——单写者泵域:一个监督泵串行处理全部状态迁移与池决策输入, 无锁竞态面归零)。快慢分离:崩溃/挂死=状态迁移(Faulted);慢/水位=结构化信号(决策归使用方,D6)。

public sealed class CellSupervisor : IAsyncDisposable
Inheritance
CellSupervisor
Implements
Inherited Members

Constructors

CellSupervisor(ICellSupervisorEvents, CellSupervisorOptions?, Func<DateTimeOffset>?, bool)

构造并启动监督泵。

public CellSupervisor(ICellSupervisorEvents events, CellSupervisorOptions? options = null, Func<DateTimeOffset>? clock = null, bool runHeartbeatTimer = true)

Parameters

events ICellSupervisorEvents

监督事件出口。

options CellSupervisorOptions

判定阈值。

clock Func<DateTimeOffset>

时钟(测试注入——缺省系统时钟)。

runHeartbeatTimer bool

是否启内置心跳定时器(测试手动巡检时关)。

Properties

State

当前状态(volatile 读——迁移只在泵上发生)。

public CellContainerState State { get; }

Property Value

CellContainerState

Methods

DisposeAsync()

public ValueTask DisposeAsync()

Returns

ValueTask

InspectHeartbeat()

手动触发心跳巡检(测试/监督工具口——生产走内置定时器)。

public void InspectHeartbeat()

ReportChannelClosed(CellContainerExitInfo)

通道断开(容器消失)——Ready/Draining → Faulted,附退出取证。

public void ReportChannelClosed(CellContainerExitInfo exitInfo)

Parameters

exitInfo CellContainerExitInfo

ReportDeadlineHit(bool)

deadline 命中上报(命中率窗口观测——§5.2 慢检测)。

public void ReportDeadlineHit(bool hitDeadline)

Parameters

hitDeadline bool

ReportDrainCompleted()

drain 收尾完成——Draining → Retired。

public void ReportDrainCompleted()

ReportHeartbeat()

心跳收到(telemetry 批次/显式 ping——§5.2 活性信号)。

public void ReportHeartbeat()

ReportProcessExited(CellContainerExitInfo)

进程退出(drain 后正常/异常退出)。

public void ReportProcessExited(CellContainerExitInfo exitInfo)

Parameters

exitInfo CellContainerExitInfo

ReportQueueWatermark(double)

队列水位的比例值

public void ReportQueueWatermark(double usedRatio)

Parameters

usedRatio double

ReportReady()

Ready 帧达成(握手第三步)——Spawning → Ready。

public void ReportReady()

ReportResourceLimit(CellContainerExitInfo)

OS 资源执法(超限被杀/限流)——→ Faulted,事件带 OS 终止原因。

public void ReportResourceLimit(CellContainerExitInfo exitInfo)

Parameters

exitInfo CellContainerExitInfo

ReportStartupFailed()

装载/握手失败——Spawning → Faulted。

public void ReportStartupFailed()

RequestDrain()

使用方发起 drain——Ready → Draining。

public void RequestDrain()