nucliadb-utils 6.7.2.post4876__py3-none-any.whl → 6.7.2.post4878__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nucliadb_utils/storages/azure.py +16 -0
- {nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/METADATA +3 -3
- {nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/RECORD +5 -5
- {nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/WHEEL +0 -0
- {nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/top_level.txt +0 -0
nucliadb_utils/storages/azure.py
CHANGED
@@ -30,6 +30,7 @@ from azure.storage.blob import BlobProperties, BlobType, ContentSettings
|
|
30
30
|
from azure.storage.blob.aio import BlobServiceClient
|
31
31
|
|
32
32
|
from nucliadb_protos.resources_pb2 import CloudFile
|
33
|
+
from nucliadb_telemetry import metrics
|
33
34
|
from nucliadb_utils.storages.exceptions import ObjectNotFoundError
|
34
35
|
from nucliadb_utils.storages.object_store import ObjectStore
|
35
36
|
from nucliadb_utils.storages.storage import Storage, StorageField
|
@@ -37,6 +38,8 @@ from nucliadb_utils.storages.utils import ObjectInfo, ObjectMetadata, Range
|
|
37
38
|
|
38
39
|
logger = logging.getLogger(__name__)
|
39
40
|
|
41
|
+
ops_observer = metrics.Observer("azure_ops", labels={"type": ""})
|
42
|
+
|
40
43
|
|
41
44
|
class AzureStorageField(StorageField):
|
42
45
|
storage: AzureStorage
|
@@ -256,6 +259,7 @@ class AzureObjectStore(ObjectStore):
|
|
256
259
|
logger.warning("Error closing Azure client", exc_info=True)
|
257
260
|
self._service_client = None
|
258
261
|
|
262
|
+
@ops_observer.wrap({"type": "bucket_create"})
|
259
263
|
async def bucket_create(self, bucket: str, labels: dict[str, str] | None = None) -> bool:
|
260
264
|
container_client = self.service_client.get_container_client(bucket)
|
261
265
|
try:
|
@@ -264,6 +268,7 @@ class AzureObjectStore(ObjectStore):
|
|
264
268
|
except ResourceExistsError:
|
265
269
|
return False
|
266
270
|
|
271
|
+
@ops_observer.wrap({"type": "bucket_delete"})
|
267
272
|
async def bucket_delete(self, bucket: str) -> tuple[bool, bool]:
|
268
273
|
container_client = self.service_client.get_container_client(bucket)
|
269
274
|
# There's never a conflict on Azure
|
@@ -276,6 +281,7 @@ class AzureObjectStore(ObjectStore):
|
|
276
281
|
deleted = False
|
277
282
|
return deleted, conflict
|
278
283
|
|
284
|
+
@ops_observer.wrap({"type": "bucket_exists"})
|
279
285
|
async def bucket_exists(self, bucket: str) -> bool:
|
280
286
|
container_client = self.service_client.get_container_client(bucket)
|
281
287
|
try:
|
@@ -284,10 +290,12 @@ class AzureObjectStore(ObjectStore):
|
|
284
290
|
except ResourceNotFoundError:
|
285
291
|
return False
|
286
292
|
|
293
|
+
@ops_observer.wrap({"type": "bucket_schedule_delete"})
|
287
294
|
async def bucket_schedule_delete(self, bucket: str) -> None:
|
288
295
|
# In Azure, there is no option to schedule for deletion
|
289
296
|
await self.bucket_delete(bucket)
|
290
297
|
|
298
|
+
@ops_observer.wrap({"type": "move"})
|
291
299
|
async def move(
|
292
300
|
self,
|
293
301
|
origin_bucket: str,
|
@@ -298,6 +306,7 @@ class AzureObjectStore(ObjectStore):
|
|
298
306
|
await self.copy(origin_bucket, origin_key, destination_bucket, destination_key)
|
299
307
|
await self.delete(origin_bucket, origin_key)
|
300
308
|
|
309
|
+
@ops_observer.wrap({"type": "copy"})
|
301
310
|
async def copy(
|
302
311
|
self,
|
303
312
|
origin_bucket: str,
|
@@ -313,6 +322,7 @@ class AzureObjectStore(ObjectStore):
|
|
313
322
|
result = await destination_blob_client.start_copy_from_url(origin_url, requires_sync=True)
|
314
323
|
assert result["copy_status"] == "success"
|
315
324
|
|
325
|
+
@ops_observer.wrap({"type": "delete"})
|
316
326
|
async def delete(self, bucket: str, key: str) -> None:
|
317
327
|
container_client = self.service_client.get_container_client(bucket)
|
318
328
|
try:
|
@@ -320,6 +330,7 @@ class AzureObjectStore(ObjectStore):
|
|
320
330
|
except ResourceNotFoundError:
|
321
331
|
raise ObjectNotFoundError()
|
322
332
|
|
333
|
+
@ops_observer.wrap({"type": "upload"})
|
323
334
|
async def upload(
|
324
335
|
self,
|
325
336
|
bucket: str,
|
@@ -347,10 +358,12 @@ class AzureObjectStore(ObjectStore):
|
|
347
358
|
),
|
348
359
|
)
|
349
360
|
|
361
|
+
@ops_observer.wrap({"type": "insert"})
|
350
362
|
async def insert(self, bucket: str, key: str, data: bytes) -> None:
|
351
363
|
container_client = self.service_client.get_container_client(bucket)
|
352
364
|
await container_client.upload_blob(name=key, data=data, length=len(data))
|
353
365
|
|
366
|
+
@ops_observer.wrap({"type": "download"})
|
354
367
|
async def download(self, bucket: str, key: str) -> bytes:
|
355
368
|
container_client = self.service_client.get_container_client(bucket)
|
356
369
|
blob_client = container_client.get_blob_client(key)
|
@@ -390,6 +403,7 @@ class AzureObjectStore(ObjectStore):
|
|
390
403
|
continue
|
391
404
|
yield ObjectInfo(name=blob.name)
|
392
405
|
|
406
|
+
@ops_observer.wrap({"type": "get_metadata"})
|
393
407
|
async def get_metadata(self, bucket: str, key: str) -> ObjectMetadata:
|
394
408
|
container_client = self.service_client.get_container_client(bucket)
|
395
409
|
blob_client = container_client.get_blob_client(key)
|
@@ -399,6 +413,7 @@ class AzureObjectStore(ObjectStore):
|
|
399
413
|
except ResourceNotFoundError:
|
400
414
|
raise ObjectNotFoundError()
|
401
415
|
|
416
|
+
@ops_observer.wrap({"type": "multipart_start"})
|
402
417
|
async def upload_multipart_start(self, bucket: str, key: str, metadata: ObjectMetadata) -> None:
|
403
418
|
container_client = self.service_client.get_container_client(bucket)
|
404
419
|
custom_metadata = {key: str(value) for key, value in metadata.model_dump().items()}
|
@@ -411,6 +426,7 @@ class AzureObjectStore(ObjectStore):
|
|
411
426
|
),
|
412
427
|
)
|
413
428
|
|
429
|
+
@ops_observer.wrap({"type": "multipart_append"})
|
414
430
|
async def upload_multipart_append(
|
415
431
|
self, bucket: str, key: str, iterable: AsyncIterator[bytes]
|
416
432
|
) -> int:
|
{nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nucliadb_utils
|
3
|
-
Version: 6.7.2.
|
3
|
+
Version: 6.7.2.post4878
|
4
4
|
Summary: NucliaDB util library
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
@@ -27,8 +27,8 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
|
|
27
27
|
Requires-Dist: PyNaCl
|
28
28
|
Requires-Dist: pyjwt>=2.4.0
|
29
29
|
Requires-Dist: mrflagly>=0.2.9
|
30
|
-
Requires-Dist: nucliadb-protos>=6.7.2.
|
31
|
-
Requires-Dist: nucliadb-telemetry>=6.7.2.
|
30
|
+
Requires-Dist: nucliadb-protos>=6.7.2.post4878
|
31
|
+
Requires-Dist: nucliadb-telemetry>=6.7.2.post4878
|
32
32
|
Provides-Extra: cache
|
33
33
|
Requires-Dist: redis>=4.3.4; extra == "cache"
|
34
34
|
Requires-Dist: orjson>=3.6.7; extra == "cache"
|
@@ -39,7 +39,7 @@ nucliadb_utils/nuclia_usage/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn
|
|
39
39
|
nucliadb_utils/nuclia_usage/utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
40
40
|
nucliadb_utils/nuclia_usage/utils/kb_usage_report.py,sha256=6lLuxCCPQVn3dOuZNL5ThPjl2yws-1TJ_7duhQSWkPU,3934
|
41
41
|
nucliadb_utils/storages/__init__.py,sha256=5Qc8AUWiJv9_JbGCBpAn88AIJhwDlm0OPQpg2ZdRL4U,872
|
42
|
-
nucliadb_utils/storages/azure.py,sha256=
|
42
|
+
nucliadb_utils/storages/azure.py,sha256=EEUyi-2c69FQz8iPhKixkZDp8xVMgMFGEPaZDVuillc,17429
|
43
43
|
nucliadb_utils/storages/exceptions.py,sha256=GOPKH-F3dPTfHEkwGNfVkSfF70eWJJXjI83yccw9WpA,2501
|
44
44
|
nucliadb_utils/storages/gcs.py,sha256=XbtX0Lt3GO7kzuJ1E5CdazlpSqjU46Bhhezq32VQUok,29041
|
45
45
|
nucliadb_utils/storages/local.py,sha256=2aCHpZymORG_dUc1FDq0VFcgQulu0w2pZiUaj9dphFs,11686
|
@@ -57,7 +57,7 @@ nucliadb_utils/tests/gcs.py,sha256=MBMzn_UHU5SU6iILuCsB5zU4umhNcaCw_MKrxZhwvOc,4
|
|
57
57
|
nucliadb_utils/tests/local.py,sha256=z9E11_ol1mu7N8Y6PkjKl-WMPPMl7JqQbDj3uhVa1A0,1933
|
58
58
|
nucliadb_utils/tests/nats.py,sha256=RWHjwqq5esuO7OFbP24yYX1cXnpPLcWJwDUdmwCpH28,1897
|
59
59
|
nucliadb_utils/tests/s3.py,sha256=kz9ULxrAYLVslZ59I8dtweZ9DJz5R8Ioy2XYrveZzHw,3829
|
60
|
-
nucliadb_utils-6.7.2.
|
61
|
-
nucliadb_utils-6.7.2.
|
62
|
-
nucliadb_utils-6.7.2.
|
63
|
-
nucliadb_utils-6.7.2.
|
60
|
+
nucliadb_utils-6.7.2.post4878.dist-info/METADATA,sha256=pX5qPyBq1PlKi3DZCErI43IQlFSF4eFzzP0wD44p9zE,2180
|
61
|
+
nucliadb_utils-6.7.2.post4878.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
62
|
+
nucliadb_utils-6.7.2.post4878.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
|
63
|
+
nucliadb_utils-6.7.2.post4878.dist-info/RECORD,,
|
File without changes
|
{nucliadb_utils-6.7.2.post4876.dist-info → nucliadb_utils-6.7.2.post4878.dist-info}/top_level.txt
RENAMED
File without changes
|