You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 5, 2025. It is now read-only.
we want to use zstd compression when compressing files for storage in
object storage because it performs better than gzip which is what we
were using before
these changes are only being made to the minio storage service because
we want to consolidate the storage service functionality into this one
so both worker and API will be using this backend in the future (API was
already using this one)
we have to manually decompress the zstd compressed files in read_file
but HTTPResponse takes care of it for us if the content encoding of the
file is gzip
the is_already_gzipped argument is being deprecated in favour of
compression_type and is_compressed, also the ability to pass a str to
write_file is being deprecated. we're keeping track of the use of these
using sentry capture_message
# Writes a file to storage will gzip if not compressed already
144
163
defwrite_file(
145
164
self,
146
-
bucket_name,
147
-
path,
148
-
data,
149
-
reduced_redundancy=False,
165
+
bucket_name: str,
166
+
path: str,
167
+
data: BinaryIO,
168
+
reduced_redundancy: bool=False,
150
169
*,
151
-
is_already_gzipped: bool=False,
170
+
is_already_gzipped: bool=False, # deprecated
171
+
is_compressed: bool=False,
172
+
compression_type: str="zstd",
152
173
):
174
+
ifis_already_gzipped:
175
+
log.warning(
176
+
"is_already_gzipped is deprecated and will be removed in a future version, instead compress using zstd and use the is_already_zstd_compressed argument"
177
+
)
178
+
withsentry_sdk.new_scope() asscope:
179
+
scope.set_extra("bucket_name", bucket_name)
180
+
scope.set_extra("path", path)
181
+
sentry_sdk.capture_message("is_already_gzipped passed with True")
182
+
is_compressed=True
183
+
compression_type="gzip"
184
+
153
185
ifisinstance(data, str):
154
-
data=data.encode()
186
+
log.warning(
187
+
"passing data as a str to write_file is deprecated and will be removed in a future version, instead pass an object compliant with the BinaryIO type"
188
+
)
189
+
withsentry_sdk.new_scope() asscope:
190
+
scope.set_extra("bucket_name", bucket_name)
191
+
scope.set_extra("path", path)
192
+
sentry_sdk.capture_message("write_file data argument passed as str")
0 commit comments