https://github.com/elasticrash/orchestrator
A Step function like library for Rust
https://github.com/elasticrash/orchestrator
orchestration rust step-functions
Last synced: 9 days ago
JSON representation
A Step function like library for Rust
- Host: GitHub
- URL: https://github.com/elasticrash/orchestrator
- Owner: elasticrash
- Created: 2020-11-05T14:10:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T21:02:20.000Z (almost 2 years ago)
- Last Synced: 2025-03-30T13:04:26.344Z (28 days ago)
- Topics: orchestration, rust, step-functions
- Language: Rust
- Homepage:
- Size: 15.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Orchestration
The orchestration library is designed to streamline and manage complex workflows by providing a framework for orchestrating and sequencing functions in a controlled manner. It allows developers to define a series of state functions and execute them in a predefined order, passing data between each step. With the ability to handle various types, the library offers flexibility in processing different data structures.
### Improvements and changes:
* Enhanced type handling capabilities to accommodate a wider range of types.
* String Concatenation Example: The updated documentation now includes an example showcasing string concatenation. This addition helps users understand how to perform string operations within their orchestration workflows.
* Improved Calculation Example: The calculation example has been updated to demonstrate the improved capabilities of the library. Users can now leverage the library's features for performing calculations more effectively.## Setup
To define an orchestration function, you can utilize the state_function! macro. Here's an example:
``` rust
let fn1: fn(State) -> Result, Error> =
state_function!(pow2, f32);
```A state is represented by the following structure:
``` rust
pub struct State {
pub proceed: bool,
pub outcome: Option,
pub stage: Vec,
}
```In some cases, you can directly utilize the orchestration by employing the following approach:
``` rust
let result = vec![fn1, fn2, fn3]
.execute(State {
proceed: true,
outcome: Some(6.),
stage: Vec::::new(),
});
```Alternatively, you can use the registration trait to assign string names to the orchestration functions. This approach proves useful when configuring function sequences more generically:
``` rust
registry.register(fn1, "pow2".to_string());
registry.register(fn2, "pow3".to_string());
registry.register(fn3, "sqrt".to_string());let result = vec!["pow2", "pow3", "sqrt"]
.create(®istry.di_ref)
.execute(State {
proceed: true,
outcome: Some(6.),
stage: Vec::::new(),
});
```By assigning values to the stage, as shown in the example below, you can bypass specific steps in the sequence. Marking a step as true allows it to be skipped:
```rust
stage: vec![true, true, false, false],
```For a more intricate example, please refer to the following link:
https://github.com/elasticrash/keyboard/blob/master/lib/src/geometry/exported_geometry.rs