pub struct NetworkStatusCounter {
pub network_status_port: RequiredPort<NetworkStatusPort>,
pub connection_established: u32,
pub connection_lost: u32,
pub connection_dropped: u32,
pub connection_closed: u32,
pub connected_systems: Vec<(SystemPath, SessionId)>,
pub disconnected_systems: Vec<(SystemPath, SessionId)>,
pub soft_connection_limit_exceeded: u32,
pub hard_connection_limit_reached: u32,
pub network_out_of_buffers: u32,
pub critical_network_failure: u32,
/* private fields */
}Expand description
Actor which can subscribe to the NetworkStatusPort and maintains a counter of how many
of each kind of NetworkStatusUpdate has been received.
Fields§
§network_status_port: RequiredPort<NetworkStatusPort>The NetworkStatusPort, needs to be exposed to allow connecting to it
connection_established: u32Counts the number of connection_established messages received
connection_lost: u32Counts the number of connection_lost messages received
connection_dropped: u32Counts the number of connection_dropped messages received
connection_closed: u32Counts the number of connection_closed messages received
connected_systems: Vec<(SystemPath, SessionId)>Contains all SystemPath’s received in a ConnectionEstablished
disconnected_systems: Vec<(SystemPath, SessionId)>Contains all SystemPath’s received in a ConnectionLost or ConnectionClosed message
soft_connection_limit_exceeded: u32Counts the number of SoftConnectionLimitExceeded messages received
hard_connection_limit_reached: u32Counts the number of HardConnectionLimitReached messages received
network_out_of_buffers: u32Counts the number of network_out_of_buffers messages received
critical_network_failure: u32Counts the number of CriticalNetworkFailure messages received
Implementations§
Source§impl NetworkStatusCounter
impl NetworkStatusCounter
Sourcepub fn new() -> NetworkStatusCounter
pub fn new() -> NetworkStatusCounter
Creates a new uninitialised NetworkStatusCounter with all counters set to 0
Sourcepub fn set_status_sender(&mut self, sender: Sender<NetworkStatus>)
pub fn set_status_sender(&mut self, sender: Sender<NetworkStatus>)
Sets a sender which the NetworkStatusCounter will foward all the NetworkStatus events to
Sourcepub fn send_status_request(&mut self, request: NetworkStatusRequest)
pub fn send_status_request(&mut self, request: NetworkStatusRequest)
triggers the given request on the NetworkStatusPort
Sourcepub fn started_future(&mut self) -> KFuture<()> ⓘ
pub fn started_future(&mut self) -> KFuture<()> ⓘ
Creates a future that will be fulfilled when the component starts
Sourcepub fn corrupt_network(&mut self) -> Result<(), SerError>
pub fn corrupt_network(&mut self) -> Result<(), SerError>
Creates a faulty Message which will cause the local NetworkThread to panic when it tries to send it to the remote host.
Fails to corrupt the network if there are no connected systems to use as receiver for the corrupt message and returns an error instead.
Trait Implementations§
Source§impl Actor for NetworkStatusCounter
impl Actor for NetworkStatusCounter
Source§fn receive_local(&mut self, _msg: Self::Message) -> HandlerResult
fn receive_local(&mut self, _msg: Self::Message) -> HandlerResult
Source§fn receive_network(&mut self, _msg: NetMessage) -> HandlerResult
fn receive_network(&mut self, _msg: NetMessage) -> HandlerResult
Source§impl ComponentDefinition for NetworkStatusCounter
impl ComponentDefinition for NetworkStatusCounter
Source§fn setup(&mut self, self_component: Arc<Component<Self>>)
fn setup(&mut self, self_component: Arc<Component<Self>>)
Source§fn execute(&mut self, max_events: usize, skip: usize) -> ExecuteResult
fn execute(&mut self, max_events: usize, skip: usize) -> ExecuteResult
Source§fn ctx_mut(&mut self) -> &mut ComponentContext<Self>
fn ctx_mut(&mut self) -> &mut ComponentContext<Self>
Source§fn ctx(&self) -> &ComponentContext<Self>
fn ctx(&self) -> &ComponentContext<Self>
Source§fn spawn_local<F>(
&mut self,
f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F,
)
fn spawn_local<F>( &mut self, f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F, )
Source§impl ComponentLifecycle for NetworkStatusCounter
impl ComponentLifecycle for NetworkStatusCounter
Source§fn on_start(&mut self) -> HandlerResult
fn on_start(&mut self) -> HandlerResult
Source§fn on_stop(&mut self) -> HandlerResult
fn on_stop(&mut self) -> HandlerResult
Source§fn on_kill(&mut self) -> HandlerResult
fn on_kill(&mut self) -> HandlerResult
Source§impl Default for NetworkStatusCounter
impl Default for NetworkStatusCounter
Source§impl DynamicPortAccess for NetworkStatusCounter
impl DynamicPortAccess for NetworkStatusCounter
Source§fn get_provided_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
fn get_provided_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
ProvidedPort if self
provides a port of the type indicated by the passed port_id. Read moreSource§fn get_required_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
fn get_required_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
RequiredPort if self
requires a port of the type indicated by the passed port_id. Read moreSource§impl Require<NetworkStatusPort> for NetworkStatusCounter
impl Require<NetworkStatusPort> for NetworkStatusCounter
Source§fn handle(
&mut self,
event: <NetworkStatusPort as Port>::Indication,
) -> HandlerResult
fn handle( &mut self, event: <NetworkStatusPort as Port>::Indication, ) -> HandlerResult
event Read moreSource§impl RequireRef<NetworkStatusPort> for NetworkStatusCounter
impl RequireRef<NetworkStatusPort> for NetworkStatusCounter
Source§fn required_ref(&mut self) -> RequiredRef<NetworkStatusPort>
fn required_ref(&mut self) -> RequiredRef<NetworkStatusPort>
PSource§fn connect_to_provided(&mut self, prov: ProvidedRef<NetworkStatusPort>)
fn connect_to_provided(&mut self, prov: ProvidedRef<NetworkStatusPort>)
P to provSource§fn disconnect(&mut self, prov: ProvidedRef<NetworkStatusPort>)
fn disconnect(&mut self, prov: ProvidedRef<NetworkStatusPort>)
P from provAuto Trait Implementations§
impl !Freeze for NetworkStatusCounter
impl !RefUnwindSafe for NetworkStatusCounter
impl Send for NetworkStatusCounter
impl !Sync for NetworkStatusCounter
impl Unpin for NetworkStatusCounter
impl UnsafeUnpin for NetworkStatusCounter
impl !UnwindSafe for NetworkStatusCounter
Blanket Implementations§
Source§impl<CD> ActorPathFactory for CDwhere
CD: ComponentTraits,
impl<CD> ActorPathFactory for CDwhere
CD: ComponentTraits,
Source§fn actor_path(&self) -> ActorPath
fn actor_path(&self) -> ActorPath
Source§impl<A, M> ActorRaw for Awhere
M: MessageBounds,
A: Actor<Message = M>,
impl<A, M> ActorRaw for Awhere
M: MessageBounds,
A: Actor<Message = M>,
Source§impl<CD> ActorRefFactory for CDwhere
CD: ComponentDefinition,
impl<CD> ActorRefFactory for CDwhere
CD: ComponentDefinition,
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
Source§impl<CD> ComponentLogging for CDwhere
CD: ComponentTraits + ComponentLifecycle,
impl<CD> ComponentLogging for CDwhere
CD: ComponentTraits + ComponentLifecycle,
Source§impl<CD> Dispatching for CDwhere
CD: ComponentTraits,
impl<CD> Dispatching for CDwhere
CD: ComponentTraits,
Source§fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<CD> Timer<CD> for CDwhere
CD: ComponentTraits,
impl<CD> Timer<CD> for CDwhere
CD: ComponentTraits,
Source§fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer
fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer
Source§fn schedule_periodic<F>(
&mut self,
delay: Duration,
period: Duration,
action: F,
) -> ScheduledTimer
fn schedule_periodic<F>( &mut self, delay: Duration, period: Duration, action: F, ) -> ScheduledTimer
Source§fn cancel_timer(&mut self, handle: ScheduledTimer)
fn cancel_timer(&mut self, handle: ScheduledTimer)
handle Read more