1#![warn(missing_docs)]
19
20pub mod atomic;
21pub mod cancel;
22pub mod envelope;
23pub mod error;
24pub mod events;
25pub mod ids;
26pub mod lock;
27pub mod paths;
28pub mod projections;
29pub mod reducer;
30pub mod report;
31pub mod schema;
32
33#[cfg(test)]
34mod stress_tests;
35
36pub use cancel::{
37 cancel_node, cancel_node_unlocked, cancel_run, cancel_run_unlocked, read_node_statuses,
38 CancelOutcome, NodeCancelOutcome,
39};
40pub use envelope::SCHEMA_VERSION;
41pub use error::{Error, Result};
42pub use events::{
43 append_and_apply_event, append_and_apply_idempotent, append_and_apply_unlocked,
44 find_prior_with_key, quarantine_corrupt_lines, quarantine_corrupt_lines_unlocked,
45 read_all_events, recover_last_seq, AppendOutcome, AppendResult, PriorEvent, Quarantine,
46};
47pub use ids::{format_node_id, new_op_id, new_run_id};
48pub use lock::{Exclusive, LockedRun, RunLock, Shared};
49pub use paths::{nofollow, run_dir, validate_run_id, RunPaths};
50pub use projections::{read_manifest, read_manifest_opt, read_node, read_node_opt, write_node};
51pub use reducer::{plan_projections, KIND_MERGE_ABORTED, KIND_MERGE_STARTED};
52pub use report::{
53 sanitize_report_advisory, validate_report_payload, AdvisoryWarning, ReportOrigin,
54 ReportValidationError, SanitizedReport, REPORT_ORIGIN_KEY, VIA_EXPLICIT_MERGE,
55};
56pub use schema::aggregate_terminal_status;
57pub use schema::{
58 is_run_id_prefix, AwaitingInput, ChildRef, Event, IdValidationError, Kind, Lifecycle, Manifest,
59 MergeTxn, Node, NodeId, RunId, Status, WorkerExit, STATE_SCHEMA_VERSION,
60 SUPPORTED_STATE_SCHEMAS,
61};
62
63pub fn ensure_root(root: &std::path::Path) -> Result<()> {
66 for sub in ["runs", "logs"] {
67 let p = root.join(sub);
68 std::fs::create_dir_all(&p).map_err(|e| Error::io(&p, e))?;
69 }
70 Ok(())
71}