Skip to main content

Stream

Trait Stream 

Source
pub trait Stream<A>
where A: Arguments,
{ type Output: 'static; // Required methods fn search(&mut self, args: A::Search<'_>) -> Result<Self::Output>; fn insert(&mut self, args: A::Insert<'_>) -> Result<Self::Output>; fn replace(&mut self, args: A::Replace<'_>) -> Result<Self::Output>; fn delete(&mut self, args: A::Delete<'_>) -> Result<Self::Output>; fn maintain(&mut self, args: A::Maintain<'_>) -> Result<Self::Output>; fn needs_maintenance(&mut self) -> bool; }
Expand description

A streaming interface for performing dynamic (streaming) operations on an index.

Streams are characterized by five operations:

  • search: This is, after all, the whole reason for building an index.
  • insert: Insert new points into the index that do not already exist.
  • replace: Replace existing points in the index with new data.
  • delete: Remove points from the index.
  • maintain: Perform maintenance operations on the index. Examples may include fully removing deleted points from internal references.

This trait is parameterized by an Arguments proxy trait, which defines the argument types for each of the operations. The motivation here is to allow nesting of Stream implementations that progressively modify or adapt the arguments for better code reuse. An example of this is [crate::streaming::executors::bigann::WithData], which is a stream layer adapting the raw ranges used by [crate::streaming::executors::bigann::RunBook] into actual data slices.

Runners for Streams use the Executor trait to invoke the stream operations in a structured way.

Required Associated Types§

Source

type Output: 'static

Output type for all operations. The 'static is to allow results to be aggregated in Any for type erasure in higher level Executors.

Required Methods§

Source

fn search(&mut self, args: A::Search<'_>) -> Result<Self::Output>

Perform a search operation.

Source

fn insert(&mut self, args: A::Insert<'_>) -> Result<Self::Output>

Perform an insert operation.

Source

fn replace(&mut self, args: A::Replace<'_>) -> Result<Self::Output>

Perform a replace operation.

Source

fn delete(&mut self, args: A::Delete<'_>) -> Result<Self::Output>

Perform a delete operation.

Source

fn maintain(&mut self, args: A::Maintain<'_>) -> Result<Self::Output>

Perform a maintain operation.

Source

fn needs_maintenance(&mut self) -> bool

Indicate whether or not maintenance is needed. Executor implementations are responsible periodically checking this.

Implementors§

Source§

impl<A, T> Stream<A> for AnyStream<'_, T>
where A: Arguments, T: Stream<A>,

Source§

type Output = Box<dyn Any>