pub trait ExternalPushSink: Send + Sync {
// Required methods
fn on_quote_push(
&self,
sec_key: &str,
sub_type: i32,
rehab_type: i32,
proto_id: u32,
body: &[u8],
);
fn on_broadcast_push(&self, proto_id: u32, body: &[u8]);
fn on_trade_push(
&self,
acc_id: u64,
proto_id: u32,
body: &[u8],
trd_market: Option<&str>,
);
}Expand description
外部推送接收器 trait
允许外部模块(如 REST WebSocket)接收推送事件, 不引入模块间循环依赖。
v1.4.106 codex 1131 F4 [P1]: on_quote_push 加 rehab_type 参数. KL 类
push 走非 0 rehab (forward / backward / 无), 其它 sub_type 走 0. Sink 实装
应用 (sec_key, sub_type, rehab_type) 三元过滤 push 接收方 — 不再 broadcast
给所有 quote-scope conn (老行为是 silent leak: 仅订未 RegPush 的 conn 也收
到 quote push, 违反 C++ QotSubscribe::GetPushConn 三元 key 路由).
Required Methods§
Sourcefn on_quote_push(
&self,
sec_key: &str,
sub_type: i32,
rehab_type: i32,
proto_id: u32,
body: &[u8],
)
fn on_quote_push( &self, sec_key: &str, sub_type: i32, rehab_type: i32, proto_id: u32, body: &[u8], )
行情推送 (rehab_type=0 for non-KL).
Sourcefn on_broadcast_push(&self, proto_id: u32, body: &[u8])
fn on_broadcast_push(&self, proto_id: u32, body: &[u8])
广播推送 (到价提醒、系统通知等)
Sourcefn on_trade_push(
&self,
acc_id: u64,
proto_id: u32,
body: &[u8],
trd_market: Option<&str>,
)
fn on_trade_push( &self, acc_id: u64, proto_id: u32, body: &[u8], trd_market: Option<&str>, )
交易推送 (订单更新、成交更新等).
trd_market 是 PushDispatcher 一次性 decode body 提取的
s2c.header.trd_market 大写字符串 (“HK” / “US” / “CN” / …), 为
4 surface (gRPC / REST WS / MCP) 复用避免各自 decode. 老 sink 实现可
忽略此参数 (只看 acc_id + proto_id + body), Layer 3 (allowed_markets)
filter 直接从这里取 — 见 extract_trd_market_from_trade_body.
None = decode 失败 / proto_id 不识别 / market enum unknown — 老
路径下游应不 trigger Layer 3 drop (向后兼容 — pitfall #57
backend-semantic 未真机验证前 default OFF behavior).