Inline Dependencies
For inline operators, you can add dependencies
section to include external language specific libraries. The dependencies are defined in the dependencies
section of the operator definition. The dependencies are resolved by the SDF engine and made available to the operator at runtime.
External Dependencies
For Rust based operators, the dependencies are based on Rust Cargo package manager similar to dependencies
section in Cargo.
For example, following variations are possible:
Adding a crate with version:
- operator: map
dependencies:
- name: regex
version: "1.10.0"
Adding a git repository:
- operator: map
dependencies:
- name: regex
git: "https://github.com/rust-lang/regex"
tag: "1.10.0"
Adding multiple dependencies:
- operator: map
dependencies:
- name: regex
version: "1.10.0"
- name: iter_tools
version: "0.15.0"
Once the dependencies are added, inline operator can use the dependencies in the run
section as in the typical Rust code as example below which tries to validate the year format.
- operator: filter
dependencies:
- name: regex
version: "1.10.0"
run: |
fn validate_year(input: String) -> Result<bool> {
use std::sync::OnceLock;
use regex::Regex;
static REGEX: OnceLock<Regex> = OnceLock::new();
let re = REGEX.get_or_init(|| Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap());
Ok(re.is_match(&input))
}
InfinyOn Dependencies
The Stateful Dataflow requires external dependencies to invoke an HTTP call-out and other operations.