Skip to main content

AntiEntropyLoop

Struct AntiEntropyLoop 

Source
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: u64

Probe interval in seconds. Default: 30.

Implementations§

Source§

impl AntiEntropyLoop

Source

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’s HttpReplicationServer (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/.
Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V