pub trait Target<E>:
Send
+ Sync
+ 'staticwhere
E: PluginEvent,{
Show 16 methods
// Required methods
fn id(&self) -> TargetID;
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 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 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 close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store(
&self,
) -> Option<&(dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send + Sync)>;
fn clone_dyn(&self) -> Box<dyn Target<E> + Send + Sync>;
fn is_enabled(&self) -> bool;
// Provided methods
fn name(&self) -> String { ... }
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TargetHealth> + 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 { ... }
fn failed_store(&self) -> Option<&dyn FailedEventStore> { ... }
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 init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn delivery_snapshot(&self) -> TargetDeliverySnapshot { ... }
fn record_final_failure(&self) { ... }
}Expand description
Trait for notification targets
Required Methods§
Sourcefn 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
Sourcefn 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).
A target whose Self::store returns Some must only persist the event
here; network delivery belongs to its replay worker. Runtime lifecycle
handoff drains these durable enqueues while allowing a direct network
send to finish against a detached target.
Sourcefn 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.
Sourcefn 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
Sourcefn 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)
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Check if the target is enabled
Provided Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
The default is no capability, so a target that never parks a terminal entry runs no failed-store maintenance and reports zero failed-store depth.
Sourcefn 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.
Sourcefn 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.
Sourcefn delivery_snapshot(&self) -> TargetDeliverySnapshot
fn delivery_snapshot(&self) -> TargetDeliverySnapshot
Returns a read-only delivery snapshot for metrics collection.
Sourcefn record_final_failure(&self)
fn record_final_failure(&self)
Records a final, non-retryable delivery failure for metrics collection.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".