feat(storage): Support GCS Object Compose - DRAFT#5717
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the compose_object functionality for the Google Cloud Storage service, enabling the concatenation of multiple source objects into a single composite object. The changes include the addition of the ComposeObject request builder, updates to the Storage client and trait, and the implementation of gRPC transport logic with tracing support. Feedback recommends enhancing the ComposeObject builder by adding a fluent add_metadata method to allow for more ergonomic addition of individual metadata entries.
| pub fn set_metadata(mut self, metadata: std::collections::HashMap<String, String>) -> Self { | ||
| if let Some(ref mut dest) = self.request.destination { | ||
| dest.metadata = metadata; | ||
| } | ||
| self | ||
| } |
There was a problem hiding this comment.
While set_metadata allows replacing the entire metadata map, it is often more idiomatic in builder patterns to provide a fluent method for adding individual metadata entries. This improves usability when the user only needs to set a few custom attributes without constructing a full HashMap themselves.
/// Adds a custom metadata attribute for the destination composite object.
pub fn add_metadata<K, V>(mut self, key: K, value: V) -> Self
where
K: Into<String>,
V: Into<String>,
{
if let Some(ref mut dest) = self.request.destination {
dest.metadata.insert(key.into(), value.into());
}
self
}
/// Sets custom metadata attributes for the destination composite object.
pub fn set_metadata(mut self, metadata: std::collections::HashMap<String, String>) -> Self {
if let Some(ref mut dest) = self.request.destination {
dest.metadata = metadata;
}
self
}References
- In code samples and examples, prioritize demonstrating the methods that are most likely to be used by developers in typical scenarios, even if safer alternatives exist.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5717 +/- ##
==========================================
- Coverage 97.89% 97.83% -0.06%
==========================================
Files 226 227 +1
Lines 55471 55707 +236
==========================================
+ Hits 54303 54503 +200
- Misses 1168 1204 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
coryan
left a comment
There was a problem hiding this comment.
What is the motivation for this? This exists in StorageControl:
Why are you creating more work for yourself?
DRAFT, DO NOT REVIEW YET
This PR introduces the GCS Object Compose feature into the developer-facing handwritten Storage client of the google-cloud-rust SDK.
Key Additions