| Crates.io | hydro2-basic-operators |
| lib.rs | hydro2-basic-operators |
| version | 0.1.0 |
| created_at | 2025-02-28 06:02:54.374157+00 |
| updated_at | 2025-02-28 06:02:54.374157+00 |
| description | A collection of fundamental operators for the hydro2 network ecosystem. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1572492 |
| size | 132,304 |
This crate supplies a collection of basic operator implementations for use with the hydro2 ecosystem. Each operator is labeled with an opcode and implements a coherent, asynchronous execute method. Common tasks include:
They are all defined under a common trait system (via #[derive(Operator)] and related macros), and each is thoroughly tested with straightforward Rust tests.
DoubleToTriTwoGenericsOp<T,U>) allowing flexible usage with integer and floating‐point types.FailingOperator deliberately produce errors to help test how your scheduling or execution engine deals with operator failures.Below is a minimal usage showing how an operator might be instantiated and tested:
#[tokio::test]
pub async fn test_add_op_in_a_network() -> Result<(), hydro2_3p::NetworkError> {
use hydro2_basic_operators::AddOp;
// Suppose we want to create an AddOp that always adds 10
let add_op = AddOp::new(10);
// Typically, you'd embed this operator into a node in a network,
// but we can unit-test it standalone:
let input = [Some(&AddOpIO::Input0(5)), None, None, None];
let mut outputs = [None, None, None, None];
add_op.execute(input, &mut outputs).await?;
assert_eq!(outputs[0], Some(AddOpIO::Output0(15)));
Ok(())
}
SingleToTriOp, DoubleOutOp).Merge2Op).AddOp, MultiplyOp, IncrementOperator, etc.hydro2These operators are designed to be used in a hydro2_network DAG, orchestrated by the hydro2_async_scheduler or similar frameworks. They each conform to the Operator trait, enabling dynamic scheduling and hooking into upstream/downstream data flows.
tracing crate for detailed operator‐level logs.Distributed under the OGPv1 License (see ogp-license-text crate for more details).
Developed on GitHub at:
https://github.com/klebs6/klebs-general