vector/config/
provider.rs

1use enum_dispatch::enum_dispatch;
2use vector_lib::configurable::NamedComponent;
3
4use crate::{providers::BuildResult, signal};
5
6/// Generalized interface for constructing a configuration from a provider.
7#[enum_dispatch]
8pub trait ProviderConfig: NamedComponent + core::fmt::Debug + Send + Sync {
9    /// Builds a configuration.
10    ///
11    /// Access to signal handling is given so that the provider can control reloading and shutdown
12    /// behavior as necessary.
13    ///
14    /// If a configuration is built successfully, `Ok(...)` is returned containing the
15    /// configuration.
16    ///
17    /// # Errors
18    ///
19    /// If an error occurs while building a configuration, an error variant explaining the
20    /// issue is returned.
21    async fn build(&mut self, signal_handler: &mut signal::SignalHandler) -> BuildResult;
22}