Echo/Library.rs
1#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
2#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
3
4//! # Echo: Work-Stealing Task Scheduler
5//!
6//! Echo keeps every CPU core busy. It uses a lock-free work-stealing queue
7//! (`crossbeam-deque`) so that idle threads automatically pick up tasks from
8//! busy ones. No central bottleneck, no wasted cores.
9//!
10//! ## Why Echo Instead of `tokio::spawn`
11//!
12//! Tokio is great for I/O-bound work, but CPU-bound tasks (parsing, diffing,
13//! indexing) block the executor. Echo provides:
14//!
15//! - **Priority levels**: UI-blocking tasks pre-empt background indexing
16//! - **Work stealing**: Idle workers take from busy workers' queues
17//! - **Structured shutdown**: Graceful drain with timeout
18//!
19//! ## Usage
20//!
21//! ```rust,ignore
22//! use Echo::Scheduler::SchedulerBuilder;
23//! use Echo::Task::Priority;
24//!
25//! let Scheduler = SchedulerBuilder::new().Workers(4).Build();
26//! Scheduler.Submit(Priority::High, async { /* critical work */ });
27//! Scheduler.Submit(Priority::Low, async { /* background indexing */ });
28//! ```
29//!
30//! ## Modules
31//!
32//! - [`Scheduler`]: Builder and runtime for the worker pool
33//! - [`Queue`]: Lock-free work-stealing deque wrapper
34//! - [`Task`]: Task definition with priority levels
35
36// --- Crate Modules ---
37// Declares the main modules that constitute the library.
38pub mod Queue;
39
40pub mod Scheduler;
41
42pub mod Task;