Skip to main content

ModuleCommunicationManager

Struct ModuleCommunicationManager 

Source
pub struct ModuleCommunicationManager { /* private fields */ }
Expand description

模块间通信管理器

Implementations§

Source§

impl ModuleCommunicationManager

Source

pub fn new() -> Self

创建新的模块通信管理器

Source

pub fn register_module( &self, module_id: String, name: String, version: String, ) -> Receiver<Message>

注册模块

Source

pub async fn send_message(&self, message: Message)

发送消息

Source

pub async fn broadcast_event( &self, event_type: EventType, data: Value, sender: String, )

广播事件

Source

pub fn register_event_listener(&self, event_type: EventType, module_id: String)

注册事件监听器

Source

pub fn remove_event_listener(&self, event_type: EventType, module_id: &String)

移除事件监听器

Source

pub fn update_module_status(&self, module_id: &String, status: ModuleStatus)

更新模块状态

Source

pub fn get_module_status(&self, module_id: &String) -> Option<ModuleStatus>

获取模块状态

Source

pub fn list_modules(&self) -> Vec<(String, ModuleInfo)>

列出所有模块

Source

pub async fn acknowledge_message(&self, message_id: &String)

确认消息

Source

pub async fn send_message_with_ack( &self, message: Message, ) -> Result<Message, String>

发送消息并等待确认

Source

pub async fn start_heartbeat(&self)

启动心跳检测

Source

pub async fn send_ping(&self, module_id: &String)

发送心跳消息

Source

pub async fn handle_pong(&self, module_id: &String)

处理心跳响应

Source

pub fn get_message_status(&self, message_id: &String) -> Option<MessageStatus>

获取消息状态

Source

pub fn cleanup_expired_messages(&self)

清理过期消息

Source

pub async fn send_message_batch(&self, batch: MessageBatch)

发送消息批次

Source

pub fn queue_message(&self, message: Message)

将消息加入批处理队列

Source

pub async fn process_message_batches(&self)

处理消息批次

Source

pub async fn start_batch_processor(&self)

启动批处理器

Source

pub fn cache_message(&self, key: String, value: Value)

缓存消息

Source

pub fn get_cached_message(&self, key: &str) -> Option<Value>

获取缓存的消息

Source

pub fn clear_cache(&self)

清除缓存

Source

pub fn set_batch_size_threshold(&mut self, threshold: usize)

设置批处理大小阈值

Source

pub fn set_batch_interval(&mut self, interval: u64)

设置批处理间隔

Source

pub fn set_cache_size_limit(&mut self, limit: usize)

设置缓存大小限制

Trait Implementations§

Source§

impl Clone for ModuleCommunicationManager

Source§

fn clone(&self) -> ModuleCommunicationManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Send for ModuleCommunicationManager

Source§

impl Sync for ModuleCommunicationManager

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V