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