LinkStatus

Struct LinkStatus 

Source
pub struct LinkStatus { /* private fields */ }
Expand description

The LinkStatus can be used inside the nodes to keep track of the link status It embeds a protobuf LinkStatus message which is cloned each time has to be sent out The data_in and data_out functions can be called when new data is received or sent One of the change_state, state_ok, state_failed functions can be called when the link goes up or down. From time to time the send() can be called to send the data to Yamcs.

Implementations§

Source§

impl LinkStatus

Source

pub fn new(addr: Addr) -> Self

Source

pub fn data_in(&mut self, count: u64, size: u64)

increase the data in counters

Source

pub fn data_out(&mut self, count: u64, size: u64)

increase the data out counter

Source

pub fn change_state(&mut self, state: i32, err: Option<String>)

change the state

Source

pub fn state_ok(&mut self)

set the state to ok clear the error message

Source

pub fn state_failed(&mut self, msg: String)

set the state to failed with the given message

Source

pub async fn send(&self, tx: &Sender<YgwMessage>) -> Result<()>

send the status over the channel

Source

pub fn blocking_send(&self, tx: &Sender<YgwMessage>) -> Result<()>

send the status over the channel

Source

pub fn addr(&self) -> Addr

Source

pub fn data_in_count(&self) -> u64

Source

pub fn data_out_count(&self) -> u64

Auto Trait Implementations§

Blanket Implementations§

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<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, 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.