nucliadb-utils 5.1.2.post1561__py3-none-any.whl → 5.1.2.post1572__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/storage.py +19 -3
- {nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/METADATA +3 -3
- {nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/RECORD +6 -6
- {nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/WHEEL +0 -0
- {nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/top_level.txt +0 -0
- {nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/zip-safe +0 -0
@@ -20,6 +20,7 @@
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
22
|
import abc
|
23
|
+
import asyncio
|
23
24
|
import hashlib
|
24
25
|
import uuid
|
25
26
|
from io import BytesIO
|
@@ -132,12 +133,27 @@ class Storage(abc.ABC, metaclass=abc.ABCMeta):
|
|
132
133
|
cached_buckets: List[str] = []
|
133
134
|
chunk_size = CHUNK_SIZE
|
134
135
|
|
135
|
-
async def delete_resource(self, kbid: str, uuid: str):
|
136
|
-
|
136
|
+
async def delete_resource(self, kbid: str, uuid: str, max_parallel: int = 1):
|
137
|
+
"""
|
138
|
+
Delete all storage keys related to a resource
|
139
|
+
|
140
|
+
Parameters:
|
141
|
+
- kbid: the knowledge box id
|
142
|
+
- uuid: the resource uuid
|
143
|
+
- max_parallel: the maximum number of parallel deletes
|
144
|
+
"""
|
137
145
|
bucket = self.get_bucket_name(kbid)
|
138
146
|
resource_storage_base_path = STORAGE_RESOURCE.format(kbid=kbid, uuid=uuid)
|
147
|
+
semaphore = asyncio.Semaphore(max_parallel)
|
148
|
+
|
149
|
+
async def _delete_object(object_info: ObjectInfo):
|
150
|
+
async with semaphore:
|
151
|
+
await self.delete_upload(object_info.name, bucket)
|
152
|
+
|
153
|
+
tasks = []
|
139
154
|
async for object_info in self.iterate_objects(bucket, resource_storage_base_path):
|
140
|
-
|
155
|
+
tasks.append(asyncio.create_task(_delete_object(object_info)))
|
156
|
+
await asyncio.gather(*tasks)
|
141
157
|
|
142
158
|
async def deadletter(self, message: BrokerMessage, seq: int, seqid: int, partition: str):
|
143
159
|
if self.deadletter_bucket is None:
|
{nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nucliadb_utils
|
3
|
-
Version: 5.1.2.
|
3
|
+
Version: 5.1.2.post1572
|
4
4
|
Home-page: https://nuclia.com
|
5
5
|
License: BSD
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
@@ -24,8 +24,8 @@ Requires-Dist: PyNaCl
|
|
24
24
|
Requires-Dist: pyjwt>=2.4.0
|
25
25
|
Requires-Dist: memorylru>=1.1.2
|
26
26
|
Requires-Dist: mrflagly>=0.2.9
|
27
|
-
Requires-Dist: nucliadb-protos>=5.1.2.
|
28
|
-
Requires-Dist: nucliadb-telemetry>=5.1.2.
|
27
|
+
Requires-Dist: nucliadb-protos>=5.1.2.post1572
|
28
|
+
Requires-Dist: nucliadb-telemetry>=5.1.2.post1572
|
29
29
|
Provides-Extra: cache
|
30
30
|
Requires-Dist: redis>=4.3.4; extra == "cache"
|
31
31
|
Requires-Dist: orjson>=3.6.7; extra == "cache"
|
@@ -48,7 +48,7 @@ nucliadb_utils/storages/nuclia.py,sha256=vEv94xAT7QM2g80S25QyrOw2pzvP2BAX-ADgZLt
|
|
48
48
|
nucliadb_utils/storages/object_store.py,sha256=Tw10GmpYfM5TMqJ3Tk9pLQ9wLMBk1-snL_m6uasiZDQ,4257
|
49
49
|
nucliadb_utils/storages/s3.py,sha256=tCJxSXwSq2hKaFole71ctpEXjcjBElUuTFWlmhLkytM,19471
|
50
50
|
nucliadb_utils/storages/settings.py,sha256=ugCPy1zxBOmA2KosT-4tsjpvP002kg5iQyi42yCGCJA,1285
|
51
|
-
nucliadb_utils/storages/storage.py,sha256=
|
51
|
+
nucliadb_utils/storages/storage.py,sha256=L0YwV_OrmX94wvYrds2CHqQd6Awx4RZ4h3AnoTUO8aY,20204
|
52
52
|
nucliadb_utils/storages/utils.py,sha256=8g2rIwJeYIumQLOB47Yw1rx3twlhRB_cJxer65QfZmk,1479
|
53
53
|
nucliadb_utils/tests/__init__.py,sha256=Oo9CAE7B0eW5VHn8sHd6o30SQzOWUhktLPRXdlDOleA,1456
|
54
54
|
nucliadb_utils/tests/asyncbenchmark.py,sha256=x4be2IwCawle9zWgMOJkmwoUwk5p1tv7cLQGmybkEOg,10587
|
@@ -59,8 +59,8 @@ nucliadb_utils/tests/indexing.py,sha256=YW2QhkhO9Q_8A4kKWJaWSvXvyQ_AiAwY1VylcfVQ
|
|
59
59
|
nucliadb_utils/tests/local.py,sha256=7nuP8EFUAiA8ZH50R1iPV9EUXBySQxOanVm3Zht_e0g,1835
|
60
60
|
nucliadb_utils/tests/nats.py,sha256=xqpww4jZjTKY9oPGlJdDJG67L3FIBQsa9qDHxILR8r8,7687
|
61
61
|
nucliadb_utils/tests/s3.py,sha256=IdMxK_cNdSHLvO1u8BwsKFzD87Hk1MVPDZ57zx6h-rA,3656
|
62
|
-
nucliadb_utils-5.1.2.
|
63
|
-
nucliadb_utils-5.1.2.
|
64
|
-
nucliadb_utils-5.1.2.
|
65
|
-
nucliadb_utils-5.1.2.
|
66
|
-
nucliadb_utils-5.1.2.
|
62
|
+
nucliadb_utils-5.1.2.post1572.dist-info/METADATA,sha256=1T-yrDgX3FMlhjRK9_qRfTUM-CdxQ9lnAUClgFuZvTQ,2071
|
63
|
+
nucliadb_utils-5.1.2.post1572.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
64
|
+
nucliadb_utils-5.1.2.post1572.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
|
65
|
+
nucliadb_utils-5.1.2.post1572.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
66
|
+
nucliadb_utils-5.1.2.post1572.dist-info/RECORD,,
|
File without changes
|
{nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/top_level.txt
RENAMED
File without changes
|
{nucliadb_utils-5.1.2.post1561.dist-info → nucliadb_utils-5.1.2.post1572.dist-info}/zip-safe
RENAMED
File without changes
|