CellSpec 字段可变性
wesgine CellSpec 字段的 immutable/mutable/restricted 标记与运行时行为。
三种可变性
CellSpec 字段通过 wesgine:"immutable|mutable|restricted" struct tag 声明可变性。
immutable(不可变)
创建后永不可改。
ID— Cell 标识符Timezone— 时区
mutable(可变)
通过 UpdateSpec 随时修改。
Locale— 语言Quotas— 配额- 大多数适配器配置
restricted(受限)
需要特殊条件才能修改。
SpecPatch
UpdateSpec(ctx, cellID, SpecPatch) 是运行时修改 CellSpec 的 API。
SpecPatch 只包含可变/受限字段。
热更新 vs 冷更新
部分字段修改后需要 Cell 重启才能生效。
部分字段支持热更新(Hot Update):
Governance—PUT /config/governanceCycleDetect—PUT /config/cycle-detectFeatureFlags—PUT /config/featuresEmergencyOverride—PUT /config/emergency-override
CellSpec 分层
CellSpec 通过 Go struct embedding 分层:
CellSpec {
ID
CellCoreSpec // 核心元数据
CellAdapterSpec // 外设声明
CellSchedulingSpec // 调度与配额
CellPortableSpec // 导出/导入
}
嵌入保持向后兼容:spec.Timezone 等价 spec.CellCoreSpec.Timezone。
json:"-" Hook 字段
以下字段不落盘,每次 GetOrCreate 前必须绑定:
ProviderLiveKeyFnOnStartedHostEnvironmentQualityGateEditPatrolFileSegmenterEditMatchFallbackToolExecutorHooksPostRunFn