pub struct SqliteStore { /* private fields */ }Expand description
SQLite-backed storage backend for Prolly Trees.
This store persists content-addressed nodes in a single SQLite table and supports atomic batch operations through transactions.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, SqliteStoreError>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, SqliteStoreError>
Open or create a SQLite database at the given path with default config.
Sourcepub fn open_with_config<P: AsRef<Path>>(
path: P,
config: SqliteStoreConfig,
) -> Result<Self, SqliteStoreError>
pub fn open_with_config<P: AsRef<Path>>( path: P, config: SqliteStoreConfig, ) -> Result<Self, SqliteStoreError>
Open or create a SQLite database with custom configuration.
Sourcepub fn open_existing<P: AsRef<Path>>(path: P) -> Result<Self, SqliteStoreError>
pub fn open_existing<P: AsRef<Path>>(path: P) -> Result<Self, SqliteStoreError>
Open an existing SQLite database with default runtime configuration.
Unlike Self::open, this never creates the database file and does not
execute schema DDL. Callers must validate the required schema before
using this path.
Sourcepub fn open_existing_with_config<P: AsRef<Path>>(
path: P,
config: SqliteStoreConfig,
) -> Result<Self, SqliteStoreError>
pub fn open_existing_with_config<P: AsRef<Path>>( path: P, config: SqliteStoreConfig, ) -> Result<Self, SqliteStoreError>
Open an existing database with explicit runtime configuration.
Sourcepub fn open_existing_verified<P, F>(
path: P,
verifier: F,
) -> Result<Self, SqliteStoreError>
pub fn open_existing_verified<P, F>( path: P, verifier: F, ) -> Result<Self, SqliteStoreError>
Open an existing database and verify SQLite’s actual main-file handle before executing any pragma, schema statement, or other SQL.
Sourcepub fn open_existing_verified_with_config<P, F>(
path: P,
config: SqliteStoreConfig,
verifier: F,
) -> Result<Self, SqliteStoreError>
pub fn open_existing_verified_with_config<P, F>( path: P, config: SqliteStoreConfig, verifier: F, ) -> Result<Self, SqliteStoreError>
Open and verify an existing database with explicit runtime tuning.
Sourcepub fn open_in_memory() -> Result<Self, SqliteStoreError>
pub fn open_in_memory() -> Result<Self, SqliteStoreError>
Create an in-memory SQLite store.
Sourcepub fn reader_connection_count(&self) -> usize
pub fn reader_connection_count(&self) -> usize
Number of read-only connections available for concurrent reads.
Sourcepub fn metrics(&self) -> Result<SqliteStoreMetrics, SqliteStoreError>
pub fn metrics(&self) -> Result<SqliteStoreMetrics, SqliteStoreError>
Return adapter and SQLite pager counters without resetting them.
Sourcepub fn checkpoint(
&self,
mode: SqliteCheckpointMode,
) -> Result<SqliteCheckpointStats, SqliteStoreError>
pub fn checkpoint( &self, mode: SqliteCheckpointMode, ) -> Result<SqliteCheckpointStats, SqliteStoreError>
Run an explicit WAL checkpoint and return SQLite’s frame counters.
Sourcepub fn storage_stats(&self) -> Result<SqliteStorageStats, SqliteStoreError>
pub fn storage_stats(&self) -> Result<SqliteStorageStats, SqliteStoreError>
Return database size, freelist, and WAL allocation statistics.
Sourcepub fn backup_to<P: AsRef<Path>>(&self, path: P) -> Result<(), SqliteStoreError>
pub fn backup_to<P: AsRef<Path>>(&self, path: P) -> Result<(), SqliteStoreError>
Create a consistent online backup using SQLite’s backup API.
Sourcepub fn compact(&self) -> Result<(), SqliteStoreError>
pub fn compact(&self) -> Result<(), SqliteStoreError>
Rebuild the database to reclaim free pages and reduce fragmentation. Callers should quiesce application traffic before invoking this method.
Sourcepub fn optimize(&self) -> Result<(), SqliteStoreError>
pub fn optimize(&self) -> Result<(), SqliteStoreError>
Ask SQLite to perform bounded planner and connection maintenance.
Sourcepub fn quick_check(&self) -> Result<(), SqliteStoreError>
pub fn quick_check(&self) -> Result<(), SqliteStoreError>
Run SQLite’s fast structural consistency check.
Trait Implementations§
Source§impl ManifestStore for SqliteStore
impl ManifestStore for SqliteStore
Source§type Error = SqliteStoreError
type Error = SqliteStoreError
Source§fn get_root(&self, name: &[u8]) -> Result<Option<RootManifest>, Self::Error>
fn get_root(&self, name: &[u8]) -> Result<Option<RootManifest>, Self::Error>
Source§fn put_root(
&self,
name: &[u8],
manifest: &RootManifest,
) -> Result<(), Self::Error>
fn put_root( &self, name: &[u8], manifest: &RootManifest, ) -> Result<(), Self::Error>
Source§fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
Source§fn compare_and_swap_root(
&self,
name: &[u8],
expected: Option<&RootManifest>,
new: Option<&RootManifest>,
) -> Result<ManifestUpdate, Self::Error>
fn compare_and_swap_root( &self, name: &[u8], expected: Option<&RootManifest>, new: Option<&RootManifest>, ) -> Result<ManifestUpdate, Self::Error>
expected. Read moreSource§impl ManifestStoreScan for SqliteStore
impl ManifestStoreScan for SqliteStore
Source§fn list_roots(&self) -> Result<Vec<NamedRootManifest>, Self::Error>
fn list_roots(&self) -> Result<Vec<NamedRootManifest>, Self::Error>
Source§impl NodeStoreScan for SqliteStore
impl NodeStoreScan for SqliteStore
Source§impl Store for SqliteStore
impl Store for SqliteStore
Source§type Error = SqliteStoreError
type Error = SqliteStoreError
Source§fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
Source§fn batch(&self, ops: &[BatchOp<'_>]) -> Result<(), Self::Error>
fn batch(&self, ops: &[BatchOp<'_>]) -> Result<(), Self::Error>
Source§fn batch_get(
&self,
keys: &[&[u8]],
) -> Result<HashMap<Vec<u8>, Vec<u8>>, Self::Error>
fn batch_get( &self, keys: &[&[u8]], ) -> Result<HashMap<Vec<u8>, Vec<u8>>, Self::Error>
Source§fn batch_get_ordered(
&self,
keys: &[&[u8]],
) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
fn batch_get_ordered( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
Source§fn batch_get_ordered_unique(
&self,
keys: &[&[u8]],
) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
fn batch_get_ordered_unique( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, Self::Error>
Source§fn prefers_batch_reads(&self) -> bool
fn prefers_batch_reads(&self) -> bool
Source§fn batch_put(&self, entries: &[(&[u8], &[u8])]) -> Result<(), Self::Error>
fn batch_put(&self, entries: &[(&[u8], &[u8])]) -> Result<(), Self::Error>
Source§fn supports_hints(&self) -> bool
fn supports_hints(&self) -> bool
Source§fn get_hint(
&self,
namespace: &[u8],
key: &[u8],
) -> Result<Option<Vec<u8>>, Self::Error>
fn get_hint( &self, namespace: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, Self::Error>
Source§fn put_hint(
&self,
namespace: &[u8],
key: &[u8],
value: &[u8],
) -> Result<(), Self::Error>
fn put_hint( &self, namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error>
Source§fn batch_put_with_hint(
&self,
entries: &[(&[u8], &[u8])],
namespace: &[u8],
key: &[u8],
value: &[u8],
) -> Result<(), Self::Error>
fn batch_put_with_hint( &self, entries: &[(&[u8], &[u8])], namespace: &[u8], key: &[u8], value: &[u8], ) -> Result<(), Self::Error>
Source§fn publish_nodes(
&self,
publication: NodePublication<'_>,
) -> Result<(), Self::Error>
fn publish_nodes( &self, publication: NodePublication<'_>, ) -> Result<(), Self::Error>
Source§fn prefers_rightmost_path_hints(&self) -> bool
fn prefers_rightmost_path_hints(&self) -> bool
Source§impl TransactionalStore for SqliteStore
impl TransactionalStore for SqliteStore
Source§fn supports_transactions(&self) -> bool
fn supports_transactions(&self) -> bool
Source§fn commit_transaction(
&self,
node_writes: &[TransactionNodeWrite],
root_conditions: &[RootCondition],
root_writes: &[RootWrite],
) -> Result<TransactionUpdate, Error>
fn commit_transaction( &self, node_writes: &[TransactionNodeWrite], root_conditions: &[RootCondition], root_writes: &[RootWrite], ) -> Result<TransactionUpdate, Error>
Auto Trait Implementations§
impl !Freeze for SqliteStore
impl !RefUnwindSafe for SqliteStore
impl !UnwindSafe for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl UnsafeUnpin for SqliteStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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