night/
lib.rs

1pub mod common;
2pub mod config;
3pub mod mission;
4pub mod task;
5pub mod utils;
6
7pub use config::config::ConfigManager;
8pub use mission::mission::Mission;
9pub use utils::error::{NightError, Result};
10
11/// Initialize the Night system with a configuration file.
12pub async fn init(config_path: &str) -> Result<Mission> {
13    let config = ConfigManager::load_config(config_path)?;
14    Mission::new(config).await
15}
16
17/// Start the mission execution.
18pub async fn run(mission: &Mission) -> Result<()> {
19    mission.start().await
20}
21
22/// Stop a specific task in the mission.
23pub async fn stop_task(mission: &Mission, task_id: uuid::Uuid) -> Result<()> {
24    mission.stop_task(task_id).await
25}
26
27/// Get information about all tasks in the mission.
28pub async fn get_all_task_info(
29    mission: &Mission,
30) -> std::collections::HashMap<uuid::Uuid, common::types::TaskInfo> {
31    mission.get_all_task_info().await
32}
33
34/// Get information about a specific task in the mission.
35pub async fn get_task_info(
36    mission: &Mission,
37    task_id: uuid::Uuid,
38) -> Result<common::types::TaskInfo> {
39    mission.get_task_info(task_id).await
40}