Skip to main content

PostgresTarget

Struct PostgresTarget 

Source
pub struct PostgresTarget<E>
where E: PluginEvent,
{ /* private fields */ }
Expand description

PostgreSQL notification target.

Holds a cloneable deadpool_postgres::Pool rather than a Mutex<Option<Pool>> so that clone_box does not duplicate connection state. The optional QueueStore provides at-least-once delivery semantics consistent with the other built-in targets.

When tls_adapter is Some, the target participates in the coordinated TLS hot-reload system driven by TlsReloadAdapter, and the inline fingerprint check in send_body is skipped. When None, the legacy inline fingerprint check is used as a fallback.

Implementations§

Source§

impl<E> PostgresTarget<E>
where E: PluginEvent,

Source

pub fn clone_box(&self) -> Box<dyn Target<E> + Send + Sync>

Source

pub fn new(id: String, args: PostgresArgs) -> Result<Self, TargetError>

Trait Implementations§

Source§

impl<E> ReloadableTargetTls for PostgresTarget<E>
where E: PluginEvent,

Source§

type Material = Pool<Manager>

The rebuilt connection/client/pool object this target uses.
Source§

fn tls_input_set(&self) -> TargetTlsInputSet

Returns the TLS file paths this target reads.
Source§

fn build_tls_material<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Material, TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Build a fresh TLS material object from current files on disk. Read more
Source§

fn apply_tls_material<'life0, 'async_trait>( &'life0 self, _generation: TargetTlsGeneration, material: Arc<Self::Material>, _mode: ReloadApplyMode, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Atomically apply new TLS material, replacing the current active connection state. Read more
Source§

fn validate_tls_files<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optional pre-check: validate that TLS files on disk are self-consistent (cert/key pair parseable, CA loadable) before attempting build_tls_material. Default implementation returns Ok(()).
Source§

impl<E> Target<E> for PostgresTarget<E>
where E: PluginEvent,

Source§

fn id(&self) -> TargetID

Returns the ID of the target
Source§

fn is_active<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks if the target is active and reachable
Source§

fn save<'life0, 'async_trait>( &'life0 self, event: Arc<EntityTarget<E>>, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Saves an event (either sends it immediately or stores it for later). Read more
Source§

fn send_raw_from_store<'life0, 'async_trait>( &'life0 self, key: Key, body: Vec<u8>, meta: QueuedPayloadMeta, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends an event from the store using the queued raw body and metadata.
Source§

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the target and releases resources
Source§

fn store( &self, ) -> Option<&(dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send + Sync)>

Returns the store associated with the target (if any)
Source§

fn clone_dyn(&self) -> Box<dyn Target<E> + Send + Sync>

Returns the type of the target
Source§

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the target, such as establishing a connection, etc.
Source§

fn is_enabled(&self) -> bool

Check if the target is enabled
Source§

fn delivery_snapshot(&self) -> TargetDeliverySnapshot

Returns a read-only delivery snapshot for metrics collection.
Source§

fn record_final_failure(&self)

Records a final, non-retryable delivery failure for metrics collection.
Source§

fn name(&self) -> String

Returns the name of the target
Source§

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TargetHealth> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a credential-free, machine-readable health result.
Source§

fn send_from_store<'life0, 'async_trait>( &'life0 self, key: Key, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends an event from the store.
Source§

fn failed_store(&self) -> Option<&dyn FailedEventStore>

Returns the failed-events store capability when the target records terminal failures. Read more
Source§

fn handle_terminal_failure<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _store: &'life1 (dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send), _key: &'life2 Key, _error: &'life3 TargetError, _retry_count: u32, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Moves a terminally failed entry to the target’s failed-events store, returning true when the entry was handled. A target without a terminal-failure store declines the move and the entry stays live.

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for PostgresTarget<E>

§

impl<E> !UnwindSafe for PostgresTarget<E>

§

impl<E> Freeze for PostgresTarget<E>
where PhantomData<E>: Freeze,

§

impl<E> Send for PostgresTarget<E>
where PhantomData<E>: Send,

§

impl<E> Sync for PostgresTarget<E>
where PhantomData<E>: Sync,

§

impl<E> Unpin for PostgresTarget<E>
where PhantomData<E>: Unpin,

§

impl<E> UnsafeUnpin for PostgresTarget<E>

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromExt for T

Source§

fn from_<T>(t: T) -> Self
where Self: From<T>,

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> IntoExt for T

Source§

fn into_<T>(self) -> T
where Self: Into<T>,

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> TryFromExt for T

Source§

fn try_from_<T>(t: T) -> Result<Self, Self::Error>
where Self: TryFrom<T>,

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> TryIntoExt for T

Source§

fn try_into_<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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