waggle_convergence.rs
rust
1// Evidence Mesh (mutuus-waggle-mesh)
2pub struct EvidenceMesh<D: DomainSpace> { /* internal */ }
3
4impl<D: DomainSpace> EvidenceMesh<D> {
5 pub fn new(config: MeshConfig) -> Self;
6
7 // Source management
8 pub fn register_source(&mut self, source: Source);
9 pub fn sources_mut(&mut self) -> &mut HashMap<SourceId, Source>;
10
11 // Evidence operations
12 pub fn deposit(
13 &mut self,
14 source: SourceId,
15 content: D::Content,
16 modality: D::Modality,
17 initial_strength: f32,
18 ) -> EvidenceId;
19 pub fn reinforce(&mut self, evidence_id: EvidenceId, source: &SourceId) -> bool;
20
21 // Structural reads
22 pub fn convergence(&self) -> ConvergenceReport<D>;
23 pub fn tension(&self) -> TensionReport;
24 pub fn commitment_readiness(&self) -> CommitmentReport<D>;
25
26 // Introspection
27 pub fn len(&self) -> usize;
28 pub fn is_empty(&self) -> bool;
29 pub fn current_tick(&self) -> Tick;
30 pub fn evidence_iter(&self) -> impl Iterator<Item = &Evidence<D>>;
31 pub fn edge_iter(&self) -> impl Iterator<Item = (&EvidenceId, &EvidenceEdge)>;
32
33 // Maintenance
34 pub fn tick(&mut self) -> TickReport;
35}
36
37// DomainSpace trait — consumer implements this
38pub trait DomainSpace: Clone + Debug {
39 type Content: Clone + Debug;
40 type Modality: Clone + Debug + Eq + Hash;
41 type Direction: Clone + Debug + Eq + Hash;
42
43 fn agrees(a: &Self::Content, b: &Self::Content) -> bool;
44 fn contradicts(a: &Self::Content, b: &Self::Content) -> bool;
45 fn direction(content: &Self::Content) -> Self::Direction;
46}
47