reifydb_sub_server_http/
state.rs1use std::ops::Deref;
7
8use reifydb_core::actors::server::ServerMessage;
9use reifydb_runtime::actor::{mailbox::ActorRef, system::ActorHandle};
10use reifydb_sub_server::state::AppState;
11
12#[derive(Clone)]
17pub struct HttpServerState {
18 state: AppState,
19}
20
21impl HttpServerState {
22 pub fn new(state: AppState) -> Self {
23 Self {
24 state,
25 }
26 }
27
28 pub fn state(&self) -> &AppState {
29 &self.state
30 }
31
32 pub fn spawn_actor(&self) -> (ActorRef<ServerMessage>, ActorHandle<ServerMessage>) {
37 self.state.spawn_server_actor()
38 }
39}
40
41impl Deref for HttpServerState {
42 type Target = AppState;
43
44 fn deref(&self) -> &Self::Target {
45 &self.state
46 }
47}