1#![deny(clippy::pedantic)]
2#![allow(
3 clippy::unused_async,
4 clippy::clone_on_copy,
5 clippy::missing_fields_in_debug,
6 clippy::must_use_candidate,
7 clippy::missing_errors_doc
8)]
9
10use ntex_service::ServiceFactory;
11
12mod manager;
13pub mod net;
14mod pool;
15mod server;
16mod wrk;
17
18pub use self::pool::WorkerPool;
19pub use self::server::Server;
20pub use self::wrk::{Worker, WorkerStatus, WorkerStop};
21
22#[deprecated(since = "3.10.0", note = "use ntex_rt::signals")]
23pub use ntex_rt::signals::{Signal, signal};
24
25#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
27pub struct WorkerId(pub(crate) usize);
28
29impl WorkerId {
30 pub(self) fn next(&mut self) -> WorkerId {
31 let id = WorkerId(self.0);
32 self.0 += 1;
33 id
34 }
35}
36
37#[allow(async_fn_in_trait)]
38pub trait ServerConfiguration: Send + Clone + 'static {
40 type Item: Send + 'static;
41 type Factory: ServiceFactory<Self::Item> + 'static;
42
43 async fn create(&self) -> Result<Self::Factory, ()>;
45
46 fn paused(&self) {}
48
49 fn resumed(&self) {}
51
52 fn terminate(&self) {}
54
55 async fn stop(&self) {}
57}