Skip to main content

atomic_matrix/
handlers.rs

1pub mod matrix_handler {
2    use crate::{
3        handlers::profiles::ModuleProfile, 
4        matrix::core::AtomicMatrix
5    };
6    use memmap2::MmapMut;
7
8    pub struct MatrixHandler {
9        pub matrix: &'static mut AtomicMatrix,
10        pub mmap: MmapMut,
11        // pub profile: ModuleProfile,
12        // pub processed_messages: u64,
13        // pub bytes_consumed: u64,
14        // pub published_messages: u64,
15        // pub bytes_allocated: u64,
16        // pub current_usage: u64,
17        // pub claimed_buffers: Vec<u64>,
18    }
19
20    pub struct AdminHandler<T> {
21        pub matrix: &'static mut AtomicMatrix,
22        pub mmap: MmapMut,
23        pub message_protocol: T,
24        pub registered_modules: [ModuleProfile; 64],
25    }
26
27    impl HandlerFunctions for MatrixHandler {}
28
29    impl<T> HandlerFunctions for AdminHandler<T> {}
30
31    pub trait HandlerFunctions {
32        fn submit() {}
33
34        fn respond() {}
35
36        fn request() {}
37
38        fn inquire() {}
39
40        fn query_inbox() {}
41
42        fn notify() {}
43
44        fn read() {}
45    }
46}
47
48pub mod profiles {
49    pub struct ModuleProfile {}
50    pub struct AdminProfile {}
51    pub struct PublicProfile {}
52    pub struct RegistrationEndpoint{}
53
54    pub trait ProfileFunctions {}
55}
56
57pub mod public {
58    use super::*;
59    use std::marker::PhantomData;
60    use crate::matrix::core::AtomicMatrix;
61
62    pub struct PublicHandler<T> {
63        pub matrix: Option<&'static mut AtomicMatrix>,
64        pub _public_protocol: PhantomData<T>,
65        pub profile: profiles::PublicProfile
66    }
67
68    pub struct PublicRegistrationService {
69        pub matrix_key: String,
70        pub endpoint: profiles::RegistrationEndpoint
71    }
72}