[][src]Trait lsh_rs::HashTables

pub trait HashTables {
    fn new(
        n_hash_tables: usize,
        only_index_storage: bool,
        db_path: &str
    ) -> Result<Box<Self>>;
fn put(
        &mut self,
        hash: Hash,
        d: &DataPointSlice,
        hash_table: usize
    ) -> Result<u32>;
fn query_bucket(
        &self,
        hash: &Hash,
        hash_table: usize
    ) -> Result<HashSet<u32>>;
fn get_unique_hash_int(&self) -> FnvHashSet<HashPrimitive>; fn delete(
        &mut self,
        _hash: &Hash,
        _d: &DataPointSlice,
        _hash_table: usize
    ) -> Result<()> { ... }
fn update_by_idx(
        &mut self,
        _old_hash: &Hash,
        _new_hash: Hash,
        _idx: u32,
        _hash_table: usize
    ) -> Result<()> { ... }
fn idx_to_datapoint(&self, _idx: u32) -> Result<&DataPoint> { ... }
fn increase_storage(&mut self, _size: usize) { ... }
fn describe(&self) -> Result<String> { ... }
fn store_hashers<H: VecHash + Serialize>(
        &mut self,
        _hashers: &[H]
    ) -> Result<()> { ... }
fn load_hashers<H: VecHash + DeserializeOwned>(&self) -> Result<Vec<H>> { ... } }

Hashtable consisting of L Hash tables.

Required methods

fn new(
    n_hash_tables: usize,
    only_index_storage: bool,
    db_path: &str
) -> Result<Box<Self>>

fn put(
    &mut self,
    hash: Hash,
    d: &DataPointSlice,
    hash_table: usize
) -> Result<u32>

Arguments

  • hash - hashed vector.
  • d - Vector to store in the buckets.
  • hash_table - Number of the hash_table to store the vector. Ranging from 0 to L.

fn query_bucket(&self, hash: &Hash, hash_table: usize) -> Result<HashSet<u32>>

Query the whole bucket

fn get_unique_hash_int(&self) -> FnvHashSet<HashPrimitive>

Loading content...

Provided methods

fn delete(
    &mut self,
    _hash: &Hash,
    _d: &DataPointSlice,
    _hash_table: usize
) -> Result<()>

fn update_by_idx(
    &mut self,
    _old_hash: &Hash,
    _new_hash: Hash,
    _idx: u32,
    _hash_table: usize
) -> Result<()>

fn idx_to_datapoint(&self, _idx: u32) -> Result<&DataPoint>

fn increase_storage(&mut self, _size: usize)

fn describe(&self) -> Result<String>

fn store_hashers<H: VecHash + Serialize>(
    &mut self,
    _hashers: &[H]
) -> Result<()>

fn load_hashers<H: VecHash + DeserializeOwned>(&self) -> Result<Vec<H>>

Loading content...

Implementors

impl HashTables for MemoryTable[src]

fn delete(
    &mut self,
    hash: &Hash,
    d: &DataPointSlice,
    hash_table: usize
) -> Result<()>
[src]

Expensive operation we need to do a linear search over all datapoints

fn query_bucket(&self, hash: &Hash, hash_table: usize) -> Result<HashSet<u32>>[src]

Query the whole bucket

impl HashTables for SqlTable[src]

fn query_bucket(&self, hash: &Hash, hash_table: usize) -> Result<HashSet<u32>>[src]

Query the whole bucket

impl HashTables for SqlTableMem[src]

fn put(
    &mut self,
    hash: Hash,
    d: &DataPointSlice,
    hash_table: usize
) -> Result<u32>
[src]

Arguments

  • hash - hashed vector.
  • d - Vector to store in the buckets.
  • hash_table - Number of the hash_table to store the vector. Ranging from 0 to L.

fn query_bucket(&self, hash: &Hash, hash_table: usize) -> Result<HashSet<u32>>[src]

Query the whole bucket

Loading content...