pub struct Merger<'t, D = DefaultDriver, A = DefaultAbortSignal> { /* private fields */ }
Expand description
A two-way merger that produces a complete merged tree from a complete local tree and a complete remote tree with changes since the last sync.
This is ported almost directly from iOS. On iOS, the ThreeWayMerger
takes
a complete “mirror” tree with the server state after the last sync, and two
incomplete trees with local and remote changes to the mirror: “local” and
“mirror”, respectively. Overlaying buffer onto mirror yields the current
server tree; overlaying local onto mirror yields the complete local tree.
Dogear doesn’t store the shared parent for changed items, so we can only do two-way merges. Our local tree is the union of iOS’s mirror and local, and our remote tree is the union of iOS’s mirror and buffer.
Unlike iOS, Dogear doesn’t distinguish between structure and value changes.
The needs_merge
flag notes that a bookmark changed, but not how. This
means we might detect conflicts, and revert changes on one side, for cases
that iOS can merge cleanly.
Fortunately, most of our users don’t organize their bookmarks into deeply nested hierarchies, or make conflicting changes on multiple devices simultaneously. A simpler two-way tree merge strikes a good balance between correctness and complexity.
Implementations
sourceimpl<'t> Merger<'t, DefaultDriver, DefaultAbortSignal>
impl<'t> Merger<'t, DefaultDriver, DefaultAbortSignal>
sourceimpl<'t, D: Driver, A: AbortSignal> Merger<'t, D, A>
impl<'t, D: Driver, A: AbortSignal> Merger<'t, D, A>
Auto Trait Implementations
impl<'t, D, A> RefUnwindSafe for Merger<'t, D, A> where
A: RefUnwindSafe,
D: RefUnwindSafe,
impl<'t, D, A> Send for Merger<'t, D, A> where
A: Sync,
D: Sync,
impl<'t, D, A> Sync for Merger<'t, D, A> where
A: Sync,
D: Sync,
impl<'t, D, A> Unpin for Merger<'t, D, A>
impl<'t, D, A> UnwindSafe for Merger<'t, D, A> where
A: RefUnwindSafe,
D: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more