1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Set reconciliation algorithms
//!
//! Data structures for efficiently synchronizing sets between nodes
//! by transmitting only their differences.
//!
//! # Use Cases
//! - Distributed database synchronization
//! - P2P network state reconciliation
//! - Blockchain synchronization
//! - CDN cache invalidation
//! - Distributed file systems
//!
//! # Available Algorithms
//!
//! - [`RatelessIBLT`] - Invertible Bloom Lookup Table for set reconciliation
//!
//! # Theory
//!
//! Set reconciliation protocols allow two parties with sets A and B to:
//! 1. Exchange compact summaries of their sets
//! 2. Compute the symmetric difference (A △ B)
//! 3. Synchronize by transmitting only the differences
//!
//! This is more efficient than naive approaches when the set difference
//! is small relative to the set size.
//!
//! # Example
//! ```
//! use sketch_oxide::reconciliation::RatelessIBLT;
//! use sketch_oxide::common::Reconcilable;
//!
//! let mut alice = RatelessIBLT::new(100, 32).unwrap();
//! let mut bob = RatelessIBLT::new(100, 32).unwrap();
//!
//! alice.insert(b"shared1", b"value1").unwrap();
//! alice.insert(b"shared2", b"value2").unwrap();
//! alice.insert(b"alice_only", b"alice_value").unwrap();
//!
//! bob.insert(b"shared1", b"value1").unwrap();
//! bob.insert(b"shared2", b"value2").unwrap();
//! bob.insert(b"bob_only", b"bob_value").unwrap();
//!
//! // Compute difference
//! let mut diff = alice.clone();
//! diff.subtract(&bob).unwrap();
//!
//! let set_diff = diff.decode().unwrap();
//! // set_diff.to_insert contains items Bob needs
//! // set_diff.to_remove contains items Bob should remove
//! ```
pub use ;