Skip to main content

InMemorySnapshotStore

Struct InMemorySnapshotStore 

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

In-memory SnapshotStore backed by lru. Per-path history is a short ring of full-file versions (oldest dropped first); per-session path tracking is LRU-bounded so cold paths age out automatically.

Recording byte-identical content again refreshes recency and reuses the existing tag (read fusion); recording new content unshifts a fresh version onto the front of the path history.

Implementations§

Source§

impl InMemorySnapshotStore

Source

pub fn new() -> Self

Build a store with the default limits (30 paths × 4 versions × 64 MiB).

Source

pub fn with_options(opts: InMemorySnapshotStoreOptions) -> Self

Build a store with custom limits.

Trait Implementations§

Source§

impl Debug for InMemorySnapshotStore

Source§

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

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

impl Default for InMemorySnapshotStore

Source§

fn default() -> Self

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

impl SnapshotStore for InMemorySnapshotStore

Source§

fn head(&self, path: &str) -> Option<Snapshot>

Most-recently recorded version for path, or None if none.
Source§

fn by_hash(&self, path: &str, hash: &str) -> Option<Snapshot>

Recorded version for path whose tag equals hash, or None.
Source§

fn record( &self, path: &str, full_text: &str, seen_lines: Option<&[u32]>, ) -> String

Record the full normalized text of path and return its content tag. seen_lines (optional) are the 1-indexed lines the producer displayed; they merge into Snapshot::seen_lines across reads of identical text.
Source§

fn record_seen_lines(&self, path: &str, hash: &str, lines: &[u32])

Merge lines into the Snapshot::seen_lines of the version whose tag equals hash. No-op when no such version is retained.
Source§

fn invalidate(&self, path: &str)

Drop the version history for a single path.
Source§

fn clear(&self)

Drop every version history.

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.