pub struct RRDCachedClient<T = TcpStream> { /* private fields */ }
Expand description
A client to interact with a RRDCached server.
Implementations§
Source§impl RRDCachedClient<TcpStream>
impl RRDCachedClient<TcpStream>
Sourcepub async fn connect_tcp(addr: &str) -> Result<Self, RRDCachedClientError>
pub async fn connect_tcp(addr: &str) -> Result<Self, RRDCachedClientError>
Connect to a RRDCached server over TCP.
Source§impl RRDCachedClient<UnixStream>
impl RRDCachedClient<UnixStream>
Sourcepub async fn connect_unix(addr: &str) -> Result<Self, RRDCachedClientError>
pub async fn connect_unix(addr: &str) -> Result<Self, RRDCachedClientError>
Connect to a RRDCached server over a Unix socket.
Source§impl<T> RRDCachedClient<T>
impl<T> RRDCachedClient<T>
Sourcepub async fn help(
&mut self,
command: Option<&str>,
) -> Result<(String, Vec<String>), RRDCachedClientError>
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.
Sourcepub async fn ping(&mut self) -> Result<(), RRDCachedClientError>
pub async fn ping(&mut self) -> Result<(), RRDCachedClientError>
Ping the server to check if it’s alive.
Sourcepub async fn create(
&mut self,
arguments: CreateArguments,
) -> Result<(), RRDCachedClientError>
pub async fn create( &mut self, arguments: CreateArguments, ) -> Result<(), RRDCachedClientError>
Create a new RRD
Sourcepub async fn flush_all(&mut self) -> Result<(), RRDCachedClientError>
pub async fn flush_all(&mut self) -> Result<(), RRDCachedClientError>
Flush all RRDs
Sourcepub async fn pending(
&mut self,
path: &str,
) -> Result<Vec<String>, RRDCachedClientError>
pub async fn pending( &mut self, path: &str, ) -> Result<Vec<String>, RRDCachedClientError>
Pending updates
Sourcepub async fn forget(&mut self, path: &str) -> Result<(), RRDCachedClientError>
pub async fn forget(&mut self, path: &str) -> Result<(), RRDCachedClientError>
Forget pending updates
Sourcepub async fn queue(
&mut self,
) -> Result<Vec<(String, usize)>, RRDCachedClientError>
pub async fn queue( &mut self, ) -> Result<Vec<(String, usize)>, RRDCachedClientError>
Get the queue information
Sourcepub async fn stats(
&mut self,
) -> Result<HashMap<String, i64>, RRDCachedClientError>
pub async fn stats( &mut self, ) -> Result<HashMap<String, i64>, RRDCachedClientError>
Get the server stats
Sourcepub async fn first(
&mut self,
path: &str,
round_robin_archive: Option<usize>,
) -> Result<usize, RRDCachedClientError>
pub async fn first( &mut self, path: &str, round_robin_archive: Option<usize>, ) -> Result<usize, RRDCachedClientError>
Get the first CDP (whatever that is)
Sourcepub async fn last(&mut self, path: &str) -> Result<usize, RRDCachedClientError>
pub async fn last(&mut self, path: &str) -> Result<usize, RRDCachedClientError>
Retrieve the last update timestamp
Sourcepub async fn info(
&mut self,
path: &str,
) -> Result<Vec<String>, RRDCachedClientError>
pub async fn info( &mut self, path: &str, ) -> Result<Vec<String>, RRDCachedClientError>
Retreive information about a RRD
Sourcepub async fn list(
&mut self,
recursive: bool,
path: Option<&str>,
) -> Result<Vec<String>, RRDCachedClientError>
pub async fn list( &mut self, recursive: bool, path: Option<&str>, ) -> Result<Vec<String>, RRDCachedClientError>
List RRDs
Sourcepub async fn suspend_all(&mut self) -> Result<(), RRDCachedClientError>
pub async fn suspend_all(&mut self) -> Result<(), RRDCachedClientError>
Suspend all RRDs
Sourcepub async fn resume_all(&mut self) -> Result<(), RRDCachedClientError>
pub async fn resume_all(&mut self) -> Result<(), RRDCachedClientError>
Resume all RRDs
Sourcepub async fn quit(&mut self) -> Result<(), RRDCachedClientError>
pub async fn quit(&mut self) -> Result<(), RRDCachedClientError>
Close the connection to the server
Sourcepub async fn update(
&mut self,
path: &str,
timestamp: Option<usize>,
data: Vec<f64>,
) -> Result<(), RRDCachedClientError>
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
Sourcepub async fn update_one(
&mut self,
path: &str,
timestamp: Option<usize>,
data: f64,
) -> Result<(), RRDCachedClientError>
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.
Sourcepub async fn batch(
&mut self,
commands: Vec<BatchUpdate>,
) -> Result<(), RRDCachedClientError>
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.
Sourcepub async fn fetch(
&mut self,
path: &str,
consolidation_function: ConsolidationFunction,
start: Option<i64>,
end: Option<i64>,
columns: Option<Vec<String>>,
) -> Result<FetchResponse, RRDCachedClientError>
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.