pub struct Statistics(/* private fields */);
Expand description
worker cluster statistics
Implementations§
Source§impl Statistics
impl Statistics
Sourcepub fn get_reporter(&self, transport: Transport) -> StatisticsReporter
pub fn get_reporter(&self, transport: Transport) -> StatisticsReporter
get signal sender
The signal sender can notify the statisticsing instance to update internal statistics.
§Example
use std::net::SocketAddr;
use turn_server::statistics::*;
use turn_server::stun::Transport;
use turn_server::turn::*;
let statistics = Statistics::default();
let sender = statistics.get_reporter(Transport::UDP);
let addr = SessionAddr {
address: "127.0.0.1:8080".parse().unwrap(),
interface: "127.0.0.1:3478".parse().unwrap(),
};
sender.send(&addr, &[Stats::ReceivedBytes(100)]);
Sourcepub fn register(&self, addr: SessionAddr)
pub fn register(&self, addr: SessionAddr)
Add an address to the watch list
§Example
use std::net::SocketAddr;
use turn_server::statistics::*;
use turn_server::turn::*;
let statistics = Statistics::default();
let addr = SessionAddr {
address: "127.0.0.1:8080".parse().unwrap(),
interface: "127.0.0.1:3478".parse().unwrap(),
};
statistics.register(addr.clone());
assert_eq!(statistics.get(&addr).is_some(), true);
Sourcepub fn unregister(&self, addr: &SessionAddr)
pub fn unregister(&self, addr: &SessionAddr)
Remove an address from the watch list
§Example
use std::net::SocketAddr;
use turn_server::statistics::*;
use turn_server::turn::*;
let statistics = Statistics::default();
let addr = SessionAddr {
address: "127.0.0.1:8080".parse().unwrap(),
interface: "127.0.0.1:3478".parse().unwrap(),
};
statistics.register(addr.clone());
assert_eq!(statistics.get(&addr).is_some(), true);
statistics.unregister(&addr);
assert_eq!(statistics.get(&addr).is_some(), false);
Sourcepub fn get(&self, addr: &SessionAddr) -> Option<Counts<usize>>
pub fn get(&self, addr: &SessionAddr) -> Option<Counts<usize>>
Obtain a list of statistics from statisticsing
The obtained list is in the same order as it was added.
§Example
use std::net::SocketAddr;
use turn_server::statistics::*;
use turn_server::turn::*;
let statistics = Statistics::default();
let addr = SessionAddr {
address: "127.0.0.1:8080".parse().unwrap(),
interface: "127.0.0.1:3478".parse().unwrap(),
};
statistics.register(addr.clone());
assert_eq!(statistics.get(&addr).is_some(), true);
Trait Implementations§
Source§impl Clone for Statistics
impl Clone for Statistics
Source§fn clone(&self) -> Statistics
fn clone(&self) -> Statistics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Statistics
impl !RefUnwindSafe for Statistics
impl Send for Statistics
impl Sync for Statistics
impl Unpin for Statistics
impl !UnwindSafe for Statistics
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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