Skip to main content

futu_gateway_core/bridge/
subscription_runtime.rs

1//! Subscription runtime boundary for [`super::GatewayBridge`].
2//!
3//! `SubscriptionManager` is shared by QOT/TRD handlers, push dispatch, server
4//! listeners, and reconnect cleanup. Keeping it behind this focused runtime
5//! bundle prevents new call sites from reaching into the full bridge facade.
6
7use std::sync::Arc;
8
9use futu_server::subscription::SubscriptionManager;
10
11#[derive(Clone)]
12pub struct SubscriptionRuntime {
13    manager: Arc<SubscriptionManager>,
14}
15
16impl SubscriptionRuntime {
17    pub fn new() -> Self {
18        Self {
19            manager: Arc::new(SubscriptionManager::new()),
20        }
21    }
22
23    pub fn manager(&self) -> Arc<SubscriptionManager> {
24        Arc::clone(&self.manager)
25    }
26}
27
28impl Default for SubscriptionRuntime {
29    fn default() -> Self {
30        Self::new()
31    }
32}