pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub fn new<P: AsRef<Path>>(db_path: P) -> SqlResult<Self>
pub fn in_memory() -> SqlResult<Self>
pub fn save_position(&self, position_data: &PositionData) -> SqlResult<i64>
pub fn load_position(&self, fen: &str) -> SqlResult<Option<PositionData>>
pub fn load_all_positions(&self) -> SqlResult<Vec<PositionData>>
pub fn save_lsh_config(&self, config: &LSHTableData) -> SqlResult<()>
pub fn load_lsh_config(&self) -> SqlResult<Option<LSHTableData>>
pub fn save_lsh_bucket( &self, table_id: usize, bucket_hash: &str, position_id: i64, ) -> SqlResult<()>
pub fn load_lsh_buckets( &self, table_id: usize, bucket_hash: &str, ) -> SqlResult<Vec<i64>>
pub fn clear_lsh_buckets(&self) -> SqlResult<()>
pub fn get_position_count(&self) -> SqlResult<i64>
pub fn vacuum(&self) -> SqlResult<()>
pub fn save_manifold_model( &self, input_dim: usize, compressed_dim: usize, model_weights: &[u8], training_metadata: Option<&[u8]>, ) -> SqlResult<()>
pub fn load_manifold_model( &self, ) -> SqlResult<Option<(usize, usize, Vec<u8>, Vec<u8>)>>
pub fn get_position_by_id(&self, id: i64) -> SqlResult<Option<PositionData>>
Sourcepub fn save_positions_batch(
&self,
positions: &[PositionData],
) -> SqlResult<usize>
pub fn save_positions_batch( &self, positions: &[PositionData], ) -> SqlResult<usize>
Save multiple positions in a single transaction for much better performance
Sourcepub fn load_positions_batch(
&self,
limit: usize,
offset: usize,
) -> SqlResult<Vec<PositionData>>
pub fn load_positions_batch( &self, limit: usize, offset: usize, ) -> SqlResult<Vec<PositionData>>
Load positions in batches for better memory efficiency
Sourcepub fn get_total_position_count(&self) -> SqlResult<usize>
pub fn get_total_position_count(&self) -> SqlResult<usize>
Get the total count of positions in the database (as usize)
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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