GatewayBridge

Struct GatewayBridge 

Source
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: i32

App 语言: 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

Source

pub fn new() -> Self

Source

pub async fn initialize( &mut self, config: &GatewayConfig, verify_cb: Option<VerifyCodeCallback>, ) -> Result<Receiver<PushEvent>>

完整的启动流程: 认证 → 连接后端 → 登录 → 拉取数据

verify_cb: 短信验证码回调(GUI 模式传入,CLI 模式传 None 使用 stdin)

Source

pub fn register_handlers(&self, server: &ApiServer)

注册所有业务处理器

Source

pub fn create_push_dispatcher( &self, server: &ApiServer, external_sinks: Vec<Arc<dyn ExternalPushSink>>, ) -> PushDispatcher

创建推送分发器

Source

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§

Source§

impl Default for GatewayBridge

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more