slbotbm commented on code in PR #3102:
URL: https://github.com/apache/iggy/pull/3102#discussion_r3161579355
##########
foreign/cpp/src/client.rs:
##########
@@ -378,6 +479,98 @@ impl Client {
Ok(())
})
}
+
+ pub fn get_stats(&self) -> Result<ffi::Stats, String> {
+ RUNTIME.block_on(async {
+ let stats = self
+ .inner
+ .get_stats()
+ .await
+ .map_err(|error| format!("Could not get stats: {error}"))?;
+ Ok(ffi::Stats::from(stats))
+ })
+ }
+
+ pub fn get_me(&self) -> Result<ffi::ClientInfoDetails, String> {
+ RUNTIME.block_on(async {
+ let client = self
+ .inner
+ .get_me()
+ .await
+ .map_err(|error| format!("Could not get current client info:
{error}"))?;
+ Ok(ffi::ClientInfoDetails::from(client))
+ })
+ }
+
+ pub fn get_client(&self, client_id: u32) -> Result<ffi::ClientInfoDetails,
String> {
+ RUNTIME.block_on(async {
+ let client = self
+ .inner
+ .get_client(client_id)
+ .await
+ .map_err(|error| format!("Could not get client '{client_id}':
{error}"))?;
+ ffi::ClientInfoDetails::try_from(client)
+ .map_err(|error| format!("Could not get client '{client_id}':
{error}"))
+ })
+ }
+
+ pub fn get_clients(&self) -> Result<Vec<ffi::ClientInfo>, String> {
+ RUNTIME.block_on(async {
+ let clients = self
+ .inner
+ .get_clients()
+ .await
+ .map_err(|error| format!("Could not get clients: {error}"))?;
+ Ok(clients.into_iter().map(ffi::ClientInfo::from).collect())
+ })
+ }
+
+ pub fn ping(&self) -> Result<(), String> {
+ RUNTIME.block_on(async {
+ self.inner
+ .ping()
+ .await
+ .map_err(|error| format!("Could not ping server: {error}"))?;
+ Ok(())
+ })
+ }
+
+ pub fn heartbeat_interval(&self) -> u64 {
+ RUNTIME.block_on(async {
self.inner.heartbeat_interval().await.as_micros() })
+ }
+
+ pub fn snapshot(
+ &self,
+ snapshot_compression: String,
+ snapshot_types: Vec<String>,
+ ) -> Result<Vec<u8>, String> {
+ let rust_compression = match snapshot_compression.trim() {
+ "" => RustSnapshotCompression::default(),
Review Comment:
client now rejects empty value for snapshot compression
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]