-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(storage): add enable_bucket_metadata_cache opt-out #18203
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
928fa2c
c90ab06
0d1d568
6bd83a8
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 |
|---|---|---|
|
|
@@ -126,6 +126,13 @@ class Client(ClientWithProject): | |
| (Optional) An API key. Mutually exclusive with any other credentials. | ||
| This parameter is an alias for setting `client_options.api_key` and | ||
| will supercede any api key set in the `client_options` parameter. | ||
|
|
||
| :type enable_bucket_metadata_cache: bool | ||
| :param enable_bucket_metadata_cache: | ||
| (Optional, default True) Enables the background bucket-metadata cache | ||
| (App-centric Observability / ACO). Setting this to False disables the | ||
| cache and the background ``storage.buckets.get`` probe it triggers on | ||
| object-level operations, for principals granted object-only IAM roles. | ||
| """ | ||
|
|
||
| SCOPE = ( | ||
|
|
@@ -146,6 +153,7 @@ def __init__( | |
| extra_headers={}, | ||
| *, | ||
| api_key=None, | ||
| enable_bucket_metadata_cache: bool = True, | ||
| ): | ||
| self._base_connection = None | ||
|
|
||
|
|
@@ -292,7 +300,10 @@ def __init__( | |
| connection.extra_headers = extra_headers | ||
| self._connection = connection | ||
| self._batch_stack = _LocalStack() | ||
| self._bucket_metadata_cache = BucketMetadataCache(self) | ||
| self._enable_bucket_metadata_cache = enable_bucket_metadata_cache | ||
| self._bucket_metadata_cache = ( | ||
| BucketMetadataCache(self) if enable_bucket_metadata_cache else None | ||
| ) | ||
|
Comment on lines
+304
to
+306
Contributor
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. Setting References
|
||
|
|
||
| def close(self): | ||
| """Close the client and clear any cached metadata or active connections.""" | ||
|
|
@@ -1189,9 +1200,9 @@ def create_bucket( | |
| predefined_default_object_acl = DefaultObjectACL.validate_predefined( | ||
| predefined_default_object_acl | ||
| ) | ||
| query_params["predefinedDefaultObjectAcl"] = ( | ||
| predefined_default_object_acl | ||
| ) | ||
| query_params[ | ||
| "predefinedDefaultObjectAcl" | ||
| ] = predefined_default_object_acl | ||
|
|
||
| if user_project is not None: | ||
| query_params["userProject"] = user_project | ||
|
|
||
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.
The import
from types import MethodTypeis unused in this test and should be removed to keep the code clean.References