pub struct BitmapIndex<T: Bitmap, U: BitValue>{ /* 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>
impl<T: Bitmap, U: BitValue> BitmapIndex<T, U>
Sourcepub fn create(
bitmap_index_path: &Path,
build_options: BuildOptions,
) -> Result<Self, Error>
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
:
- A file with ‘mbidx’ extension that represent
BitmapIndex
meta data. - A file with ‘obidx’ extension that represent all offsets of all bitmaps chunks.
- A file with ‘dbix’ extension that represent all bitmaps chunks content.
Sourcepub fn open(dir_path: &Path) -> Result<Self, Error>
pub fn open(dir_path: &Path) -> Result<Self, Error>
Open a BitmapIndex
in storage mode previusly created.
pub fn new_storage_idx(dir_path: &Path) -> Result<StorageIdx, Error>
Sourcepub fn new(build_options: BuildOptions) -> Result<Self, Error>
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.
Sourcepub fn push_value(&mut self, value: U) -> Result<(), Error>
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.
Sourcepub fn flush_chunk(&mut self) -> Result<(), Error>
pub fn flush_chunk(&mut self) -> Result<(), Error>
Serialize current bitmaps chunk. Error occur if BitmapIndex
is opened in memory mode.
Sourcepub fn push_values(&mut self, values: &[U]) -> Result<(), Error>
pub fn push_values(&mut self, values: &[U]) -> Result<(), Error>
Insert (in append) values into the index.
Sourcepub fn run_query(
&mut self,
value: U,
start_index: Option<u64>,
end_index: Option<u64>,
) -> Result<Vec<u64>, Error>
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.
Sourcepub 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>
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
.