|
| 1 | ++++ |
| 2 | +title = "Cano - Async Data & AI Workflows in Rust" |
| 3 | +description = "Cano is a high-performance async workflow orchestration engine for Rust using Finite State Machines for type-safe processing pipelines." |
| 4 | +template = "index.html" |
| 5 | ++++ |
| 6 | + |
| 7 | +<section class="hero"> |
| 8 | +<h1 class="animate-in">Cano</h1> |
| 9 | +<p class="subtitle animate-in">Type-safe async workflow engine with built-in scheduling, retry logic, and state machine semantics.</p> |
| 10 | + |
| 11 | +<p class="prerelease-notice animate-in"><em>Cano still far from 1.0 release. The API is subject to changes and breaking changes.</em></p> |
| 12 | + |
| 13 | +<div class="badges animate-in"> |
| 14 | +<a href="https://crates.io/crates/cano" title="Crates.io"> |
| 15 | +<img src="https://img.shields.io/crates/v/cano.svg" alt="Crates.io"> |
| 16 | +</a> |
| 17 | +<a href="https://docs.rs/cano" title="API Documentation"> |
| 18 | +<img src="https://docs.rs/cano/badge.svg" alt="Documentation"> |
| 19 | +</a> |
| 20 | +<a href="https://crates.io/crates/cano" title="Download Statistics"> |
| 21 | +<img src="https://img.shields.io/crates/d/cano.svg" alt="Downloads"> |
| 22 | +</a> |
| 23 | +<a href="https://github.com/nassor/cano/blob/main/LICENSE" title="MIT License"> |
| 24 | +<img src="https://img.shields.io/crates/l/cano.svg" alt="License"> |
| 25 | +</a> |
| 26 | +</div> |
| 27 | + |
| 28 | +<p class="animate-in"> |
| 29 | +Cano is a high-performance orchestration engine designed for building resilient, self-healing systems in Rust. |
| 30 | +Unlike simple task queues, Cano uses <strong>Finite State Machines (FSM)</strong> to define strict, type-safe transitions between processing steps. |
| 31 | +</p> |
| 32 | + |
| 33 | +<p class="animate-in"> |
| 34 | +It excels at managing complex lifecycles where state transitions matter: |
| 35 | +</p> |
| 36 | +<ul class="animate-in"> |
| 37 | +<li><strong>Data Pipelines</strong>: ETL jobs with parallel processing (Split/Join) and aggregation.</li> |
| 38 | +<li><strong>AI Agents</strong>: Multi-step inference chains with shared context and memory.</li> |
| 39 | +<li><strong>Background Systems</strong>: Scheduled maintenance, periodic reporting, and distributed cron jobs.</li> |
| 40 | +</ul> |
| 41 | +</section> |
| 42 | + |
| 43 | +<h2>Features</h2> |
| 44 | +<div class="feature-grid"> |
| 45 | +<div class="feature-card animate-in"> |
| 46 | +<div class="feature-icon" aria-hidden="true">⚙</div> |
| 47 | +<h3>Tasks & Nodes</h3> |
| 48 | +<p>Single <code>Task</code> trait for simple logic, or <code>Node</code> trait for structured three-phase lifecycle.</p> |
| 49 | +</div> |
| 50 | +<div class="feature-card animate-in"> |
| 51 | +<div class="feature-icon secondary" aria-hidden="true">◆</div> |
| 52 | +<h3>State Machines</h3> |
| 53 | +<p>Type-safe enum-driven state transitions with compile-time checking.</p> |
| 54 | +</div> |
| 55 | +<div class="feature-card animate-in"> |
| 56 | +<div class="feature-icon accent" aria-hidden="true">↻</div> |
| 57 | +<h3>Retry Strategies</h3> |
| 58 | +<p>Fixed delays, exponential backoff with jitter, and custom strategies.</p> |
| 59 | +</div> |
| 60 | +<div class="feature-card animate-in"> |
| 61 | +<div class="feature-icon" aria-hidden="true">⏲</div> |
| 62 | +<h3>Scheduling</h3> |
| 63 | +<p>Built-in scheduler with intervals, cron schedules, and manual triggers.</p> |
| 64 | +</div> |
| 65 | +<div class="feature-card animate-in"> |
| 66 | +<div class="feature-icon secondary" aria-hidden="true">⚙</div> |
| 67 | +<h3>Concurrency</h3> |
| 68 | +<p>Execute multiple workflow instances in parallel with timeout strategies.</p> |
| 69 | +</div> |
| 70 | +<div class="feature-card animate-in"> |
| 71 | +<div class="feature-icon accent" aria-hidden="true">◉</div> |
| 72 | +<h3>Observability</h3> |
| 73 | +<p>Comprehensive tracing and observability for workflow execution.</p> |
| 74 | +</div> |
| 75 | +</div> |
| 76 | + |
| 77 | +<h2>Getting Started</h2> |
| 78 | +<p>Add Cano to your <code>Cargo.toml</code>:</p> |
| 79 | + |
| 80 | +<div class="getting-started-code"> |
| 81 | +<pre><code class="language-toml">[dependencies] |
| 82 | +cano = { version = "0.8", features = ["all"] } |
| 83 | +tokio = { version = "1", features = ["full"] }</code></pre> |
| 84 | +</div> |
| 85 | + |
| 86 | +<h3>Basic Example</h3> |
| 87 | +<div class="getting-started-code"> |
| 88 | +<pre><code class="language-rust">use async_trait::async_trait; |
| 89 | +use cano::prelude::*; |
| 90 | +<!--blank--> |
| 91 | +// Define your workflow states |
| 92 | +#[derive(Debug, Clone, PartialEq, Eq, Hash)] |
| 93 | +enum WorkflowState { |
| 94 | + Start, |
| 95 | + Process, |
| 96 | + Complete, |
| 97 | +} |
| 98 | +<!--blank--> |
| 99 | +// Simple Task implementation |
| 100 | +#[derive(Clone)] |
| 101 | +struct SimpleTask; |
| 102 | +<!--blank--> |
| 103 | +#[async_trait] |
| 104 | +impl Task<WorkflowState> for SimpleTask { |
| 105 | + async fn run_bare(&self) -> Result<TaskResult<WorkflowState>, CanoError> { |
| 106 | + println!("Processing task..."); |
| 107 | + // Return the next state wrapped in TaskResult |
| 108 | + Ok(TaskResult::Single(WorkflowState::Process)) |
| 109 | + } |
| 110 | +} |
| 111 | +<!--blank--> |
| 112 | +struct DoneTask; |
| 113 | +<!--blank--> |
| 114 | +#[async_trait] |
| 115 | +impl Task<WorkflowState> for DoneTask { |
| 116 | + async fn run_bare(&self) -> Result<TaskResult<WorkflowState>, CanoError> { |
| 117 | + println!("Done!"); |
| 118 | + Ok(TaskResult::Single(WorkflowState::Complete)) |
| 119 | + } |
| 120 | +} |
| 121 | +<!--blank--> |
| 122 | +#[tokio::main] |
| 123 | +async fn main() -> Result<(), CanoError> { |
| 124 | + // No resources needed — use Workflow::bare() |
| 125 | + let workflow = Workflow::bare() |
| 126 | + .register(WorkflowState::Start, SimpleTask) |
| 127 | + .register(WorkflowState::Process, DoneTask) |
| 128 | + .add_exit_state(WorkflowState::Complete); |
| 129 | +<!--blank--> |
| 130 | + // Run workflow starting at 'Start' state |
| 131 | + workflow.orchestrate(WorkflowState::Start).await?; |
| 132 | +<!--blank--> |
| 133 | + Ok(()) |
| 134 | +}</code></pre> |
| 135 | +</div> |
| 136 | + |
0 commit comments