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)]
15pub struct HttpServerState {
16 state: AppState,
17}
18
19impl HttpServerState {
20 pub fn new(state: AppState) -> Self {
21 Self {
22 state,
23 }
24 }
25
26 pub fn state(&self) -> &AppState {
27 &self.state
28 }
29
30 pub fn spawn_actor(&self) -> (ActorRef<ServerMessage>, ActorHandle<ServerMessage>) {
35 self.state.spawn_server_actor()
36 }
37}
38
39impl Deref for HttpServerState {
40 type Target = AppState;
41
42 fn deref(&self) -> &Self::Target {
43 &self.state
44 }
45}