-
Notifications
You must be signed in to change notification settings - Fork 133
feat(storage): add tracing and decorators #5963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vsharonlynn
wants to merge
13
commits into
googleapis:main
Choose a base branch
from
vsharonlynn:appendable_upload_5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
07b7af7
feat(storage): implement transport, connector, worker
vsharonlynn 005537a
Incorporate feedback
vsharonlynn a4ef212
Incorporate feedback
vsharonlynn b529ee4
Incorporate feedback
vsharonlynn 1a15a5a
Incorporate feedback
vsharonlynn 80f3311
Fix failing tests, format, lint, clippy, dead code
vsharonlynn 9cca986
Fix bugs
vsharonlynn 060e389
feat(storage): implement API, request builders, integration tests
vsharonlynn ae9609c
Incorporate feedback
vsharonlynn 0375696
Incorporate feedback
vsharonlynn 9ceced8
Clean up code
vsharonlynn 5e066c1
Update integration test
vsharonlynn aed02a5
feat(storage): add tracing and decorators
vsharonlynn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/storage/src/model_ext/open_appendable_object_request.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #[cfg_attr(docsrs, doc(cfg(feature = "unstable-stream")))] | ||
| /// Represents the parameters of a request to open a new object for exclusive appends. | ||
| /// | ||
| /// Consumers of the `google-cloud-storage` crate rarely have a need to use this type directly, the most common exception is when mocking of the `Storage` client. | ||
| #[derive(Clone, Debug, Default, PartialEq)] | ||
| #[non_exhaustive] | ||
| pub struct OpenAppendableObjectRequest { | ||
| /// The object attributes and pre-conditions for the open operation. | ||
| pub spec: crate::model::WriteObjectSpec, | ||
| /// Additional request parameters. | ||
| pub params: Option<crate::model::CommonObjectRequestParams>, | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn test_open_appendable_object_request() { | ||
| let req = OpenAppendableObjectRequest { | ||
| spec: crate::model::WriteObjectSpec::default(), | ||
| params: None, | ||
| }; | ||
| assert_eq!(req.spec.resource, None); | ||
| assert_eq!(req.params, None); | ||
| } | ||
| } |
87 changes: 87 additions & 0 deletions
87
src/storage/src/model_ext/reopen_appendable_object_request.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #[cfg_attr(docsrs, doc(cfg(feature = "unstable-stream")))] | ||
| /// Represents the parameters of a request to reopen an existing object for appends. | ||
| /// | ||
| /// Consumers of the `google-cloud-storage` crate rarely have a need to use this type directly, the most common exception is when mocking of the `Storage` client. | ||
| #[derive(Clone, Debug, Default, PartialEq)] | ||
| #[non_exhaustive] | ||
| pub struct ReopenAppendableObjectRequest { | ||
| /// The bucket containing the target object. | ||
| pub bucket: String, | ||
| /// The target object name. | ||
| pub object: String, | ||
| /// The target object generation to append to. | ||
| pub generation: i64, | ||
| /// If set, return an error if the current metageneration does not match the value. | ||
| pub if_metageneration_match: Option<i64>, | ||
| /// If set, return an error if the current metageneration matches the value. | ||
| pub if_metageneration_not_match: Option<i64>, | ||
| /// A routing token from a previous operation. | ||
| pub routing_token: Option<String>, | ||
| /// A write handle from a previous operation. | ||
| pub write_handle: Option<bytes::Bytes>, | ||
| /// Additional request parameters. | ||
| pub params: Option<crate::model::CommonObjectRequestParams>, | ||
| } | ||
|
|
||
| impl From<ReopenAppendableObjectRequest> for crate::google::storage::v2::AppendObjectSpec { | ||
| fn from(value: ReopenAppendableObjectRequest) -> Self { | ||
| Self { | ||
| bucket: value.bucket, | ||
| object: value.object, | ||
| generation: value.generation, | ||
| if_metageneration_match: value.if_metageneration_match, | ||
| if_metageneration_not_match: value.if_metageneration_not_match, | ||
| routing_token: value.routing_token, | ||
| write_handle: value | ||
| .write_handle | ||
| .map(|h| crate::google::storage::v2::BidiWriteHandle { handle: h }), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn test_reopen_appendable_object_request_from() { | ||
| let req = ReopenAppendableObjectRequest { | ||
| bucket: "my-bucket".into(), | ||
| object: "my-object".into(), | ||
| generation: 42, | ||
| if_metageneration_match: Some(1), | ||
| if_metageneration_not_match: Some(2), | ||
| routing_token: Some("token".into()), | ||
| write_handle: Some(bytes::Bytes::from("handle")), | ||
| params: None, | ||
| }; | ||
|
|
||
| let spec = crate::google::storage::v2::AppendObjectSpec::from(req); | ||
| assert_eq!(spec.bucket, "my-bucket"); | ||
| assert_eq!(spec.object, "my-object"); | ||
| assert_eq!(spec.generation, 42); | ||
| assert_eq!(spec.if_metageneration_match, Some(1)); | ||
| assert_eq!(spec.if_metageneration_not_match, Some(2)); | ||
| assert_eq!(spec.routing_token, Some("token".into())); | ||
| assert_eq!( | ||
| spec.write_handle, | ||
| Some(crate::google::storage::v2::BidiWriteHandle { | ||
| handle: bytes::Bytes::from("handle") | ||
| }) | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.