Struct BitmapIndex

Source
pub struct BitmapIndex<T: Bitmap, U: BitValue>
where <U as Shr<usize>>::Output: TransmuteToUsize, for<'a> &'a T: BitAnd<&'a T, Output = T>,
{ /* private fields */ }
Expand description

BitmapIndex struct that requires a bitmap that implement Bitmap trait and a type that implement BitValue trait.

Implementations§

Source§

impl<T: Bitmap, U: BitValue> BitmapIndex<T, U>
where <U as Shr<usize>>::Output: TransmuteToUsize, for<'a> &'a T: BitAnd<&'a T, Output = T>,

Source

pub fn create( bitmap_index_path: &Path, build_options: BuildOptions, ) -> Result<Self, Error>

Return a BitmapIndex in storage mode and create a folder with bitmap_index_path path. The created folder contain 3 files that represent a BitmapIndex:

  1. A file with ‘mbidx’ extension that represent BitmapIndex meta data.
  2. A file with ‘obidx’ extension that represent all offsets of all bitmaps chunks.
  3. A file with ‘dbix’ extension that represent all bitmaps chunks content.
Source

pub fn open(dir_path: &Path) -> Result<Self, Error>

Open a BitmapIndex in storage mode previusly created.

Source

pub fn new_storage_idx(dir_path: &Path) -> Result<StorageIdx, Error>

Source

pub fn new(build_options: BuildOptions) -> Result<Self, Error>

Return a new BitmapIndex in memory mode. A BitmapIndex created with this function works in memory and can’t be serialized.

Source

pub fn push_value(&mut self, value: U) -> Result<(), Error>

Insert (in append) a value into the index. If BitmapIndex is opened in storage mode and the chunk is full, automatically the chunk is flushed on persistent memory.

Source

pub fn flush_chunk(&mut self) -> Result<(), Error>

Serialize current bitmaps chunk. Error occur if BitmapIndex is opened in memory mode.

Source

pub fn push_values(&mut self, values: &[U]) -> Result<(), Error>

Insert (in append) values into the index.

Source

pub fn run_query( &mut self, value: U, start_index: Option<u64>, end_index: Option<u64>, ) -> Result<Vec<u64>, Error>

Return a Vec<u64> that contains all indexes of values pushed in BitmapIndex equal to value. The parameters start_index and end_index are optional and if specified define the range where query is runned.

Source

pub fn run_query_from_storage_idx( storage_idx: &mut StorageIdx, value: U, start_index: Option<u64>, end_index: Option<u64>, meta_data: Option<MetaData>, ) -> Result<Vec<u64>, Error>

Return a Vec<u64> that contains all indexes of values pushed in a storage BitmapIndex equal to value. Differently from run_query method allow to run a query only on the chunks already flushed of a BitmapIndex.

Auto Trait Implementations§

§

impl<T, U> Freeze for BitmapIndex<T, U>

§

impl<T, U> RefUnwindSafe for BitmapIndex<T, U>

§

impl<T, U> Send for BitmapIndex<T, U>
where U: Send, T: Send,

§

impl<T, U> Sync for BitmapIndex<T, U>
where U: Sync, T: Sync,

§

impl<T, U> Unpin for BitmapIndex<T, U>
where U: Unpin, T: Unpin,

§

impl<T, U> UnwindSafe for BitmapIndex<T, U>
where U: UnwindSafe, T: UnwindSafe,

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.