pub struct SqliteEnvelopeStore { /* private fields */ }Expand description
Struct that offers access to a SQLite-based store of [Envelope]s.
The goal of this struct is to hide away all the complexity of dealing with the database for reading and writing envelopes.
Implementations§
Source§impl SqliteEnvelopeStore
impl SqliteEnvelopeStore
Sourcepub fn new(
partition_id: u8,
db: Pool<Sqlite>,
refresh_frequency: Duration,
) -> Self
pub fn new( partition_id: u8, db: Pool<Sqlite>, refresh_frequency: Duration, ) -> Self
Initializes the SqliteEnvelopeStore with a supplied [Pool].
Sourcepub async fn prepare(
partition_id: u8,
config: &Config,
) -> Result<SqliteEnvelopeStore, SqliteEnvelopeStoreError>
pub async fn prepare( partition_id: u8, config: &Config, ) -> Result<SqliteEnvelopeStore, SqliteEnvelopeStoreError>
Prepares the SqliteEnvelopeStore by running all the necessary migrations and preparing
the folders where data will be stored.
Sourcepub async fn insert_batch(
&mut self,
envelopes: DatabaseBatch,
) -> Result<(), SqliteEnvelopeStoreError>
pub async fn insert_batch( &mut self, envelopes: DatabaseBatch, ) -> Result<(), SqliteEnvelopeStoreError>
Inserts one or more envelopes into the database.
Sourcepub async fn delete_batch(
&mut self,
own_key: ProjectKey,
sampling_key: ProjectKey,
) -> Result<Option<DatabaseBatch>, SqliteEnvelopeStoreError>
pub async fn delete_batch( &mut self, own_key: ProjectKey, sampling_key: ProjectKey, ) -> Result<Option<DatabaseBatch>, SqliteEnvelopeStoreError>
Deletes and returns at most limit [Envelope]s from the database.
Sourcepub async fn project_key_pairs(
&self,
) -> Result<HashSet<ProjectKeyPair>, SqliteEnvelopeStoreError>
pub async fn project_key_pairs( &self, ) -> Result<HashSet<ProjectKeyPair>, SqliteEnvelopeStoreError>
Returns a set of project key pairs, representing all the unique combinations of
own_key and project_key that are found in the database.
Sourcepub async fn total_count(&self) -> Result<u64, SqliteEnvelopeStoreError>
pub async fn total_count(&self) -> Result<u64, SqliteEnvelopeStoreError>
Returns the total count of envelopes stored in the database.
Trait Implementations§
Source§impl Clone for SqliteEnvelopeStore
impl Clone for SqliteEnvelopeStore
Source§fn clone(&self) -> SqliteEnvelopeStore
fn clone(&self) -> SqliteEnvelopeStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqliteEnvelopeStore
impl !RefUnwindSafe for SqliteEnvelopeStore
impl Send for SqliteEnvelopeStore
impl Sync for SqliteEnvelopeStore
impl Unpin for SqliteEnvelopeStore
impl !UnwindSafe for SqliteEnvelopeStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].