Skip to content

cloacina-workflow

Rust

Cloacina Workflow - Minimal Types for Workflow Authoring

This crate provides the minimal set of types needed to compile Cloacina workflows without pulling in heavy runtime dependencies like database drivers.

Purpose

Workflow authors who only need to compile workflows can depend on this lightweight crate instead of the full cloacina crate. This provides:

  • Faster compile times
  • Smaller binary sizes
  • Easier cross-compilation (no native database drivers)
  • Clear separation between “authoring workflows” and “running workflows”

Types Provided

Usage

use cloacina_workflow::{Context, TaskError};
// Create a context
let mut ctx = Context::<serde_json::Value>::new();
ctx.insert("key", serde_json::json!("value")).unwrap();
// Access data
let value = ctx.get("key").unwrap();

With the Task Macro

The macros are included by default, so you only need one import:

use cloacina_workflow::{task, packaged_workflow, Context, TaskError};
#[task(id = "my_task", dependencies = [])]
async fn my_task(ctx: &mut Context<serde_json::Value>) -> Result<(), TaskError> {
ctx.insert("result", serde_json::json!("done"))?;
Ok(())
}