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 input_interface::schema_for;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;pub use trigger::Trigger;pub use trigger::TriggerError;pub use trigger::TriggerResult;
Modules§
- context
- Minimal Context for Workflow Authoring
- cron_
evaluator - Timezone-aware cron expression evaluator
- error
- Error Types
- input_
interface - Injectable input interface — JSON Schema generation (CLOACI-I-0128).
- namespace
- Task namespace management for isolated task execution.
- retry
- Retry Policy System
- task
- Task Trait and State
- trigger
- Trigger types for workflow authoring.
Structs§
- Input
Slot - One declared input slot of an injectable surface: a named, typed value the
surface accepts.
schemais a JSON Schema fragment (the type descriptor —schemars-derived for Rust, type-hint-derived for Python) that the UI can render a form from and the server can validate an injection against.