pub struct SqliteStorage { /* private fields */ }
Expand description
A Storage implementation based on an SQLite database.
Implementations§
Source§impl SqliteStorage
impl SqliteStorage
Sourcepub async fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub async fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Opens a new SQLite database in the given path.
If the database does not already exist it will be created.
use datacake_sqlite::SqliteStorage;
let storage = SqliteStorage::open("./data.db").await.expect("Create database");
Sourcepub async fn open_in_memory() -> Result<Self, Error>
pub async fn open_in_memory() -> Result<Self, Error>
Opens a new SQLite database in memory.
use datacake_sqlite::SqliteStorage;
let storage = SqliteStorage::open_in_memory().await.expect("Create database");
Sourcepub fn from_handle(handle: StorageHandle) -> Self
pub fn from_handle(handle: StorageHandle) -> Self
Creates a new SqliteStorage instances from an existing storage handle.
Sourcepub fn handle(&self) -> StorageHandle
pub fn handle(&self) -> StorageHandle
Creates a copy of the storage handle to be used in other sections of code which do not need to be distributed.
WARNING: Any changes made to this will not be reflected in the cluster, it is primarily only provided for ease of reading.
The table state_entries
is already created and reserved.
Trait Implementations§
Source§impl Storage for SqliteStorage
impl Storage for SqliteStorage
type Error = Error
type DocsIter = Box<dyn Iterator<Item = Document>>
type MetadataIter = Box<dyn Iterator<Item = (u64, HLCTimestamp, bool)>>
Source§fn get_keyspace_list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_keyspace_list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves all keyspace currently persisted.
Source§fn iter_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::MetadataIter, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn iter_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::MetadataIter, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves an iterator producing all values contained within the store. Read more
Source§fn remove_tombstones<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
keys: impl 'async_trait + Iterator<Item = Key> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_tombstones<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
keys: impl 'async_trait + Iterator<Item = Key> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a set of keys which are marked as tombstones store. Read more
Source§fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts or updates a document in the persistent store. Read more
Source§fn multi_put<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl 'async_trait + Iterator<Item = Document> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn multi_put<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl 'async_trait + Iterator<Item = Document> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts or updates a set of documents in the persistent store. Read more
Source§fn mark_as_tombstone<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_id: Key,
timestamp: HLCTimestamp,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_as_tombstone<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_id: Key,
timestamp: HLCTimestamp,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Marks a document in the store as a tombstone. Read more
Source§fn mark_many_as_tombstone<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl 'async_trait + Iterator<Item = DocumentMetadata> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_many_as_tombstone<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl 'async_trait + Iterator<Item = DocumentMetadata> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Marks a set of documents in the store as a tombstone. Read more
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_id: Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_id: Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves a single document belonging to a given keyspace from the store.
Source§fn multi_get<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_ids: impl 'async_trait + Iterator<Item = Key> + Send,
) -> Pin<Box<dyn Future<Output = Result<Self::DocsIter, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn multi_get<'life0, 'life1, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
doc_ids: impl 'async_trait + Iterator<Item = Key> + Send,
) -> Pin<Box<dyn Future<Output = Result<Self::DocsIter, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves a set of documents belonging to a given keyspace from the store. Read more
Source§fn put_with_ctx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
document: Document,
_ctx: Option<&'life2 PutContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn put_with_ctx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
document: Document,
_ctx: Option<&'life2 PutContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inserts or updates a document in the persistent store. Read more
Source§fn multi_put_with_ctx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl Iterator<Item = Document> + Send + 'async_trait,
_ctx: Option<&'life2 PutContext>,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn multi_put_with_ctx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keyspace: &'life1 str,
documents: impl Iterator<Item = Document> + Send + 'async_trait,
_ctx: Option<&'life2 PutContext>,
) -> Pin<Box<dyn Future<Output = Result<(), BulkMutationError<Self::Error>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inserts or updates a set of documents in the persistent store. Read more
Auto Trait Implementations§
impl Freeze for SqliteStorage
impl RefUnwindSafe for SqliteStorage
impl Send for SqliteStorage
impl Sync for SqliteStorage
impl Unpin for SqliteStorage
impl UnwindSafe for SqliteStorage
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.