namespace Aging.ResourceContracts
|
{
|
public enum OperationState
|
{
|
Succeeded, Failed,
|
/// <summary>栅栏校验失败:Grant 的 epoch/generation 已失效(含 Broker 重启)。</summary>
|
RejectedStaleLease,
|
/// <summary>INV-04 雏形:客户端 configHash 与 Broker 生效配置不一致。</summary>
|
RejectedConfigMismatch,
|
/// <summary>会话队列满。</summary>
|
RejectedQueueFull,
|
/// <summary>已发送但结果未知(INV-06:禁止当未执行)。</summary>
|
Unknown
|
}
|
|
/// <summary>一次有界设备动作(MVP=OneShot)。Grants 必须覆盖 resources。</summary>
|
public sealed class DeviceOperation
|
{
|
/// <summary>白名单操作码,如 "CAN_SEND"/"CAN_RECV"/"CAN_AUTO_RESPONSE"/"CAN_STATUS"。</summary>
|
public string OperationCode { get; set; } = "";
|
public string ParametersJson { get; set; } = "{}";
|
public string IdempotencyKey { get; set; } = "";
|
public string ConfigHash { get; set; } = "";
|
public LeaseGrant[] Grants { get; set; } = new LeaseGrant[0];
|
public long DeadlineUtcMs { get; set; }
|
}
|
|
public sealed class OperationResult
|
{
|
public string RequestId { get; set; } = "";
|
public OperationState State { get; set; }
|
public string ErrorCode { get; set; } = "";
|
public string ReadbackJson { get; set; } = "{}";
|
public long ServerEpoch { get; set; }
|
}
|
}
|