SqlTable

Struct SqlTable 

Source
pub struct SqlTable<N, K>
where N: Numeric, K: Integer,
{ pub conn: Connection, pub committed: Cell<bool>, /* private fields */ }
Expand description

Sqlite backend for LSH.

State will be save during sessions. The database is automatically loaded if LSH can find the database file (defaults to ./lsh.db3.

Fields§

§conn: Connection§committed: Cell<bool>

Implementations§

Source§

impl<N, K> SqlTable<N, K>
where N: Numeric, K: Integer,

Source

pub fn init_from_conn( n_hash_tables: usize, only_index_storage: bool, conn: Connection, ) -> Result<Self>

Source

pub fn commit(&self) -> Result<()>

Source

pub fn init_transaction(&self) -> Result<()>

Source

pub fn to_mem(&mut self) -> Result<()>

Source

pub fn index_hash(&self) -> Result<()>

Trait Implementations§

Source§

impl<N, K> HashTables<N, K> for SqlTable<N, K>
where N: Numeric, K: Integer,

Source§

fn query_bucket(&self, hash: &[K], hash_table: usize) -> Result<FnvHashSet<u32>>

Query the whole bucket

Source§

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

Source§

fn put(&mut self, hash: Vec<K>, _d: &[N], hash_table: usize) -> Result<u32>

Arguments Read more
Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn delete(&mut self, _hash: &[K], _d: &[N], _hash_table: usize) -> Result<()>

Source§

fn update_by_idx( &mut self, _old_hash: &[K], _new_hash: Vec<K>, _idx: u32, _hash_table: usize, ) -> Result<()>

Source§

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

Source§

fn increase_storage(&mut self, _size: usize)

Auto Trait Implementations§

§

impl<N, K> !Freeze for SqlTable<N, K>

§

impl<N, K> !RefUnwindSafe for SqlTable<N, K>

§

impl<N, K> Send for SqlTable<N, K>

§

impl<N, K> !Sync for SqlTable<N, K>

§

impl<N, K> Unpin for SqlTable<N, K>
where N: Unpin, K: Unpin,

§

impl<N, K> !UnwindSafe for SqlTable<N, K>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V