Trait vector::config::TransformConfig
source · pub trait TransformConfig: DynClone + NamedComponent + Debug + Send + Sync + Serialize + Deserialize {
// Required methods
fn build<'life0, 'life1, 'async_trait>(
&'life0 self,
globals: &'life1 TransformContext,
) -> Pin<Box<dyn Future<Output = Result<Transform>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn input(&self) -> Input;
fn outputs(
&self,
enrichment_tables: TableRegistry,
input_definitions: &[(OutputId, Definition)],
global_log_namespace: LogNamespace,
) -> Vec<TransformOutput>;
// Provided methods
fn validate(
&self,
_merged_definition: &Definition,
) -> Result<(), Vec<String>> { ... }
fn enable_concurrency(&self) -> bool { ... }
fn nestable(&self, _parents: &HashSet<&'static str>) -> bool { ... }
}
Expand description
Generalized interface for describing and building transform components.
Required Methods§
sourcefn build<'life0, 'life1, 'async_trait>(
&'life0 self,
globals: &'life1 TransformContext,
) -> Pin<Box<dyn Future<Output = Result<Transform>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn build<'life0, 'life1, 'async_trait>(
&'life0 self,
globals: &'life1 TransformContext,
) -> Pin<Box<dyn Future<Output = Result<Transform>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Builds the transform with the given context.
If the transform is built successfully, Ok(...)
is returned containing the transform.
§Errors
If an error occurs while building the transform, an error variant explaining the issue is returned.
sourcefn outputs(
&self,
enrichment_tables: TableRegistry,
input_definitions: &[(OutputId, Definition)],
global_log_namespace: LogNamespace,
) -> Vec<TransformOutput>
fn outputs( &self, enrichment_tables: TableRegistry, input_definitions: &[(OutputId, Definition)], global_log_namespace: LogNamespace, ) -> Vec<TransformOutput>
Gets the list of outputs exposed by this transform.
The provided merged_definition
can be used by transforms to understand the expected shape
of events flowing through the transform.
Provided Methods§
sourcefn validate(&self, _merged_definition: &Definition) -> Result<(), Vec<String>>
fn validate(&self, _merged_definition: &Definition) -> Result<(), Vec<String>>
Validates that the configuration of the transform is valid.
This would generally be where logical conditions were checked, such as ensuring a transform isn’t using a named output that matches a reserved output name, and so on.
§Errors
If validation does not succeed, an error variant containing a list of all validation errors is returned.
sourcefn enable_concurrency(&self) -> bool
fn enable_concurrency(&self) -> bool
Whether or not concurrency should be enabled for this transform.
When enabled, this transform may be run in parallel in order to attempt to maximize throughput for this node in the topology. Transforms should generally not run concurrently unless they are compute-heavy, as there is a cost/overhead associated with fanning out events to the parallel transform tasks.
sourcefn nestable(&self, _parents: &HashSet<&'static str>) -> bool
fn nestable(&self, _parents: &HashSet<&'static str>) -> bool
Whether or not this transform can be nested, given the types of transforms it would be nested within.
For some transforms, they can expand themselves into a subtopology of nested transforms. However, in order to prevent an infinite recursion of nested transforms, we may want to only allow one layer of “expansion”. Additionally, there may be known issues with a transform that is nested under another specific transform interacting poorly, or incorrectly.
This method allows a transform to report if it can or cannot function correctly if it is nested under transforms of a specific type, or if such nesting is fundamentally disallowed.