-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(storage): support storage_class via Blob in AsyncAppendableObjectWriter #18318
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
base: main
Are you sure you want to change the base?
Changes from all commits
e2eab99
9797d34
41a8d06
8a67130
2840244
6da285c
850d7ef
934eddf
79dd50b
dc911f5
00c4954
ee44da7
7c27c72
deefaff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,9 @@ class _AsyncWriteObjectStream(_AsyncAbstractObjectStream): | |
| :type write_handle: _storage_v2.BidiWriteHandle | ||
| :param write_handle: (Optional) An existing handle for writing the object. | ||
| If provided, opening the bidi-gRPC connection will be faster. | ||
|
|
||
| :type storage_class: Optional[str] | ||
| :param storage_class: (Optional) The storage class of the object. | ||
| """ | ||
|
|
||
| def __init__( | ||
|
|
@@ -69,6 +72,7 @@ def __init__( | |
| write_handle: Optional[_storage_v2.BidiWriteHandle] = None, | ||
| routing_token: Optional[str] = None, | ||
| blob: Optional[Blob] = None, | ||
| storage_class: Optional[str] = None, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case is it possible that we would ignore the storage class specified in blob?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if blob is present blob's storage class will override the storage_class provided. See line no. 123/128 in this file. Also |
||
| ) -> None: | ||
| if client is None: | ||
| raise ValueError("client must be provided") | ||
|
|
@@ -86,6 +90,7 @@ def __init__( | |
| self.write_handle: Optional[_storage_v2.BidiWriteHandle] = write_handle | ||
| self.routing_token: Optional[str] = routing_token | ||
| self.blob: Optional[Blob] = blob | ||
| self.storage_class: Optional[str] = storage_class | ||
| self._full_bucket_name = f"projects/_/buckets/{self.bucket_name}" | ||
|
|
||
| self.rpc = self.client._client._transport._wrapped_methods[ | ||
|
|
@@ -124,7 +129,9 @@ async def open(self, metadata: Optional[List[Tuple[str, str]]] = None) -> None: | |
| resource = _grpc_conversions.blob_to_proto(self.blob) | ||
|
chandra-siri marked this conversation as resolved.
|
||
| else: | ||
| resource = _storage_v2.Object( | ||
| name=self.object_name, bucket=self._full_bucket_name | ||
| name=self.object_name, | ||
| bucket=self._full_bucket_name, | ||
| storage_class=self.storage_class, | ||
| ) | ||
| self.first_bidi_write_req = _storage_v2.BidiWriteObjectRequest( | ||
| write_object_spec=_storage_v2.WriteObjectSpec( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding parameter everytime there's a new configuration, wouldn't it be better to accept something like Blob which would have an option to set these fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we do have that option as well. see method
from_blobin this file.But we also need to support this method as well.