Expand description
duraflow-rs — durable, resumable dag tasks built on top of dagx
High level features:
- Durable task decorator that persists task outputs to a
Storagebackend run_resultAPI for callers to observe persistence errors without changingTask::run- Built-in
MemoryStoreandFileStorebackends
Example (simple):
#[tokio::main]
async fn main() {
use duraflow_rs::{DurableDag, Context, MemoryStore};
use dagx::{DagRunner, task, Task};
use std::sync::{Arc, atomic::AtomicUsize};
// define a task
struct Load(i32);
#[task]
impl Load { async fn run(&self) -> i32 { self.0 } }
let dag = DagRunner::new();
let db = Arc::new(MemoryStore::new());
let ctx = Arc::new(Context { db, completed_count: Arc::new(AtomicUsize::new(0)) });
let d = DurableDag::new(&dag, ctx.clone());
let a = d.add("v1", Load(5));
dag.run(|f| { tokio::spawn(f); }).await.unwrap();
assert_eq!(dag.get(a).unwrap(), 5);
}Structs§
- Context
- Shared context for progress and durability
- Durable
- The “Durable” decorator wraps any Task implementation and persists outputs.
- Durable
Dag - File
Store - Simple file-backed store: stores each key as a file under a directory. Keys are sanitized to filesystem-friendly names.
- Memory
Store - In-memory store used for examples and tests.
Enums§
- Duraflow
Error - Typed error for duraflow-rs operations
Traits§
- Storage
- Object-safe storage backend used by
duraflow-rs.