pub struct SqlxStore { /* private fields */ }Expand description
The SQL message store: see the crate docs. Every clone is the same store.
Implementations§
Source§impl SqlxStore
impl SqlxStore
Sourcepub fn postgres(pool: PgPool) -> SqlxStore
pub fn postgres(pool: PgPool) -> SqlxStore
The store on a PostgreSQL pool (at least 2 connections), with the default settings.
Sourcepub fn mysql(pool: MySqlPool) -> SqlxStore
pub fn mysql(pool: MySqlPool) -> SqlxStore
The store on a MySQL pool (at least 2 connections), with the default settings.
Sourcepub fn with_settings(self, settings: SqlxSettings) -> SqlxStore
pub fn with_settings(self, settings: SqlxSettings) -> SqlxStore
The same store with settings (e.g. SqlxSettings::from_env).
Sourcepub fn settings(&self) -> &SqlxSettings
pub fn settings(&self) -> &SqlxSettings
The store’s settings.
Sourcepub async fn apply_schema(&self) -> Result<(), StoreError>
pub async fn apply_schema(&self) -> Result<(), StoreError>
Checks the server and applies schema version 1 unless the database has it: what
MessageStore::init_schema does.
Sourcepub async fn require_schema(&self) -> Result<(), StoreError>
pub async fn require_schema(&self) -> Result<(), StoreError>
For a service that applies the schema itself: checks the server, and fails unless the database has the schema version this library needs, or later.
Sourcepub async fn purge_expired(&self, config: &Config) -> Result<u64, StoreError>
pub async fn purge_expired(&self, config: &Config) -> Result<u64, StoreError>
Deletes what the retentions of config let go, the expired dead letters and the dispatch
leases that passed, in batches of 1000 (each its own transaction); how many rows went. The
background task of MessageStore::background runs it every
SqlxSettings::purge_interval.
Trait Implementations§
Source§impl MessageStore for SqlxStore
impl MessageStore for SqlxStore
Source§fn init_schema<'a>(
&'a self,
_config: &'a Config,
) -> BoxFuture<'a, Result<(), StoreError>>
fn init_schema<'a>( &'a self, _config: &'a Config, ) -> BoxFuture<'a, Result<(), StoreError>>
The server checked, then schema version 1 applied unless the database has it.
Source§fn check_schema(&self) -> BoxFuture<'_, Result<(), StoreError>>
fn check_schema(&self) -> BoxFuture<'_, Result<(), StoreError>>
The server checked, and the schema at version 1 or later.
Source§fn background(
&self,
config: &Config,
stop: CancellationToken,
) -> Option<BoxFuture<'static, ()>>
fn background( &self, config: &Config, stop: CancellationToken, ) -> Option<BoxFuture<'static, ()>>
The purge every SqlxSettings::purge_interval (none when it is zero).
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
mongo, postgres, mysql, memory), for logs and errors.Source§fn use_clock(&self, clock: Clock)
fn use_clock(&self, clock: Clock)
fn tx(&self) -> Arc<dyn TxProvider> ⓘ
fn outbox(&self) -> Arc<dyn OutboxStore> ⓘ
fn processed_events(&self) -> Arc<dyn ProcessedEventStore> ⓘ
fn dead_letters(&self) -> Arc<dyn DeadLetterStore> ⓘ
fn processor_control(&self) -> Arc<dyn ProcessorControlStore> ⓘ
fn external_calls(&self) -> Arc<dyn ExternalCallStore> ⓘ
fn sagas(&self) -> SagaStores
Auto Trait Implementations§
impl !RefUnwindSafe for SqlxStore
impl !UnwindSafe for SqlxStore
impl Forget for SqlxStore
impl Freeze for SqlxStore
impl Move for SqlxStore
impl Send for SqlxStore
impl Sync for SqlxStore
impl Unpin for SqlxStore
impl UnsafeUnpin for SqlxStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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 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>
T in a tonic::Request