Skip to main content

BrowsingMemory

Struct BrowsingMemory 

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

The user-facing browsing memory: open (unflushed) segments per owner plus the loaded trace corpus, with the design-pass reads over both.

Implementations§

Source§

impl BrowsingMemory

Source

pub fn new(segment_size: usize) -> Self

An empty memory with the given segment size (events per flushed trace).

Source

pub async fn load(store: &mut dyn Store, segment_size: usize) -> Result<Self>

Load every stored trace from the Store into a memory.

Source

pub fn record_traversal(&mut self, owner: &str, event: TraceEvent) -> bool

Append a traversal to owner’s open segment. Returns true when the segment has reached the configured size and wants a flush.

Source

pub async fn flush( &mut self, store: &mut dyn Store, now_ms: u64, ) -> Result<Vec<ManifestId>>

Flush every non-empty open segment as a stored trace. Returns the new manifest ids.

Source

pub fn adopt(&mut self, trace: BrowsingTrace)

Adopt an already-built trace into the in-memory corpus without persisting it (projection and import outputs that the caller saves — or not — on its own schedule).

Source

pub fn recent_corridor(&self, n: usize) -> Vec<TraceEvent>

The recent corridor: the last n traversals, returned in chronological order — the path that led here.

Source

pub fn nodes_visited_in_window( &self, start_ms: u64, end_ms: u64, ) -> Vec<PageRef>

Pages visited in [start_ms, end_ms], chronological, deduplicated by URL (first-seen title wins).

Source

pub fn co_occurrence(&self, a: &str, b: &str) -> u32

How often a and b were traversed together: the count of direct traversals between them, in either direction. (Definition kept deliberately narrow and edge-shaped so it cannot drift from node-lineage’s aggregated edge view; broader togetherness measures are a consumer’s fold.)

Source

pub fn traces(&self) -> impl Iterator<Item = &BrowsingTrace>

The loaded + adopted traces, oldest first.

Source

pub async fn apply_quota( &mut self, store: &mut dyn Store, keep_n: usize, ) -> Result<usize>

Keep the keep_n most recent stored traces and delete the manifests of older ones (blob bytes await the explicit GC pass). Adopted unsaved traces are untouched — there is nothing stored to age out. Returns how many manifests were deleted.

Source

pub async fn forget_url( &mut self, store: &mut dyn Store, url: &str, ) -> Result<usize>

Forget every trace mentioning url (as either end of any event): delete its stored manifest and drop it from the loaded corpus and any open segment. Returns how many traces were forgotten. The eidetic-search index is rebuilt from this corpus per query, so a forgotten trace also leaves the index — a forget that left the index behind would not be a forget. (Capture plan C4.)

Trait Implementations§

Source§

impl Clone for BrowsingMemory

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more