pub struct ConfidenceLedger { /* private fields */ }Expand description
Validated append-only confidence participant content.
The validated rows are private so callers cannot invalidate them after
construction. Borrow them through Self::assessments and Self::inputs,
or consume both collections with Self::into_parts.
use graphforge_knowledge::ConfidenceLedger;
let mut ledger = ConfidenceLedger::default();
ledger.assessments.clear();Implementations§
Source§impl ConfidenceLedger
impl ConfidenceLedger
Sourcepub fn assessments(&self) -> &[ConfidenceAssessment]
pub fn assessments(&self) -> &[ConfidenceAssessment]
Borrow assessments in deterministic order.
Sourcepub fn inputs(&self) -> &[ConfidenceInput]
pub fn inputs(&self) -> &[ConfidenceInput]
Borrow normalized inputs in deterministic order.
Sourcepub fn into_parts(self) -> (Vec<ConfidenceAssessment>, Vec<ConfidenceInput>)
pub fn into_parts(self) -> (Vec<ConfidenceAssessment>, Vec<ConfidenceInput>)
Consume the ledger and return its assessment and input rows.
Sourcepub fn new(
assessments: Vec<ConfidenceAssessment>,
inputs: Vec<ConfidenceInput>,
) -> Result<Self, KnowledgeError>
pub fn new( assessments: Vec<ConfidenceAssessment>, inputs: Vec<ConfidenceInput>, ) -> Result<Self, KnowledgeError>
Validate, sort, and construct confidence content.
Sourcepub fn explicit(
confidence_uuid: Uuid,
assertion_uuid: Uuid,
value: f64,
provenance_uuid: Uuid,
recorded_at_micros: i64,
) -> Result<Self, KnowledgeError>
pub fn explicit( confidence_uuid: Uuid, assertion_uuid: Uuid, value: f64, provenance_uuid: Uuid, recorded_at_micros: i64, ) -> Result<Self, KnowledgeError>
Evaluate and stage an explicit assessment.
Sourcepub fn conservative_min(
&self,
confidence_uuid: Uuid,
assertion_uuid: Uuid,
requested: Vec<Uuid>,
provenance_uuid: Uuid,
recorded_at_micros: i64,
) -> Result<Self, KnowledgeError>
pub fn conservative_min( &self, confidence_uuid: Uuid, assertion_uuid: Uuid, requested: Vec<Uuid>, provenance_uuid: Uuid, recorded_at_micros: i64, ) -> Result<Self, KnowledgeError>
Evaluate conservative_min@1 and persist the normalized requested-input snapshot.
Sourcepub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
pub fn merge(&self, staged: &Self) -> Result<Self, KnowledgeError>
Merge staged content idempotently.
Sourcepub fn assessment_fingerprint(
&self,
confidence_uuid: Uuid,
) -> Result<[u8; 32], KnowledgeError>
pub fn assessment_fingerprint( &self, confidence_uuid: Uuid, ) -> Result<[u8; 32], KnowledgeError>
Canonical assessment fingerprint over policy, normalized value, and input snapshot.
Sourcepub fn assessment_fingerprints(
&self,
) -> Result<Vec<(Uuid, [u8; 32])>, KnowledgeError>
pub fn assessment_fingerprints( &self, ) -> Result<Vec<(Uuid, [u8; 32])>, KnowledgeError>
Compute assessment fingerprints in one pass over assessments and grouped inputs.
Sourcepub fn assessment_batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn assessment_batch(&self) -> Result<RecordBatch, KnowledgeError>
Build the authoritative assessment Arrow batch.
Sourcepub fn input_batch(&self) -> Result<RecordBatch, KnowledgeError>
pub fn input_batch(&self) -> Result<RecordBatch, KnowledgeError>
Build the authoritative input Arrow batch.
Sourcepub fn from_batches(
assessment_batches: &[RecordBatch],
input_batches: &[RecordBatch],
) -> Result<Self, KnowledgeError>
pub fn from_batches( assessment_batches: &[RecordBatch], input_batches: &[RecordBatch], ) -> Result<Self, KnowledgeError>
Decode authoritative Arrow batches and re-run every invariant.