-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve new minio implementation
The team mentioned wanting to ship the new read implementation first then the new write implementation so this commit enables that. i'm folding the NewMinioStorageService functionality back into the MinioStorageService and creating 2 new feature flags one for read and one for write. Based on the values of those feature flags the MinioStorageService will choose an implementation of read/write. I also removed the old USE_NEW_MINIO feature flag, and modified the get_appropriate_storage_service function to make it so it no longer caches the MinioStorageService and instead the MinioStorageService is caching its internal minio_client since that is the expensive part of creating a new MinioStorageService instance. I also moved some code around
- Loading branch information
1 parent
ec4b5fb
commit 87f3a30
Showing
10 changed files
with
467 additions
and
676 deletions.
There are no files selected for viewing
This file contains 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 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 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,34 @@ | ||
import gzip | ||
import importlib.metadata | ||
from typing import IO | ||
|
||
|
||
class GZipStreamReader: | ||
def __init__(self, fileobj: IO[bytes]): | ||
self.data = fileobj | ||
|
||
def read(self, size: int = -1, /) -> bytes: | ||
curr_data = self.data.read(size) | ||
|
||
if not curr_data: | ||
return b"" | ||
|
||
return gzip.compress(curr_data) | ||
|
||
|
||
def zstd_decoded_by_default() -> bool: | ||
try: | ||
version = importlib.metadata.version("urllib3") | ||
except importlib.metadata.PackageNotFoundError: | ||
return False | ||
|
||
if version < "2.0.0": | ||
return False | ||
|
||
distribution = importlib.metadata.metadata("urllib3") | ||
if requires_dist := distribution.get_all("Requires-Dist"): | ||
for req in requires_dist: | ||
if "[zstd]" in req: | ||
return True | ||
|
||
return False | ||
Oops, something went wrong.