pub struct NodeContext<'a> { /* private fields */ }Expand description
The single-node view handed to a task step: virtual time, a seeded stream, the network, the node’s disk, and the scenario event log.
Implementations§
Source§impl NodeContext<'_>
impl NodeContext<'_>
Sourcepub fn send(&mut self, to: NodeId, payload: impl Into<Vec<u8>>) -> SendOutcome
pub fn send(&mut self, to: NodeId, payload: impl Into<Vec<u8>>) -> SendOutcome
Sends a message, recording send/drop/duplicate/reorder events.
Sourcepub fn try_recv(&mut self) -> Option<Message>
pub fn try_recv(&mut self) -> Option<Message>
Pops the oldest message from this node’s inbox, if any.
Sourcepub fn disk_append(
&mut self,
path: &str,
bytes: &[u8],
) -> Result<usize, DiskError>
pub fn disk_append( &mut self, path: &str, bytes: &[u8], ) -> Result<usize, DiskError>
Appends to a file’s pending stage, recording the outcome.
Sourcepub fn disk_fsync(&mut self, path: &str) -> Result<(), DiskError>
pub fn disk_fsync(&mut self, path: &str) -> Result<(), DiskError>
Fsyncs a file, recording the outcome.
Sourcepub fn disk_read(&self, path: &str) -> Vec<u8> ⓘ
pub fn disk_read(&self, path: &str) -> Vec<u8> ⓘ
Live view of a file: durable bytes plus pending bytes.
Auto Trait Implementations§
impl<'a> !UnwindSafe for NodeContext<'a>
impl<'a> Freeze for NodeContext<'a>
impl<'a> RefUnwindSafe for NodeContext<'a>
impl<'a> Send for NodeContext<'a>
impl<'a> Sync for NodeContext<'a>
impl<'a> Unpin for NodeContext<'a>
impl<'a> UnsafeUnpin for NodeContext<'a>
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