pub trait ReloadableTargetTls:
Send
+ Sync
+ 'static {
type Material: Send + Sync + 'static;
// Required methods
fn tls_input_set(&self) -> TargetTlsInputSet;
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 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;
// Provided method
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 { ... }
}Expand description
Protocol that each TLS-capable target implements so the reload coordinator can drive certificate hot-reload without knowing the target’s internals.
The target is responsible for:
- Declaring which TLS files it reads (
tls_input_set) - Building a new client/pool/connector from current files (
build_tls_material) - Atomically swapping the active connection state (
apply_tls_material)
The coordinator is responsible for:
- Deciding when to check
- Detecting whether material changed
- Ensuring safety (validate, build-then-apply, fallback on failure)
Required Associated Types§
Required Methods§
Sourcefn tls_input_set(&self) -> TargetTlsInputSet
fn tls_input_set(&self) -> TargetTlsInputSet
Returns the TLS file paths this target reads.
Sourcefn 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.
Called by the coordinator on the reload path only — never on the send hot path.
Sourcefn 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.
On success, the target’s internal state must point to the new material. On failure, the target must keep its current state unchanged.
Provided Methods§
Sourcefn 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(()).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<E> ReloadableTargetTls for AMQPTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for AMQP targets.
impl<E> ReloadableTargetTls for AMQPTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for AMQP targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the connection without restarting.
type Material = AMQPConnection
Source§impl<E> ReloadableTargetTls for KafkaTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Kafka targets.
impl<E> ReloadableTargetTls for KafkaTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Kafka targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the producer without restarting.
type Material = Arc<AsyncProducer>
Source§impl<E> ReloadableTargetTls for MQTTTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for MQTT targets.
impl<E> ReloadableTargetTls for MQTTTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for MQTT targets.
MQTT uses MqttOptions as the material type. The coordinator rebuilds
MqttOptions on TLS file changes, and apply_tls_material stores it in
an ArcSwap for use on the next reconnection. The running event loop is
not interrupted; rumqttc handles reconnection internally.
type Material = MqttOptions
Source§impl<E> ReloadableTargetTls for MySqlTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for MySQL targets.
impl<E> ReloadableTargetTls for MySqlTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for MySQL targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the connection pool without restarting.
Source§impl<E> ReloadableTargetTls for NATSTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for NATS targets.
impl<E> ReloadableTargetTls for NATSTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for NATS targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the NATS client without restarting.
Source§impl<E> ReloadableTargetTls for PostgresTarget<E>where
E: PluginEvent,
impl<E> ReloadableTargetTls for PostgresTarget<E>where
E: PluginEvent,
Source§impl<E> ReloadableTargetTls for PulsarTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Pulsar targets.
impl<E> ReloadableTargetTls for PulsarTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Pulsar targets.
Pulsar only uses a CA certificate (no client cert/key). The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the client without restarting.
type Material = Pulsar<TokioExecutor>
Source§impl<E> ReloadableTargetTls for RedisTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Redis targets.
impl<E> ReloadableTargetTls for RedisTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Redis targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the Redis client without restarting.
Source§impl<E> ReloadableTargetTls for WebhookTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Webhook targets.
impl<E> ReloadableTargetTls for WebhookTarget<E>where
E: PluginEvent,
Coordinated TLS hot-reload implementation for Webhook targets.
The coordinator calls these methods on a background poll loop to detect TLS file changes and rebuild the HTTP client without restarting.