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_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_in_memory() -> Result<Self, SqliteStoreError>
pub fn open_in_memory() -> Result<Self, SqliteStoreError>
Create an in-memory SQLite store.
Trait Implementations§
Source§impl ManifestStore for SqliteStore
impl ManifestStore for SqliteStore
Source§type Error = SqliteStoreError
type Error = SqliteStoreError
Error type for manifest operations.
Source§fn get_root(&self, name: &[u8]) -> Result<Option<RootManifest>, Self::Error>
fn get_root(&self, name: &[u8]) -> Result<Option<RootManifest>, Self::Error>
Load a named root manifest.
Source§fn put_root(
&self,
name: &[u8],
manifest: &RootManifest,
) -> Result<(), Self::Error>
fn put_root( &self, name: &[u8], manifest: &RootManifest, ) -> Result<(), Self::Error>
Unconditionally insert or replace a named root manifest.
Source§fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
Delete a named root manifest. Deleting a missing name is not an 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>
Atomically update a named root if the current manifest matches
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>
List all durable named root manifests.
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
Error type for storage operations
Source§fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Self::Error>
Store key-value pair Read more
Source§fn batch(&self, ops: &[BatchOp<'_>]) -> Result<(), Self::Error>
fn batch(&self, ops: &[BatchOp<'_>]) -> Result<(), Self::Error>
Batch write operations (atomic if supported by backend) Read more
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>
Retrieve multiple keys in a single operation Read more
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>
Retrieve multiple keys in a single operation with order preservation Read more
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>
Retrieve unique keys in input order. Read more
Source§fn batch_put(&self, entries: &[(&[u8], &[u8])]) -> Result<(), Self::Error>
fn batch_put(&self, entries: &[(&[u8], &[u8])]) -> Result<(), Self::Error>
Store multiple key-value pairs in a single operation Read more
Source§fn supports_hints(&self) -> bool
fn supports_hints(&self) -> bool
Whether this store persists performance hints.
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>
Retrieve an optional performance hint for a logical namespace and key. Read more
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>
Persist an optional performance hint for a logical namespace and key. Read more
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>
Store content-addressed nodes and one hint atomically when supported.
Get immutable shared bytes without requiring the engine to copy an
already-retained cache value. Stores that cannot retain values may use
the default owned-read adapter.
Retrieve unique keys in order as retained immutable byte buffers.
Whether shared reads return an already-retained immutable allocation.
Source§fn prefers_batch_reads(&self) -> bool
fn prefers_batch_reads(&self) -> bool
Whether this store has an efficient batched-read implementation. Read more
Source§impl TransactionalStore for SqliteStore
impl TransactionalStore for SqliteStore
Source§fn supports_transactions(&self) -> bool
fn supports_transactions(&self) -> bool
Whether this backend can atomically commit staged nodes and roots.
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>
Atomically validate root conditions, write nodes, and apply root writes.
Auto Trait Implementations§
impl !Freeze for SqliteStore
impl RefUnwindSafe for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl UnsafeUnpin for SqliteStore
impl UnwindSafe 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
Mutably borrows from an owned value. Read more
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>
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