reifydb_sub_server_http/
state.rs1use std::ops::Deref;
5
6use reifydb_core::actors::server::ServerMessage;
7use reifydb_runtime::actor::{mailbox::ActorRef, system::ActorHandle};
8use reifydb_sub_server::state::AppState;
9
10#[derive(Clone)]
11pub struct HttpServerState {
12 state: AppState,
13}
14
15impl HttpServerState {
16 pub fn new(state: AppState) -> Self {
17 Self {
18 state,
19 }
20 }
21
22 pub fn state(&self) -> &AppState {
23 &self.state
24 }
25
26 pub fn spawn_actor(&self) -> (ActorRef<ServerMessage>, ActorHandle<ServerMessage>) {
27 self.state.spawn_server_actor()
28 }
29}
30
31impl Deref for HttpServerState {
32 type Target = AppState;
33
34 fn deref(&self) -> &Self::Target {
35 &self.state
36 }
37}