pub struct ActionBus { /* private fields */ }Expand description
动作总线
包含两条独立通道:
- raw_events: collector 向 core 推送已贴上 SourceTier 的原始事件
- intents: agent 向 core 回传意图批次
Implementations§
Source§impl ActionBus
impl ActionBus
pub fn new(capacity: usize) -> Self
Sourcepub fn raw_sender(&self) -> Sender<IngestedRawEvent>
pub fn raw_sender(&self) -> Sender<IngestedRawEvent>
获取原始事件发送端的克隆(给 collector 任务)
Sourcepub fn intent_sender(&self) -> Sender<IntentBatch>
pub fn intent_sender(&self) -> Sender<IntentBatch>
获取意图发送端的克隆(给 agent 任务)
Sourcepub async fn recv_raw(&mut self) -> Option<IngestedRawEvent>
pub async fn recv_raw(&mut self) -> Option<IngestedRawEvent>
阻塞等待下一个原始事件(处理管道独占调用)
Sourcepub async fn recv_intent(&mut self) -> Option<IntentBatch>
pub async fn recv_intent(&mut self) -> Option<IntentBatch>
阻塞等待下一个意图批次(策略审查独占调用)
Sourcepub fn split(
self,
) -> (Sender<IngestedRawEvent>, Receiver<IngestedRawEvent>, Sender<IntentBatch>, Receiver<IntentBatch>)
pub fn split( self, ) -> (Sender<IngestedRawEvent>, Receiver<IngestedRawEvent>, Sender<IntentBatch>, Receiver<IntentBatch>)
拆出四个端点并消费掉 bus 自身。
与 raw_sender() + recv_raw() 的关键区别: split 交出 raw_events_tx
的所有权而不在结构体里残留一份。这样当采集侧的所有 sender 落地后, raw
通道才会真正关闭, recv() 返回 None——处理循环据此排空并 flush 最后一个
窗口再退出。若继续持有 bus, 内部那份 sender 会让通道永不关闭。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActionBus
impl RefUnwindSafe for ActionBus
impl Send for ActionBus
impl Sync for ActionBus
impl Unpin for ActionBus
impl UnsafeUnpin for ActionBus
impl UnwindSafe for ActionBus
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