1#![expect(
4 clippy::multiple_crate_versions,
5 reason = "the engine, updater, and network stacks currently resolve independently versioned transitive crates"
6)]
7
8pub const VERSION: &str = env!("CARGO_PKG_VERSION");
10
11mod claim;
12mod config;
13mod core;
14mod realtime;
15mod sentinel;
16mod update;
17mod utils;
18mod work_context;
19mod worker;
20
21use wowlab_common::time::Instant;
22
23#[rustfmt::skip]
24#[doc(inline)]
25pub use claim::validate_token as validate_claim_token;
26#[rustfmt::skip]
27#[doc(inline)]
28pub use config::{NodeConfig, NodeConfigError};
29#[rustfmt::skip]
30#[doc(inline)]
31pub use sentinel::SentinelError;
32#[rustfmt::skip]
33#[doc(inline)]
34pub use update::{UpdateError, check_for_update, install_update};
35#[rustfmt::skip]
36#[doc(inline)]
37pub use utils::logging::{
38 LoggingGuard, UiLogEntry, init_headless_logging, init_ui_logging, log_dir,
39};
40#[rustfmt::skip]
41#[doc(inline)]
42pub use work_context::WorkContext;
43#[rustfmt::skip]
44#[doc(inline)]
45pub use worker::{WorkBatch, WorkBatchResult, WorkerPool};
46
47#[rustfmt::skip]
48#[doc(inline)]
49pub use crate::core::{
50 LocalIdentityOutcome, NodeApplication, NodeCore, NodeCoreEvent, NodeEvents,
51 RemoteUnlinkOutcome, UnlinkError, UnlinkErrorCategory, UnlinkOutcome,
52};
53
54#[derive(Clone, Debug, Default)]
56pub struct NodeStats {
57 pub active_jobs: u32,
58 pub completed_chunks: u64,
59 pub sims_per_second: f64,
60 pub busy_workers: u32,
61 pub max_workers: u32,
62 pub total_cores: u32,
63 pub cpu_usage: f32,
64}
65
66#[derive(Clone, Debug)]
68pub struct LogEntry {
69 pub timestamp: Instant,
70 pub level: LogLevel,
71 pub message: String,
72}
73
74#[derive(Clone, Copy, Debug, Default, PartialEq)]
76pub enum LogLevel {
78 #[default]
79 Info,
80 Warn,
81 Error,
82 Debug,
83}
84
85#[derive(Clone, Debug, Eq, PartialEq)]
88pub enum NodeState {
90 Setup,
91 Verifying,
92 Registering,
93 Running,
94 NotFound,
95 Unavailable,
96 Unlinking,
97 Unlinked,
98}
99#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
103pub enum ConnectionStatus {
105 #[default]
106 Connecting,
107 Connected,
108 Disconnected,
109}