pub struct TemporalIndex { /* private fields */ }Expand description
Sorted list of (created_at, node_id) pairs for efficient time range queries.
Implementations§
Source§impl TemporalIndex
impl TemporalIndex
Sourcepub fn range(&self, start: u64, end: u64) -> Vec<u64>
pub fn range(&self, start: u64, end: u64) -> Vec<u64>
Get all node IDs created within a time range (inclusive).
Sourcepub fn after(&self, timestamp: u64) -> Vec<u64>
pub fn after(&self, timestamp: u64) -> Vec<u64>
Get all node IDs created after a timestamp (exclusive).
Sourcepub fn before(&self, timestamp: u64) -> Vec<u64>
pub fn before(&self, timestamp: u64) -> Vec<u64>
Get all node IDs created before a timestamp (exclusive).
Sourcepub fn most_recent(&self, n: usize) -> Vec<u64>
pub fn most_recent(&self, n: usize) -> Vec<u64>
Get the most recent N node IDs.
Sourcepub fn rebuild(&mut self, nodes: &[CognitiveEvent])
pub fn rebuild(&mut self, nodes: &[CognitiveEvent])
Rebuild the entire index from a slice of nodes.
Sourcepub fn add_node(&mut self, event: &CognitiveEvent)
pub fn add_node(&mut self, event: &CognitiveEvent)
Incrementally add a new node.
Sourcepub fn remove_node(&mut self, id: u64, created_at: u64)
pub fn remove_node(&mut self, id: u64, created_at: u64)
Remove a node from the index.
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