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,
impl<E> PostgresTarget<E>where
E: PluginEvent,
Trait Implementations§
Source§impl<E> ReloadableTargetTls for PostgresTarget<E>where
E: PluginEvent,
impl<E> ReloadableTargetTls for PostgresTarget<E>where
E: PluginEvent,
Source§fn tls_input_set(&self) -> TargetTlsInputSet
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,
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,
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,
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,
impl<E> Target<E> for PostgresTarget<E>where
E: PluginEvent,
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,
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,
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,
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,
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)>
fn store( &self, ) -> Option<&(dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send + Sync)>
Returns the store associated with the target (if any)
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,
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
fn is_enabled(&self) -> bool
Check if the target is enabled
Source§fn delivery_snapshot(&self) -> TargetDeliverySnapshot
fn delivery_snapshot(&self) -> TargetDeliverySnapshot
Returns a read-only delivery snapshot for metrics collection.
Source§fn record_final_failure(&self)
fn record_final_failure(&self)
Records a final, non-retryable delivery failure for metrics collection.
Source§fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TargetHealth> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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>
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,
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>where
PhantomData<E>: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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