pub struct RemoteCapsuleReceiver { /* private fields */ }Expand description
Implementations§
Source§impl RemoteCapsuleReceiver
impl RemoteCapsuleReceiver
Sourcepub fn new(
audit_log_path: Option<impl AsRef<Path>>,
threshold: Option<f64>,
) -> Self
pub fn new( audit_log_path: Option<impl AsRef<Path>>, threshold: Option<f64>, ) -> Self
Create a new receiver.
audit_log_path— ifSome, every decision is appended as a JSONL line to that file.threshold— override the defaultPROMOTE_THRESHOLD(0.70).
pub fn with_rate_limit_config( audit_log_path: Option<impl AsRef<Path>>, threshold: Option<f64>, rate_limit_config: PeerRateLimitConfig, ) -> Self
Sourcepub fn on_capsule_received(
&self,
capsule: &Capsule,
gene: &mut Gene,
) -> CapsuleDisposition
pub fn on_capsule_received( &self, capsule: &Capsule, gene: &mut Gene, ) -> CapsuleDisposition
Evaluate a received capsule and return the promotion decision.
Steps:
- Verify signature (placeholder — always passes until P3-02).
- Use the capsule’s own
confidencefield as the composite score. - If
score >= threshold: setgene.state = Promotedand returnCapsuleDisposition::Promoted. - Otherwise: return
CapsuleDisposition::Quarantined { reason: LowScore }. - Append an audit entry to
capsule_audit_log.jsonl.
The caller is responsible for persisting the promoted gene to a gene
store (e.g. GeneStore::upsert_gene). The returned CapsuleDisposition
carries the promoted gene_id so the caller can act accordingly.
pub fn on_signed_capsule_received( &self, peer_id: &str, public_key_hex: &str, envelope: &EvolutionEnvelope, capsule: &Capsule, gene: &mut Gene, ) -> Result<CapsuleDisposition, RejectionReason>
pub fn network_audit_trail(&self) -> Vec<NetworkAuditEntry>
Sourcepub fn audit_trail(&self) -> Vec<(String, CapsuleDisposition)>
pub fn audit_trail(&self) -> Vec<(String, CapsuleDisposition)>
All in-memory audit entries accumulated so far.
Sourcepub fn audit_count(&self) -> usize
pub fn audit_count(&self) -> usize
Number of audit entries recorded.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RemoteCapsuleReceiver
impl RefUnwindSafe for RemoteCapsuleReceiver
impl Send for RemoteCapsuleReceiver
impl Sync for RemoteCapsuleReceiver
impl Unpin for RemoteCapsuleReceiver
impl UnsafeUnpin for RemoteCapsuleReceiver
impl UnwindSafe for RemoteCapsuleReceiver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more