Skip to main content

PostgresOutboxSettings

Struct PostgresOutboxSettings 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§schema: String

The 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: bool

When 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: Duration

Applied 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_deadnever 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

Source

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");
Source

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);
Source

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));
Source

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

Source§

fn clone(&self) -> PostgresOutboxSettings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PostgresOutboxSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PostgresOutboxSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PostgresOutboxSettings

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PostgresOutboxSettings

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more