#![warn(missing_docs)]
pub mod atomic;
pub mod cancel;
pub mod envelope;
pub mod error;
pub mod events;
pub mod ids;
pub mod lock;
pub mod paths;
pub mod projections;
pub mod reducer;
pub mod report;
pub mod schema;
#[cfg(test)]
mod stress_tests;
pub use cancel::{
cancel_node, cancel_node_unlocked, cancel_run, cancel_run_unlocked, read_node_statuses,
CancelOutcome, NodeCancelOutcome,
};
pub use envelope::SCHEMA_VERSION;
pub use error::{Error, Result};
pub use events::{
append_and_apply_event, append_and_apply_idempotent, append_and_apply_unlocked,
find_prior_with_key, quarantine_corrupt_lines, quarantine_corrupt_lines_unlocked,
read_all_events, recover_last_seq, AppendOutcome, AppendResult, PriorEvent, Quarantine,
};
pub use ids::{format_node_id, new_op_id, new_run_id};
pub use lock::{Exclusive, LockedRun, RunLock, Shared};
pub use paths::{nofollow, run_dir, validate_run_id, RunPaths};
pub use projections::{read_manifest, read_manifest_opt, read_node, read_node_opt, write_node};
pub use reducer::{plan_projections, KIND_MERGE_ABORTED, KIND_MERGE_STARTED};
pub use report::{
sanitize_report_advisory, validate_report_payload, AdvisoryWarning, ReportOrigin,
ReportValidationError, SanitizedReport, REPORT_ORIGIN_KEY, VIA_EXPLICIT_MERGE,
};
pub use schema::aggregate_terminal_status;
pub use schema::{
is_run_id_prefix, ChildRef, Event, IdValidationError, Kind, Lifecycle, Manifest, MergeTxn,
Node, NodeId, RunId, Status, WorkerExit, STATE_SCHEMA_VERSION, SUPPORTED_STATE_SCHEMAS,
};
pub fn ensure_root(root: &std::path::Path) -> Result<()> {
for sub in ["runs", "logs"] {
let p = root.join(sub);
std::fs::create_dir_all(&p).map_err(|e| Error::io(&p, e))?;
}
Ok(())
}