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 copy 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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request