pub struct MockNode {
pub node_id: NodeId,
pub runtime: TestRuntime,
pub spawn_manager: SpawnManager,
pub watch_manager: WatchManager,
pub cancel_manager: CancelManager,
pub node_directory: NodeDirectory,
}Expand description
A simulated node in a MockCluster.
Each node has its own runtime, identity, and system actors for simulated remote operations (spawn, watch, cancel).
Fields§
§node_id: NodeId§runtime: TestRuntime§spawn_manager: SpawnManagerManages remote actor spawn requests for this node.
watch_manager: WatchManagerManages remote watch/unwatch subscriptions for this node.
cancel_manager: CancelManagerManages remote cancellation requests for this node.
node_directory: NodeDirectoryTracks peer node connection state.
Implementations§
Source§impl MockNode
impl MockNode
pub fn new(node_id: NodeId) -> Self
Sourcepub fn register_factory(
&mut self,
type_name: impl Into<String>,
factory: impl Fn(&[u8]) -> Result<Box<dyn Any + Send>, SerializationError> + Send + Sync + 'static,
)
pub fn register_factory( &mut self, type_name: impl Into<String>, factory: impl Fn(&[u8]) -> Result<Box<dyn Any + Send>, SerializationError> + Send + Sync + 'static, )
Register an actor type for remote spawning on this node.
Sourcepub fn connect_peer(&mut self, peer: &NodeId)
pub fn connect_peer(&mut self, peer: &NodeId)
Connect this node to a peer (marks as Connected in directory).
Sourcepub fn disconnect_peer(&mut self, peer: &NodeId)
pub fn disconnect_peer(&mut self, peer: &NodeId)
Disconnect a peer node.
Auto Trait Implementations§
impl !Freeze for MockNode
impl !RefUnwindSafe for MockNode
impl Send for MockNode
impl Sync for MockNode
impl Unpin for MockNode
impl UnsafeUnpin for MockNode
impl !UnwindSafe for MockNode
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