Expand description
§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
Context- Data container for sharing values between tasksTask- Trait defining executable tasksTaskState- Task execution state enumTaskNamespace- Hierarchical task identificationTaskError,ContextError,CheckpointError- Error typesRetryPolicy,BackoffStrategy,RetryCondition- Retry configuration
§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(())
}Re-exports§
pub use context::Context;pub use error::CheckpointError;pub use error::ContextError;pub use error::TaskError;pub use namespace::parse_namespace;pub use namespace::TaskNamespace;pub use retry::BackoffStrategy;pub use retry::RetryCondition;pub use retry::RetryPolicy;pub use retry::RetryPolicyBuilder;pub use task::Task;pub use task::TaskState;
Modules§
- context
- Minimal Context for Workflow Authoring
- error
- Error Types
- namespace
- Task namespace management for isolated task execution.
- retry
- Retry Policy System
- task
- Task Trait and State