tinyflow-framework 0.1.1

Streaming runtime engine — checkpoint, chained task execution, and state store
Documentation
//! Per-chain-subtask SQLite database under `{work_dir}/chains/{subtask_index}/chain.db`.

use std::path::Path;
use std::sync::Arc;

use crate::state::SqliteJobStateStore;
use tinyflow_api::error::StreamResult;
use tinyflow_api::state::StateStore;

pub async fn open_chain_state_db(
    work_dir: &Path,
    subtask_index: u32,
) -> StreamResult<Arc<dyn StateStore>> {
    let path = work_dir
        .join("chains")
        .join(subtask_index.to_string())
        .join("chain.db");
    SqliteJobStateStore::open(&path).await
}