pub struct ImModule { /* private fields */ }Expand description
IM 业务模块(实现 helix_core::Module trait)
Implementations§
Source§impl ImModule
impl ImModule
Sourcepub fn with_diagnostic_session(self, login: String, device: String) -> Self
pub fn with_diagnostic_session(self, login: String, device: String) -> Self
宿主在注册模块前注入诊断会话;不改变认证身份或业务协议。
Source§impl ImModule
impl ImModule
Sourcepub fn with_sync_observer(self, observer: Arc<dyn SyncObserver>) -> Self
pub fn with_sync_observer(self, observer: Arc<dyn SyncObserver>) -> Self
注入独立指标出口,诊断日志关闭时仍记录同步时间。
Source§impl ImModule
impl ImModule
Sourcepub fn ingest_increment(&mut self, inc: &IncrementChannel, out: &mut EffectSink)
pub fn ingest_increment(&mut self, inc: &IncrementChannel, out: &mut EffectSink)
B-rest 测试 / driver 入口:直接喂一个解析好的 increment_channel 帧。
Source§impl ImModule
impl ImModule
Sourcepub fn new_with_local_store(
config: ImConfig,
local_store_mode: LocalStoreMode,
) -> Self
pub fn new_with_local_store( config: ImConfig, local_store_mode: LocalStoreMode, ) -> Self
Web 可注入 Session/Disabled;三端业务 query API 保持一致。
pub fn local_store_mode(&self) -> LocalStoreMode
pub fn alloc_corr(&mut self) -> Correlation
pub fn alloc_timer(&mut self) -> TimerId
Sourcepub fn register_channel(&mut self, id: ChannelId, initial_cursor: u64)
pub fn register_channel(&mut self, id: ChannelId, initial_cursor: u64)
测试 / driver 初始化用:预注册一个 channel(初始 cursor 值由调用方提供)
Sourcepub fn cursor_for(&self, channel_id: ChannelId) -> Option<u64>
pub fn cursor_for(&self, channel_id: ChannelId) -> Option<u64>
查询 per-channel cursor(测试 / 诊断用)
Sourcepub fn terminal_event_seq_for(&self, channel_id: ChannelId) -> Option<u64>
pub fn terminal_event_seq_for(&self, channel_id: ChannelId) -> Option<u64>
查询已确认的 type7 terminal tombstone 水位(测试 / 诊断用)。
Sourcepub fn pending_send_count(&self) -> usize
pub fn pending_send_count(&self) -> usize
查询 pending_sends 数量(测试用)
Sourcepub fn chain_mutation_state(
&self,
client_mutation_id: &str,
) -> Option<ChainMutationState>
pub fn chain_mutation_state( &self, client_mutation_id: &str, ) -> Option<ChainMutationState>
查询文字接龙 mutation 的本地状态,供 bridge 映射稳定状态而非重算业务事实。
Sourcepub fn chain_operation_id(&self, client_mutation_id: &str) -> Option<&str>
pub fn chain_operation_id(&self, client_mutation_id: &str) -> Option<&str>
查询由 Helix 生成的稳定 operationId,供 reconcile 继续使用同一业务操作。
Sourcepub fn sync_inflight(&self) -> usize
pub fn sync_inflight(&self) -> usize
B4:全局在途 sync 数 + 待 dispatch 队列长(HX-C011 证伪性质测试结构化断言用)。
pub fn sync_pending_len(&self) -> usize
Sourcepub fn pending_send_status(&self, temporary_id: &str) -> Option<SendStatus>
pub fn pending_send_status(&self, temporary_id: &str) -> Option<SendStatus>
查询某 temporary_id 的 PendingSend 状态(测试 / 诊断用)。 用于 C1 echo→reconcile 断言「对账后 PendingSend 推进到 Sent」。
Sourcepub fn increment_fetched_contains(&self, channel_id: ChannelId) -> bool
pub fn increment_fetched_contains(&self, channel_id: ChannelId) -> bool
查询 increment_fetched 是否含某 channel(测试 / 诊断用)。
Sourcepub fn increment_target_for(&self, channel_id: ChannelId) -> Option<u64>
pub fn increment_target_for(&self, channel_id: ChannelId) -> Option<u64>
查询某 channel 的 increment_target(服务端水位,测试 / 诊断用)。 cursor(本地确认)与 target(服务端水位)严格解耦——HX-C008 回归断言锚点。
Sourcepub fn ingest_increment_end(
&mut self,
ch: Option<ChannelId>,
out: &mut EffectSink,
)
pub fn ingest_increment_end( &mut self, ch: Option<ChannelId>, out: &mut EffectSink, )
B-rest 测试 / driver 入口:直接喂 increment_channel_end 信号。
Some(ch)=子 topic 结束;None=global end(触发增量群 sync)。
Trait Implementations§
Source§impl Module for ImModule
impl Module for ImModule
Source§fn accepts(&self, tick: &Tick) -> bool
fn accepts(&self, tick: &Tick) -> bool
路由判定:IM 模块处理所有 IM Inbound 帧和 IM 命令。 PortReply / Timer 不走此方法(通过 corr_map 定向路由)。
MV3-G02e 草稿族(im_save_draft / im_query_draft)在此与下面的 handle
同源放行(crate::draft::is_draft_command):accepts 与 handle 各写一份命令名
正是「query 族被 accepts 闸静默丢弃」旧事故的成因,本族不重复该反模式。
Source§fn handle(
&mut self,
tick: &Tick,
now_ms: u64,
out: &mut EffectSink,
) -> Result<(), CoreError>
fn handle( &mut self, tick: &Tick, now_ms: u64, out: &mut EffectSink, ) -> Result<(), CoreError>
处理一个 Tick,零 I/O,零 await。