Struct shadow_rs::core::worker::WorkerShared
source · pub struct WorkerShared {
pub ip_assignment: IpAssignment<u32>,
pub routing_info: RoutingInfo<u32>,
pub host_bandwidths: HashMap<IpAddr, Bandwidth>,
pub dns: SyncSendPointer<DNS>,
pub status_logger_state: Option<Arc<Status<ShadowStatusBarState>>>,
pub num_plugin_errors: AtomicU32,
pub runahead: Runahead,
pub child_pid_watcher: ChildPidWatcher,
pub event_queues: HashMap<HostId, Arc<Mutex<EventQueue>>>,
pub bootstrap_end_time: EmulatedTime,
pub sim_end_time: EmulatedTime,
}
Fields§
§ip_assignment: IpAssignment<u32>
§routing_info: RoutingInfo<u32>
§host_bandwidths: HashMap<IpAddr, Bandwidth>
§dns: SyncSendPointer<DNS>
§status_logger_state: Option<Arc<Status<ShadowStatusBarState>>>
§num_plugin_errors: AtomicU32
§runahead: Runahead
§child_pid_watcher: ChildPidWatcher
§event_queues: HashMap<HostId, Arc<Mutex<EventQueue>>>
Event queues for each host. This should only be used to push packet events.
bootstrap_end_time: EmulatedTime
§sim_end_time: EmulatedTime
Implementations§
pub fn dns(&self) -> &DNS
pub fn latency(&self, src: IpAddr, dst: IpAddr) -> Option<SimulationTime>
pub fn reliability(&self, src: IpAddr, dst: IpAddr) -> Option<f32>
pub fn bandwidth(&self, ip: IpAddr) -> Option<&Bandwidth>
pub fn increment_packet_count(&self, src: IpAddr, dst: IpAddr)
pub fn is_routable(&self, src: IpAddr, dst: IpAddr) -> bool
pub fn resolve_ip_to_host_id(&self, ip: Ipv4Addr) -> Option<HostId>
pub fn increment_plugin_error_count(&self)
pub fn plugin_error_count(&self) -> u32
sourcepub fn update_status_logger(&self, f: impl FnOnce(&mut ShadowStatusBarState))
pub fn update_status_logger(&self, f: impl FnOnce(&mut ShadowStatusBarState))
Update the status logger. If the status logger is disabled, this will be a no-op.
pub fn get_runahead(&self) -> SimulationTime
sourcepub fn child_pid_watcher(&self) -> &ChildPidWatcher
pub fn child_pid_watcher(&self) -> &ChildPidWatcher
Get the pid watcher.
sourcepub fn push_packet_to_host(
&self,
packet: PacketRc,
dst_host_id: HostId,
time: EmulatedTime,
src_host: &Host,
)
pub fn push_packet_to_host( &self, packet: PacketRc, dst_host_id: HostId, time: EmulatedTime, src_host: &Host, )
Push a packet to the destination host’s event queue. Does not check that the time is valid (is outside of the current scheduling round, etc).
Trait Implementations§
Auto Trait Implementations§
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> 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 more