#[non_exhaustive]pub struct PostgresOutboxSettings {
pub schema: String,
pub enqueue_sets_search_path: bool,
pub statement_timeout: Duration,
}Expand description
What is provider-specific about the outbox. Everything portable lives in
reliar_outbox::OutboxSettings.
Built from Self::default plus builder methods, never a struct literal (#[non_exhaustive]
so a new field never breaks a caller outside this crate):
use reliar_store_postgres::PostgresOutboxSettings;
use std::time::Duration;
let settings = PostgresOutboxSettings::default()
.schema("orders")
.enqueue_sets_search_path(true)
.statement_timeout(Duration::from_secs(2));
assert_eq!(settings.schema, "orders");
assert!(settings.enqueue_sets_search_path);
assert_eq!(settings.statement_timeout, Duration::from_secs(2));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.schema: StringThe schema PostgresOutboxStore::new/connect verifies outbox resolves to, and the
same default crate::MigrateOptions::schema uses. The two SHALL agree — if migrate()
used a different schema, outbox is absent here and construction fails with
crate::PostgresStoreError::NotMigrated or, if a same-named table exists elsewhere on
the path, crate::PostgresStoreError::SchemaResolution. SCHEMA. Default "reliar".
enqueue_sets_search_path: boolWhen true, enqueue wraps its INSERT in a transaction-local
set_config('search_path', …, true) and restores the caller’s previous value
afterward — for hosts that can change neither the connection URL nor the role. Costs
three extra statements per enqueue, which is why it defaults to false.
ENQUEUE_SETS_SEARCH_PATH.
statement_timeout: DurationApplied as SET LOCAL statement_timeout inside the short transaction Reliar opens for
every statement it issues on its own pool — acquire, complete, fail, release,
extend_lease, stats, purge (each of its three statements), list_dead,
retry_dead, purge_dead — never the caller’s enqueue transaction, which is the
caller’s own to bound. Duration::ZERO (the default) issues nothing and inherits the
server/role setting; a non-zero value costs a BEGIN/SET LOCAL/statement(s)/COMMIT
round trip on every call. STATEMENT_TIMEOUT_MS.
Implementations§
Source§impl PostgresOutboxSettings
impl PostgresOutboxSettings
Sourcepub fn schema(self, schema: impl Into<String>) -> Self
pub fn schema(self, schema: impl Into<String>) -> Self
Sets Self::schema.
use reliar_store_postgres::PostgresOutboxSettings;
let settings = PostgresOutboxSettings::default().schema("orders");
assert_eq!(settings.schema, "orders");Sourcepub const fn enqueue_sets_search_path(self, enabled: bool) -> Self
pub const fn enqueue_sets_search_path(self, enabled: bool) -> Self
Sets Self::enqueue_sets_search_path.
use reliar_store_postgres::PostgresOutboxSettings;
let settings = PostgresOutboxSettings::default().enqueue_sets_search_path(true);
assert!(settings.enqueue_sets_search_path);Sourcepub const fn statement_timeout(self, timeout: Duration) -> Self
pub const fn statement_timeout(self, timeout: Duration) -> Self
Sets Self::statement_timeout.
use reliar_store_postgres::PostgresOutboxSettings;
use std::time::Duration;
let settings = PostgresOutboxSettings::default()
.statement_timeout(Duration::from_millis(500));
assert_eq!(settings.statement_timeout, Duration::from_millis(500));Sourcepub fn from_env(prefix: &str) -> Result<Self, SettingsError>
pub fn from_env(prefix: &str) -> Result<Self, SettingsError>
Opt-in. Starts from Self::default, overrides only the variables present under
prefix, and returns Err for a present-but-unparseable or out-of-range value — never
a silent fallback to the default.
use reliar_store_postgres::PostgresOutboxSettings;
// SAFETY: doctests run single-threaded per binary; no other code reads this var.
unsafe { std::env::set_var("EXAMPLE_OUTBOX_SCHEMA", "orders") };
let settings = PostgresOutboxSettings::from_env("EXAMPLE_OUTBOX_")?;
assert_eq!(settings.schema, "orders");§Errors
Returns SettingsError::Parse for a present variable that cannot be parsed as its
declared type.
Trait Implementations§
Source§impl Clone for PostgresOutboxSettings
impl Clone for PostgresOutboxSettings
Source§fn clone(&self) -> PostgresOutboxSettings
fn clone(&self) -> PostgresOutboxSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostgresOutboxSettings
impl Debug for PostgresOutboxSettings
Source§impl Default for PostgresOutboxSettings
impl Default for PostgresOutboxSettings
Source§impl<'de> Deserialize<'de> for PostgresOutboxSettingswhere
PostgresOutboxSettings: Default,
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PostgresOutboxSettingswhere
PostgresOutboxSettings: Default,
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PostgresOutboxSettings
impl RefUnwindSafe for PostgresOutboxSettings
impl Send for PostgresOutboxSettings
impl Sync for PostgresOutboxSettings
impl Unpin for PostgresOutboxSettings
impl UnsafeUnpin for PostgresOutboxSettings
impl UnwindSafe for PostgresOutboxSettings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more