Skip to main content

solti_core/
lib.rs

1//! # solti-core - orchestration layer.
2//!
3//! Bridges [`solti-model`](solti_model) (public API types) with the [`taskvisor`] runtime.
4//! Provides [`SupervisorApi`]: the main entry point for submitting, querying, and cancelling tasks.
5//!
6//! ## Responsibilities
7//!
8//! | Component            | What it does                                                 |
9//! |----------------------|--------------------------------------------------------------|
10//! | [`SupervisorApi`]    | High-level facade: submit, query, cancel, sweep              |
11//! | `TaskState`          | In-memory task + run storage (`Arc<RwLock>`)                 |
12//! | `StateSubscriber`    | Wires taskvisor events into `TaskState`                      |
13//! | `state_sweep`        | Embedded periodic task sweeping expired state (auto-started) |
14//! | `map`                | Policy adapter: `solti-model` → `taskvisor` enums            |
15//!
16//! ## Quick start
17//!
18//! ```text
19//! let api = SupervisorApi::new(sup_cfg, ctrl_cfg, subscribers, router, StateConfig::default()).await?;
20//!
21//! let task_id = api.submit(&spec).await?;
22//! let task    = api.get_task(&task_id);
23//! let runs    = api.list_task_runs(&task_id);
24//! ```
25//!
26//! ## Also
27//!
28//! - [`solti_model::TaskSpec`] input spec submitted via [`SupervisorApi::submit`].
29//! - [`taskvisor::Supervisor`] underlying runtime that manages actor lifecycle.
30//! - [`solti_runner::RunnerRouter`] picks a runner for each `TaskKind`.
31
32mod error;
33pub use error::CoreError;
34
35mod map;
36
37pub mod supervisor;
38pub use supervisor::SupervisorApi;
39
40mod system;
41pub use system::uptime_seconds;
42
43mod state;
44pub use state::StateConfig;