pub struct EventBus { /* private fields */ }Expand description
Event bus for managing skill lifecycle events
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn subscribe(&self) -> Receiver<SkillEvent>
pub fn subscribe(&self) -> Receiver<SkillEvent>
Subscribe to events
Sourcepub async fn register_handler<H: EventHandler + 'static>(
&self,
event_type: &str,
handler: H,
) -> Result<(), ServiceError>
pub async fn register_handler<H: EventHandler + 'static>( &self, event_type: &str, handler: H, ) -> Result<(), ServiceError>
Register an event handler for a specific event type
Sourcepub async fn unregister_handler(
&self,
event_type: &str,
_handler_id: &str,
) -> Result<(), ServiceError>
pub async fn unregister_handler( &self, event_type: &str, _handler_id: &str, ) -> Result<(), ServiceError>
Unregister an event handler
Sourcepub async fn publish_event(
&self,
event: SkillEvent,
) -> Result<usize, ServiceError>
pub async fn publish_event( &self, event: SkillEvent, ) -> Result<usize, ServiceError>
Publish an event
Sourcepub async fn get_event_history(&self) -> Vec<(SkillEvent, Instant)>
pub async fn get_event_history(&self) -> Vec<(SkillEvent, Instant)>
Get event history
Sourcepub async fn clear_event_history(&self)
pub async fn clear_event_history(&self)
Clear event history
Sourcepub async fn get_registered_handlers(&self) -> HashMap<String, usize>
pub async fn get_registered_handlers(&self) -> HashMap<String, usize>
Get registered event handlers
Source§impl EventBus
Convenience methods for publishing common events
impl EventBus
Convenience methods for publishing common events
Sourcepub async fn publish_skill_registered(
&self,
skill_id: String,
skill: SkillDefinition,
) -> Result<usize, ServiceError>
pub async fn publish_skill_registered( &self, skill_id: String, skill: SkillDefinition, ) -> Result<usize, ServiceError>
Publish skill registered event
Sourcepub async fn publish_skill_updated(
&self,
skill_id: String,
changes: SkillUpdate,
) -> Result<usize, ServiceError>
pub async fn publish_skill_updated( &self, skill_id: String, changes: SkillUpdate, ) -> Result<usize, ServiceError>
Publish skill updated event
Sourcepub async fn publish_skill_unregistered(
&self,
skill_id: String,
) -> Result<usize, ServiceError>
pub async fn publish_skill_unregistered( &self, skill_id: String, ) -> Result<usize, ServiceError>
Publish skill unregistered event
Sourcepub async fn publish_skill_reloaded(
&self,
skill_id: String,
success: bool,
error_message: Option<String>,
) -> Result<usize, ServiceError>
pub async fn publish_skill_reloaded( &self, skill_id: String, success: bool, error_message: Option<String>, ) -> Result<usize, ServiceError>
Publish skill reloaded event
Sourcepub async fn publish_skill_validation_failed(
&self,
skill_id: String,
errors: Vec<String>,
) -> Result<usize, ServiceError>
pub async fn publish_skill_validation_failed( &self, skill_id: String, errors: Vec<String>, ) -> Result<usize, ServiceError>
Publish skill validation failed event
Sourcepub async fn publish_hot_reload_enabled(
&self,
config: HotReloadConfig,
) -> Result<usize, ServiceError>
pub async fn publish_hot_reload_enabled( &self, config: HotReloadConfig, ) -> Result<usize, ServiceError>
Publish hot reload enabled event
Sourcepub async fn publish_hot_reload_disabled(&self) -> Result<usize, ServiceError>
pub async fn publish_hot_reload_disabled(&self) -> Result<usize, ServiceError>
Publish hot reload disabled event
Sourcepub async fn publish_skill_enabled(
&self,
skill_id: String,
) -> Result<usize, ServiceError>
pub async fn publish_skill_enabled( &self, skill_id: String, ) -> Result<usize, ServiceError>
Publish skill enabled event
Sourcepub async fn publish_skill_disabled(
&self,
skill_id: String,
) -> Result<usize, ServiceError>
pub async fn publish_skill_disabled( &self, skill_id: String, ) -> Result<usize, ServiceError>
Publish skill disabled event
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> 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 moreCreates a shared type from an unshared type.