RRDCachedClient

Struct RRDCachedClient 

Source
pub struct RRDCachedClient<T = TcpStream> { /* private fields */ }
Expand description

A client to interact with a RRDCached server.

Implementations§

Source§

impl RRDCachedClient<TcpStream>

Source

pub async fn connect_tcp(addr: &str) -> Result<Self, RRDCachedClientError>

Connect to a RRDCached server over TCP.

Source§

impl RRDCachedClient<UnixStream>

Source

pub async fn connect_unix(addr: &str) -> Result<Self, RRDCachedClientError>

Connect to a RRDCached server over a Unix socket.

Source§

impl<T> RRDCachedClient<T>
where T: AsyncRead + AsyncWrite + Unpin,

Source

pub async fn help( &mut self, command: Option<&str>, ) -> Result<(String, Vec<String>), RRDCachedClientError>

Retreive documentation for humans.

Can take an optional command to get help for a specific command.

Source

pub async fn ping(&mut self) -> Result<(), RRDCachedClientError>

Ping the server to check if it’s alive.

Source

pub async fn create( &mut self, arguments: CreateArguments, ) -> Result<(), RRDCachedClientError>

Create a new RRD

Source

pub async fn flush(&mut self, path: &str) -> Result<(), RRDCachedClientError>

Flush a RRD

Source

pub async fn flush_all(&mut self) -> Result<(), RRDCachedClientError>

Flush all RRDs

Source

pub async fn pending( &mut self, path: &str, ) -> Result<Vec<String>, RRDCachedClientError>

Pending updates

Source

pub async fn forget(&mut self, path: &str) -> Result<(), RRDCachedClientError>

Forget pending updates

Source

pub async fn queue( &mut self, ) -> Result<Vec<(String, usize)>, RRDCachedClientError>

Get the queue information

Source

pub async fn stats( &mut self, ) -> Result<HashMap<String, i64>, RRDCachedClientError>

Get the server stats

Source

pub async fn first( &mut self, path: &str, round_robin_archive: Option<usize>, ) -> Result<usize, RRDCachedClientError>

Get the first CDP (whatever that is)

Source

pub async fn last(&mut self, path: &str) -> Result<usize, RRDCachedClientError>

Retrieve the last update timestamp

Source

pub async fn info( &mut self, path: &str, ) -> Result<Vec<String>, RRDCachedClientError>

Retreive information about a RRD

Source

pub async fn list( &mut self, recursive: bool, path: Option<&str>, ) -> Result<Vec<String>, RRDCachedClientError>

List RRDs

Source

pub async fn suspend(&mut self, path: &str) -> Result<(), RRDCachedClientError>

Suspend a RRD

Source

pub async fn resume(&mut self, path: &str) -> Result<(), RRDCachedClientError>

Resume a RRD

Source

pub async fn suspend_all(&mut self) -> Result<(), RRDCachedClientError>

Suspend all RRDs

Source

pub async fn resume_all(&mut self) -> Result<(), RRDCachedClientError>

Resume all RRDs

Source

pub async fn quit(&mut self) -> Result<(), RRDCachedClientError>

Close the connection to the server

Source

pub async fn update( &mut self, path: &str, timestamp: Option<usize>, data: Vec<f64>, ) -> Result<(), RRDCachedClientError>

Update a RRD with a list of values at a specific timestamp

The order is important as it must match the order of the data sources in the RRD

Source

pub async fn update_one( &mut self, path: &str, timestamp: Option<usize>, data: f64, ) -> Result<(), RRDCachedClientError>

Update a RRD with a single value at a specific timestamp.

Convenient helper when a RRD contains only one data source.

Source

pub async fn batch( &mut self, commands: Vec<BatchUpdate>, ) -> Result<(), RRDCachedClientError>

Batch updates.

RRDCached presents this as a more efficient way to update multiple RRDs at once. You may want to sort the updates by timestamp ascending as RDDtool will reject updates of older timestamps.

Source

pub async fn fetch( &mut self, path: &str, consolidation_function: ConsolidationFunction, start: Option<i64>, end: Option<i64>, columns: Option<Vec<String>>, ) -> Result<FetchResponse, RRDCachedClientError>

Fetch the content of a Round Robin Database (RRD)

Note that we use the Ascii protocol, as the binary protocol is not documented and it’s unsure whether it’s consitent between versions of RRDCached or system architectures.

Trait Implementations§

Source§

impl<T: Debug> Debug for RRDCachedClient<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RRDCachedClient<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for RRDCachedClient<T>
where T: RefUnwindSafe,

§

impl<T> Send for RRDCachedClient<T>
where T: Send,

§

impl<T> Sync for RRDCachedClient<T>
where T: Sync,

§

impl<T> Unpin for RRDCachedClient<T>
where T: Unpin,

§

impl<T> UnwindSafe for RRDCachedClient<T>
where T: UnwindSafe,

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.