pub struct TemporalIndex { /* private fields */ }Expand description
Temporal index using a BTreeMap for efficient range queries on timestamps.
Implementations§
Source§impl TemporalIndex
impl TemporalIndex
Sourcepub fn range(&self, start: Timestamp, end: Timestamp) -> Vec<MemoryId>
pub fn range(&self, start: Timestamp, end: Timestamp) -> Vec<MemoryId>
Query memories within [start, end] inclusive.
Sourcepub fn latest(&self, n: usize) -> Vec<MemoryId>
pub fn latest(&self, n: usize) -> Vec<MemoryId>
Get the n most recent memories (by timestamp, descending).
Sourcepub fn remove(&self, id: MemoryId, timestamp: Timestamp)
pub fn remove(&self, id: MemoryId, timestamp: Timestamp)
Remove a memory by id and its known timestamp.
Sourcepub fn remove_by_id(&self, id: MemoryId)
pub fn remove_by_id(&self, id: MemoryId)
Remove a memory by id (looks up the timestamp internally).
Sourcepub fn get_timestamp(&self, id: MemoryId) -> Option<Timestamp>
pub fn get_timestamp(&self, id: MemoryId) -> Option<Timestamp>
Get the timestamp for a given memory id (if indexed).
Source§impl TemporalIndex
impl TemporalIndex
Sourcepub fn save(&self, path: &Path) -> MenteResult<()>
pub fn save(&self, path: &Path) -> MenteResult<()>
Save the temporal index to a JSON file.
Sourcepub fn load(path: &Path) -> MenteResult<Self>
pub fn load(path: &Path) -> MenteResult<Self>
Load the temporal index from a JSON file.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TemporalIndex
impl !RefUnwindSafe for TemporalIndex
impl Send for TemporalIndex
impl Sync for TemporalIndex
impl Unpin for TemporalIndex
impl UnsafeUnpin for TemporalIndex
impl UnwindSafe for TemporalIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more