batpak 0.8.2

Event sourcing with causal graphs and caller-defined gates. Sync API, no async runtime.
Documentation
//! # submit_pipeline
//!
//! **Teaches:** async submit ticket with blocking wait.
//!
//! Run: `cargo run --example submit_pipeline`

use batpak::prelude::*;

#[derive(serde::Serialize, serde::Deserialize, EventPayload)]
#[batpak(category = 0xF, type_id = 2)]
struct Tick {
    n: u32,
}

// justifies: INV-EXAMPLES-OBSERVABLE-OUTPUT; example in examples/submit_pipeline.rs demonstrates submit-pipeline ticket completion via stdout; println is the observable success path for this demo.
#[allow(clippy::print_stdout)]
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let dir = tempfile::tempdir()?;
    let store = Store::open(StoreConfig::new(dir.path()))?;

    let coord = Coordinate::new("player:submit", "room:pipeline")?;

    let first = store.submit_typed(&coord, &Tick { n: 1 })?;
    let second = store.submit_typed(&coord, &Tick { n: 2 })?;
    let third = store.submit_typed(&coord, &Tick { n: 3 })?;

    let receipts = [first.wait()?, second.wait()?, third.wait()?];
    println!(
        "queued {} appends and committed through the blocking wait path",
        receipts.len()
    );

    store.close()?;
    Ok(())
}