saluki_core/components/destinations/
builder.rs

1use async_trait::async_trait;
2use memory_accounting::MemoryBounds;
3use saluki_error::GenericError;
4
5use super::Destination;
6use crate::{components::ComponentContext, data_model::event::EventType};
7
8/// A destination builder.
9///
10/// Destination builders are responsible for creating instances of [`Destination`]s, as well as describing high-level
11/// aspects of the built destination, such as the data types allowed for input events.
12#[async_trait]
13pub trait DestinationBuilder: MemoryBounds {
14    /// Event types allowed as input events to this destination.
15    fn input_event_type(&self) -> EventType;
16
17    /// Builds an instance of the destination.
18    ///
19    /// ## Errors
20    ///
21    /// If the destination cannot be built for any reason, an error is returned.
22    async fn build(&self, context: ComponentContext) -> Result<Box<dyn Destination + Send>, GenericError>;
23}