vector_tap/
topology.rs

1use std::collections::{HashMap, HashSet};
2use tokio::sync::watch;
3use vector_common::config::ComponentKey;
4use vector_common::id::Inputs;
5use vector_core::config::OutputId;
6use vector_core::fanout;
7
8/// A tappable output consisting of an output ID and associated metadata
9#[derive(Debug, Clone, Hash, PartialEq, Eq)]
10pub struct TapOutput {
11    pub output_id: OutputId,
12    pub component_kind: &'static str,
13    pub component_type: String,
14}
15
16/// Resources used by the `tap` API to monitor component inputs and outputs,
17/// updated alongside the topology
18#[derive(Debug, Default, Clone)]
19pub struct TapResource {
20    // Outputs and their corresponding Fanout control
21    pub outputs: HashMap<TapOutput, fanout::ControlChannel>,
22    // Components (transforms, sinks) and their corresponding inputs
23    pub inputs: HashMap<ComponentKey, Inputs<OutputId>>,
24    // Source component keys used to warn against invalid pattern matches
25    pub source_keys: Vec<String>,
26    // Sink component keys used to warn against invalid pattern matches
27    pub sink_keys: Vec<String>,
28    // Components removed on a reload (used to drop TapSinks)
29    pub removals: HashSet<ComponentKey>,
30}
31
32// Watcher types for topology changes.
33pub type WatchTx = watch::Sender<TapResource>;
34pub type WatchRx = watch::Receiver<TapResource>;