18 lines
464 B
Rust
18 lines
464 B
Rust
use once_cell::sync::Lazy;
|
|
use std::sync::Arc;
|
|
use tokio::sync::broadcast;
|
|
|
|
use super::event_bus::EventBus;
|
|
use crate::executor::ExecutorCommand;
|
|
|
|
static EXECUTOR_EVENT_BUS: Lazy<Arc<EventBus<ExecutorCommand>>> =
|
|
Lazy::new(|| Arc::new(EventBus::new()));
|
|
|
|
pub fn publish_executor_event(event: ExecutorCommand) {
|
|
EXECUTOR_EVENT_BUS.publish(event);
|
|
}
|
|
|
|
pub fn subscribe_executor_event() -> broadcast::Receiver<ExecutorCommand> {
|
|
EXECUTOR_EVENT_BUS.subscribe()
|
|
}
|