Skip to main content

NetworkStatusCounter

Struct NetworkStatusCounter 

Source
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: u32

Counts the number of connection_established messages received

§connection_lost: u32

Counts the number of connection_lost messages received

§connection_dropped: u32

Counts the number of connection_dropped messages received

§connection_closed: u32

Counts 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: u32

Counts the number of SoftConnectionLimitExceeded messages received

§hard_connection_limit_reached: u32

Counts the number of HardConnectionLimitReached messages received

§network_out_of_buffers: u32

Counts the number of network_out_of_buffers messages received

§critical_network_failure: u32

Counts the number of CriticalNetworkFailure messages received

Implementations§

Source§

impl NetworkStatusCounter

Source

pub fn new() -> NetworkStatusCounter

Creates a new uninitialised NetworkStatusCounter with all counters set to 0

Source

pub fn set_status_sender(&mut self, sender: Sender<NetworkStatus>)

Sets a sender which the NetworkStatusCounter will foward all the NetworkStatus events to

Source

pub fn send_status_request(&mut self, request: NetworkStatusRequest)

triggers the given request on the NetworkStatusPort

Source

pub fn started_future(&mut self) -> KFuture<()>

Creates a future that will be fulfilled when the component starts

Source

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

Source§

type Message = ()

The type of local messages the actor accepts
Source§

fn receive_local(&mut self, _msg: Self::Message) -> HandlerResult

Handle an incoming local message Read more
Source§

fn receive_network(&mut self, _msg: NetMessage) -> HandlerResult

Handle an incoming network message Read more
Source§

impl ComponentDefinition for NetworkStatusCounter

Source§

fn setup(&mut self, self_component: Arc<Component<Self>>)

Prepare the component for being run Read more
Source§

fn execute(&mut self, max_events: usize, skip: usize) -> ExecuteResult

Execute events on the component’s ports Read more
Source§

fn ctx_mut(&mut self) -> &mut ComponentContext<Self>

Return a mutable reference the component’s context field
Source§

fn ctx(&self) -> &ComponentContext<Self>

Return a reference the component’s context field
Source§

fn type_name() -> &'static str

Return the name of the component’s type Read more
Source§

fn spawn_local<F>( &mut self, f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F, )
where Self: 'static, F: Future<Output = Result<Handled, HandlerError>> + Send + 'static,

Run a Future on this component, allowing it mutable access to the component’s internal state on every poll. Read more
Source§

fn spawn_off<R>( &self, future: impl Future<Output = R> + Send + 'static, ) -> Receiver<R>
where R: Send + 'static,

Run a Future on this system’s executor pool and return a handle to the result Read more
Source§

impl ComponentLifecycle for NetworkStatusCounter

Source§

fn on_start(&mut self) -> HandlerResult

Gets invoked every time a component receives a Start event Read more
Source§

fn on_stop(&mut self) -> HandlerResult

Gets invoked every time a component receives a Stop event Read more
Source§

fn on_kill(&mut self) -> HandlerResult

Gets invoked every time a component receives a Kill event Read more
Source§

impl Default for NetworkStatusCounter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl DynamicPortAccess for NetworkStatusCounter

Source§

fn get_provided_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>

Internal API. Dynamically obtain a mutable reference to a ProvidedPort if self provides a port of the type indicated by the passed port_id. Read more
Source§

fn get_required_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>

Internal API. Dynamically obtain a mutable reference to a RequiredPort if self requires a port of the type indicated by the passed port_id. Read more
Source§

impl Require<NetworkStatusPort> for NetworkStatusCounter

Source§

fn handle( &mut self, event: <NetworkStatusPort as Port>::Indication, ) -> HandlerResult

Handle the port’s event Read more
Source§

impl RequireRef<NetworkStatusPort> for NetworkStatusCounter

Source§

fn required_ref(&mut self) -> RequiredRef<NetworkStatusPort>

Returns a required reference to this component’s port instance of type P
Source§

fn connect_to_provided(&mut self, prov: ProvidedRef<NetworkStatusPort>)

Connects this component’s required port instance of type P to prov
Source§

fn disconnect(&mut self, prov: ProvidedRef<NetworkStatusPort>)

Disconnects this component’s required port instance of type P from prov

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<CD> ActorPathFactory for CD
where CD: ComponentTraits,

Source§

fn actor_path(&self) -> ActorPath

Returns the associated actor path.
Source§

impl<A, M> ActorRaw for A
where M: MessageBounds, A: Actor<Message = M>,

Source§

type Message = M

The type of local messages the actor accepts
Source§

fn receive(&mut self, env: MsgEnvelope<M>) -> Result<Handled, HandlerError>

Handle an incoming message Read more
Source§

impl<CD> ActorRefFactory for CD

Source§

type Message = <CD as ActorRaw>::Message

The type of messages carried by references produced by this factory
Source§

fn actor_ref(&self) -> ActorRef<<CD as ActorRefFactory>::Message>

Returns the associated actor reference
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<CD> ComponentLogging for CD

Source§

fn log(&self) -> &Logger<Arc<Fuse<Async>>>

Returns a reference to the component’s logger instance Read more
Source§

impl<CD> Dispatching for CD
where CD: ComponentTraits,

Source§

fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>

Returns the associated dispatcher reference.
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> 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<M, T, A> Receiver<T> for A
where T: Debug + 'static, M: From<T> + MessageBounds, A: ActorRefFactory<Message = M>,

Source§

fn recipient(&self) -> Recipient<T>

Produce a recipient for T
Source§

impl<CD> Timer<CD> for CD
where CD: ComponentTraits,

Source§

fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer

Schedule the action to be run once after timeout expires Read more
Source§

fn schedule_periodic<F>( &mut self, delay: Duration, period: Duration, action: F, ) -> ScheduledTimer
where F: Fn(&mut CD, ScheduledTimer) -> Result<Handled, HandlerError> + Send + 'static,

Schedule the action to be run every timeout time units Read more
Source§

fn cancel_timer(&mut self, handle: ScheduledTimer)

Cancel the timer indicated by the handle 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

Source§

impl<CD> ComponentTraits for CD
where CD: ComponentDefinition + ActorRaw + 'static,

Source§

impl<T> DynamicComponentDefinition for T

Source§

impl<T> Erased for T