pub struct AntiEntropyLoop {
pub interval_secs: u64,
/* private fields */
}Expand description
Background pull-only anti-entropy loop.
Spawned via AntiEntropyLoop::start(). Probes the configured peer every interval_secs
seconds. If the Merkle roots differ, pulls all missing segments and applies LWW merges
via Engine::import_segment. Per-peer cursor makes progress durable across crashes.
Fields§
§interval_secs: u64Probe interval in seconds. Default: 30.
Implementations§
Source§impl AntiEntropyLoop
impl AntiEntropyLoop
Sourcepub fn new(
engine: Arc<Mutex<Engine>>,
peer_url: String,
peer_id: String,
db_path: PathBuf,
) -> Self
pub fn new( engine: Arc<Mutex<Engine>>, peer_url: String, peer_id: String, db_path: PathBuf, ) -> Self
Create a new anti-entropy loop.
engine— shared engine (Arc<Mutex>) for replication API access.peer_url— base URL of the remote peer’sHttpReplicationServer(e.g."http://host:8900").peer_id— unique identifier for the peer; used as the cursor file name.db_path— database directory path; cursor file is written under{db_path}/sync/.
Sourcepub fn with_remote_store(self, store: Arc<dyn RemoteStore>) -> Self
pub fn with_remote_store(self, store: Arc<dyn RemoteStore>) -> Self
Attach a RemoteStore backend. After each segment is successfully applied, the
loop will call remote_store.upload(hash, data). Upload failures are logged and
ignored — they do not abort the sync loop.
Sourcepub fn with_interval(self, secs: u64) -> Self
pub fn with_interval(self, secs: u64) -> Self
Override the probe interval (default: 30 seconds).
Useful in tests to reduce the time between anti-entropy cycles.
Sourcepub fn start(self) -> JoinHandle<()>
pub fn start(self) -> JoinHandle<()>
Spawn the anti-entropy loop in a background thread.
Returns the JoinHandle for the background thread. The thread runs until the
process exits.