Skip to main content

ResolutionMemory

Struct ResolutionMemory 

Source
pub struct ResolutionMemory { /* private fields */ }
Expand description

Previously seen conflict resolutions, keyed by the conflict triple.

Implementations§

Source§

impl ResolutionMemory

Source

pub fn new() -> Self

An empty memory: every lookup misses, the queue behaves as before.

Source

pub fn len(&self) -> usize

Number of remembered resolutions.

Source

pub fn is_empty(&self) -> bool

Whether nothing has been remembered.

Source

pub fn key(base: &str, left: &str, right: &str) -> String

The conflict’s identity: the hash of the canonical serialization of the (base, left, right) triple, spelled as the TreeEntry::Conflict those addresses came from. Reusing the persisted shape’s bytes means the key inherits invariant 3’s canonicalization for free and cannot drift from the store’s own identity for the same conflict.

Contents are addressed with default chunker params; a resolution recorded under different params keys differently and simply misses — the memory is an optimization, a miss re-conflicts.

Source

pub fn from_log(log: &dyn OpLog, store: &dyn ChunkStore) -> Self

Builds the memory by walking log for head-moving ops whose commit carries a resolves link, and reading both sides from store. Anything the store cannot supply is skipped — an incomplete memory only means fewer recalls.

Source

pub fn recall(&self, base: &str, left: &str, right: &str) -> Option<&str>

The remembered resolution for this triple, if any.

Trait Implementations§

Source§

impl Debug for ResolutionMemory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResolutionMemory

Source§

fn default() -> ResolutionMemory

Returns the “default value” for a type. Read more

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.