spetz commented on code in PR #1624:
URL: https://github.com/apache/iggy/pull/1624#discussion_r1991811833


##########
sdk/src/http/segments.rs:
##########
@@ -0,0 +1,38 @@
+use crate::client::SegmentClient;
+use crate::error::IggyError;
+use crate::http::client::HttpClient;
+use crate::http::HttpTransport;
+use crate::identifier::Identifier;
+use crate::segments::delete_segments::DeleteSegments;
+use async_trait::async_trait;
+
+#[async_trait]
+impl SegmentClient for HttpClient {
+    async fn delete_segments(
+        &self,
+        stream_id: &Identifier,
+        topic_id: &Identifier,
+        partition_id: u32,
+        segments_count: u32,
+    ) -> Result<(), IggyError> {
+        self.delete_with_query(
+            &get_path(
+                &stream_id.as_cow_str(),
+                &topic_id.as_cow_str(),
+                partition_id,
+            ),
+            &DeleteSegments {
+                stream_id: stream_id.clone(),
+                topic_id: topic_id.clone(),
+                partition_id,
+                segments_count,
+            },
+        )
+        .await?;
+        Ok(())
+    }
+}
+
+fn get_path(stream_id: &str, topic_id: &str, partition_id: u32) -> String {
+    format!("streams/{stream_id}/topics/{topic_id}/partitions/{partition_id}")

Review Comment:
   That's correct, and I think that similar to how is `DeletePartitions` 
handled in HTTP API, we could do the same for segments - simply provide 
`semgnets_count` as part of the query string for the path above :)



-- 
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]

Reply via email to