pub struct EventBus { /* private fields */ }Expand description
Thread-safe event bus for inter-agent communication.
Implementations§
Source§impl EventBus
impl EventBus
pub fn new() -> EventBus
Sourcepub async fn emit(&self, event: AgentEvent)
pub async fn emit(&self, event: AgentEvent)
Publish an event to all subscribed handlers and agent subscriptions.
Sourcepub async fn subscribe(&self, subscription: EventSubscription)
pub async fn subscribe(&self, subscription: EventSubscription)
Register an agent event subscription.
Sourcepub async fn unsubscribe(&self, subscription_id: &str) -> bool
pub async fn unsubscribe(&self, subscription_id: &str) -> bool
Remove an agent event subscription.
Sourcepub async fn drain_pending_events(&self, agent_id: &str) -> Vec<AgentEvent>
pub async fn drain_pending_events(&self, agent_id: &str) -> Vec<AgentEvent>
Drain all pending events for an agent.
Sourcepub async fn create_wait_group(
&self,
id: String,
parent_agent_id: String,
expected_agent_ids: Vec<String>,
)
pub async fn create_wait_group( &self, id: String, parent_agent_id: String, expected_agent_ids: Vec<String>, )
Create a wait group for after_all semantics.
Sourcepub async fn add_to_wait_group(&self, group_id: &str, agent_id: &str)
pub async fn add_to_wait_group(&self, group_id: &str, agent_id: &str)
Add an agent to an existing wait group.
Sourcepub async fn get_wait_group(&self, group_id: &str) -> Option<WaitGroup>
pub async fn get_wait_group(&self, group_id: &str) -> Option<WaitGroup>
Get a wait group by ID.
Sourcepub async fn remove_wait_group(&self, group_id: &str)
pub async fn remove_wait_group(&self, group_id: &str)
Remove a wait group.
Sourcepub fn all_event_types() -> Vec<&'static str>
pub fn all_event_types() -> Vec<&'static str>
Get all event types as strings (for API responses).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventBus
impl !RefUnwindSafe for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
impl !UnwindSafe for EventBus
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more