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;
32pub mod telemetry;
33
34#[cfg(test)]
35mod stress_tests;
36
37pub use cancel::{
38 cancel_node, cancel_node_unlocked, cancel_run, cancel_run_unlocked, read_node_status_facts,
39 read_node_statuses, CancelOutcome, NodeCancelOutcome, NodeStatusFact,
40};
41pub use envelope::SCHEMA_VERSION;
42pub use error::{Error, Result};
43pub use events::{
44 append_and_apply_event, append_and_apply_idempotent, append_and_apply_unlocked,
45 find_prior_with_key, quarantine_corrupt_lines, quarantine_corrupt_lines_unlocked,
46 read_all_events, recover_last_seq, replay_unapplied_unlocked, AppendOutcome, AppendResult,
47 PriorEvent, Quarantine,
48};
49pub use ids::{format_node_id, new_op_id, new_run_id};
50pub use lock::{Exclusive, LockedRun, RunLock, Shared};
51pub use paths::{nofollow, run_dir, validate_run_id, RunPaths};
52pub use projections::{read_manifest, read_manifest_opt, read_node, read_node_opt, write_node};
53pub use reducer::{plan_projections, validate_event, KIND_MERGE_ABORTED, KIND_MERGE_STARTED};
54pub use report::{
55 sanitize_report_advisory, validate_report_payload, AdvisoryWarning, ReportOrigin,
56 ReportValidationError, SanitizedReport, REPORT_ORIGIN_KEY, VIA_EXPLICIT_MERGE,
57};
58pub use schema::aggregate_terminal_status;
59pub use schema::{
60 is_run_id_prefix, AgentSelection, AwaitingInput, ChildRef, Event, IdValidationError, Kind,
61 Lifecycle, Manifest, MergeTxn, Node, NodeId, RunId, SelectedAgentCandidate,
62 SkippedAgentCandidate, Status, WorkerExit, STATE_SCHEMA_VERSION, SUPPORTED_STATE_SCHEMAS,
63};
64pub use telemetry::{
65 parse_telemetry_update, read_all_telemetry, read_all_telemetry_with_clock, read_telemetry,
66 read_telemetry_with_clock, update_telemetry, update_telemetry_with_clock, SystemTelemetryClock,
67 TelemetryAccepted, TelemetryClock, TelemetryError, TelemetrySampleStatus, TelemetryState,
68 TelemetryUpdate, TelemetryView, TELEMETRY_FRESHNESS_SECS, TELEMETRY_MAX_BYTES,
69 TELEMETRY_PROTOCOL_VERSION, TELEMETRY_SCHEMA_VERSION,
70};
71
72pub fn ensure_root(root: &std::path::Path) -> Result<()> {
75 for sub in ["runs", "logs"] {
76 let p = root.join(sub);
77 std::fs::create_dir_all(&p).map_err(|e| Error::io(&p, e))?;
78 }
79 Ok(())
80}