pub struct GatewayBridge {Show 14 fields
pub qot_cache: Arc<QotCache>,
pub trd_cache: Arc<TrdCache>,
pub static_cache: Arc<StaticDataCache>,
pub login_cache: Arc<LoginCache>,
pub subscriptions: Arc<SubscriptionManager>,
pub backend: SharedBackend,
pub auth_result: Option<AuthResult>,
pub push_tx: Option<Sender<PushEvent>>,
pub suspend_cache: SuspendCache,
pub code_change_cache: CodeChangeCache,
pub app_lang: i32,
pub kl_quota_counter: Arc<AtomicU32>,
pub qot_right_cache: Arc<QotRightCache>,
pub metrics: Arc<GatewayMetrics>,
}Expand description
网关桥接器
Fields§
§qot_cache: Arc<QotCache>§trd_cache: Arc<TrdCache>§static_cache: Arc<StaticDataCache>§login_cache: Arc<LoginCache>§subscriptions: Arc<SubscriptionManager>§backend: SharedBackend§auth_result: Option<AuthResult>§push_tx: Option<Sender<PushEvent>>推送事件 channel (push_callback → tokio 任务 → PushDispatcher)
suspend_cache: SuspendCache停牌数据缓存 (stock_id → Vec
code_change_cache: CodeChangeCache代码变更数据缓存 (HTTP 下载的 CodeRelation + CodeTemp)
app_lang: i32App 语言: 0=简体 1=繁体 2=英文 (对应 C++ NN_AppLanguage)
kl_quota_counter: Arc<AtomicU32>历史 K 线请求次数计数器 (GetUsedQuota 返回)
qot_right_cache: Arc<QotRightCache>行情权限缓存 (CMD 6024 响应)
metrics: Arc<GatewayMetrics>运行时监控指标
Implementations§
Source§impl GatewayBridge
impl GatewayBridge
pub fn new() -> Self
Sourcepub async fn initialize(
&mut self,
config: &GatewayConfig,
verify_cb: Option<VerifyCodeCallback>,
) -> Result<Receiver<PushEvent>>
pub async fn initialize( &mut self, config: &GatewayConfig, verify_cb: Option<VerifyCodeCallback>, ) -> Result<Receiver<PushEvent>>
完整的启动流程: 认证 → 连接后端 → 登录 → 拉取数据
verify_cb: 短信验证码回调(GUI 模式传入,CLI 模式传 None 使用 stdin)
Sourcepub fn register_handlers(&self, server: &ApiServer)
pub fn register_handlers(&self, server: &ApiServer)
注册所有业务处理器
Sourcepub fn create_push_dispatcher(
&self,
server: &ApiServer,
external_sinks: Vec<Arc<dyn ExternalPushSink>>,
) -> PushDispatcher
pub fn create_push_dispatcher( &self, server: &ApiServer, external_sinks: Vec<Arc<dyn ExternalPushSink>>, ) -> PushDispatcher
创建推送分发器
Sourcepub fn start_push_dispatcher(
&self,
server: &ApiServer,
push_rx: Receiver<PushEvent>,
external_sinks: Vec<Arc<dyn ExternalPushSink>>,
)
pub fn start_push_dispatcher( &self, server: &ApiServer, push_rx: Receiver<PushEvent>, external_sinks: Vec<Arc<dyn ExternalPushSink>>, )
启动推送分发任务: 消费 push_rx channel,处理行情推送和交易重查
external_sinks: 外部推送接收器列表 (REST WebSocket, gRPC 等)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GatewayBridge
impl !RefUnwindSafe for GatewayBridge
impl Send for GatewayBridge
impl Sync for GatewayBridge
impl Unpin for GatewayBridge
impl !UnwindSafe for GatewayBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more