pub struct SettlementObservation {
pub schema: String,
pub receipt_id: String,
pub finalized_at: u64,
pub tenant_id: Option<String>,
pub tool_server: String,
pub tool_name: String,
pub capability_id: String,
pub amount: MonetaryAmount,
pub content_hash: String,
pub policy_hash: String,
}Expand description
Observation handed to a SettlementHook by the kernel observer
slot once a receipt has been signed and persisted. The structure is
deliberately storage-agnostic: it carries the finalized-receipt
identity plus the financial coordinates required to route the
settlement through chio-settle/ops.rs.
The kernel sets [finalized_at] to the receipt timestamp so a hook
implementation can sort by (finalized_at, receipt_id) to guarantee
the deterministic ordering the integration tests enforce.
Fields§
§schema: StringSchema tag (chio.settle.observation.v1).
receipt_id: Stringid of the finalized chio_core::receipt::body::ChioReceipt.
finalized_at: u64timestamp carried over from the receipt (deterministic sort key).
tenant_id: Option<String>Cluster operator (tenant) that owes the obligation, or None
for single-tenant deployments.
tool_server: StringTool server invoked.
tool_name: StringTool name invoked.
capability_id: StringCapability id matched at evaluation time.
amount: MonetaryAmountSettlement amount derived from the manifest pricing context. The kernel skips the hook entirely for zero-priced receipts; the amount on this struct is therefore always strictly positive.
content_hash: StringReceipt content hash, carried verbatim so a downstream auditor can confirm the settlement references the same bytes the kernel signed.
policy_hash: StringReceipt policy hash, carried verbatim for the same reason.
Implementations§
Source§impl SettlementObservation
impl SettlementObservation
Sourcepub fn new(
receipt_id: impl Into<String>,
finalized_at: u64,
tool_server: impl Into<String>,
tool_name: impl Into<String>,
capability_id: impl Into<String>,
amount: MonetaryAmount,
content_hash: impl Into<String>,
policy_hash: impl Into<String>,
) -> Self
pub fn new( receipt_id: impl Into<String>, finalized_at: u64, tool_server: impl Into<String>, tool_name: impl Into<String>, capability_id: impl Into<String>, amount: MonetaryAmount, content_hash: impl Into<String>, policy_hash: impl Into<String>, ) -> Self
Construct a fresh observation, stamping the canonical schema tag.
Sourcepub fn with_tenant(self, tenant_id: impl Into<String>) -> Self
pub fn with_tenant(self, tenant_id: impl Into<String>) -> Self
Attach a tenant identifier. Single-tenant deployments may leave this unset.
Sourcepub fn ordering_key(&self) -> (u64, &str)
pub fn ordering_key(&self) -> (u64, &str)
Return the deterministic sort key used by hook implementations.
Tuples sort lexicographically by (finalized_at, receipt_id).
Trait Implementations§
Source§impl Clone for SettlementObservation
impl Clone for SettlementObservation
Source§fn clone(&self) -> SettlementObservation
fn clone(&self) -> SettlementObservation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more