Skip to main content

Statistics

Struct Statistics 

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

Соединение с сервисом STATISTICS от имени одной подсистемы.

Implementations§

Source§

impl Statistics

Source

pub async fn connect( runtime: &GnunetRuntime, config: &Config, subsystem: &str, ) -> Result<Self, StatisticsError>

Подключается к сервису. subsystem — имя подсистемы, под которым будут записываться показатели этого клиента.

Source

pub async fn set( &self, name: &str, value: u64, persistent: bool, ) -> Result<(), StatisticsError>

Устанавливает значение показателя своей подсистемы.

Значение ставится в локальную очередь на отправку. Подтверждения от сервиса нет: успех означает только, что запрос принят в очередь.

Source

pub async fn update( &self, name: &str, delta: i64, persistent: bool, ) -> Result<(), StatisticsError>

Прибавляет delta к показателю своей подсистемы (или вычитает, если delta отрицательна). Подтверждения от сервиса также нет.

Source

pub async fn get( &self, subsystem: Option<&str>, name: Option<&str>, max_entries: usize, ) -> Result<Vec<Statistic>, StatisticsError>

Читает показатели.

subsystem и name отбирают по подсистеме и имени; None означает «любые». max_entries ограничивает число результатов: при превышении запрос завершается ошибкой StatisticsError::TooManyResults, а не возвращает часть.

Source

pub async fn watch( &self, subsystem: &str, name: &str, ) -> Result<StatisticsWatch, StatisticsError>

Следит за одним показателем. Подписка хранит только последнее значение: промежуточные изменения могут быть пропущены.

Source

pub async fn close(self, sync_first: bool) -> Result<(), StatisticsError>

Закрывает соединение.

При sync_first = true GNUnet сначала отправит сервису значения, ожидающие в очереди; иначе они могут быть потеряны.

Trait Implementations§

Source§

impl Drop for Statistics

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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.