nucliadb 6.3.1.post3531__py3-none-any.whl → 6.3.1.post3544__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/backups/const.py +8 -0
- nucliadb/backups/create.py +1 -1
- nucliadb/backups/delete.py +5 -2
- nucliadb/backups/restore.py +3 -1
- nucliadb/backups/tasks.py +23 -22
- {nucliadb-6.3.1.post3531.dist-info → nucliadb-6.3.1.post3544.dist-info}/METADATA +6 -6
- {nucliadb-6.3.1.post3531.dist-info → nucliadb-6.3.1.post3544.dist-info}/RECORD +10 -10
- {nucliadb-6.3.1.post3531.dist-info → nucliadb-6.3.1.post3544.dist-info}/WHEEL +0 -0
- {nucliadb-6.3.1.post3531.dist-info → nucliadb-6.3.1.post3544.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.3.1.post3531.dist-info → nucliadb-6.3.1.post3544.dist-info}/top_level.txt +0 -0
nucliadb/backups/const.py
CHANGED
@@ -39,3 +39,11 @@ class StorageKeys:
|
|
39
39
|
class BackupFinishedStream:
|
40
40
|
name = "backups"
|
41
41
|
subject = "backups.creation_finished"
|
42
|
+
|
43
|
+
|
44
|
+
class BackupsNatsStream:
|
45
|
+
name = "ndb-backups"
|
46
|
+
stream_subjects = ["ndb-backups.>"]
|
47
|
+
create_subject = "ndb-backups.create"
|
48
|
+
delete_subject = "ndb-backups.delete"
|
49
|
+
restore_subject = "ndb-backups.restore"
|
nucliadb/backups/create.py
CHANGED
@@ -45,7 +45,7 @@ from nucliadb_utils.storages.storage import StorageField
|
|
45
45
|
from nucliadb_utils.utilities import get_audit
|
46
46
|
|
47
47
|
|
48
|
-
async def
|
48
|
+
async def backup_kb_task(context: ApplicationContext, msg: CreateBackupRequest):
|
49
49
|
kbid = msg.kbid
|
50
50
|
backup_id = msg.backup_id
|
51
51
|
|
nucliadb/backups/delete.py
CHANGED
@@ -27,11 +27,14 @@ from nucliadb.backups.settings import settings
|
|
27
27
|
from nucliadb.common.context import ApplicationContext
|
28
28
|
|
29
29
|
|
30
|
-
async def
|
30
|
+
async def delete_backup_task(context: ApplicationContext, msg: DeleteBackupRequest):
|
31
31
|
"""
|
32
32
|
Deletes the backup files from the cloud storage.
|
33
33
|
"""
|
34
|
-
|
34
|
+
await delete_backup(context, msg.backup_id)
|
35
|
+
|
36
|
+
|
37
|
+
async def delete_backup(context: ApplicationContext, backup_id: str):
|
35
38
|
while True:
|
36
39
|
deleted = await delete_n(context, backup_id, n=1000)
|
37
40
|
if deleted == 0:
|
nucliadb/backups/restore.py
CHANGED
@@ -40,7 +40,7 @@ from nucliadb_protos.resources_pb2 import CloudFile
|
|
40
40
|
from nucliadb_protos.writer_pb2 import BrokerMessage
|
41
41
|
|
42
42
|
|
43
|
-
async def
|
43
|
+
async def restore_kb_task(context: ApplicationContext, msg: RestoreBackupRequest):
|
44
44
|
kbid = msg.kbid
|
45
45
|
backup_id = msg.backup_id
|
46
46
|
|
@@ -135,6 +135,8 @@ class ResourceBackupReader:
|
|
135
135
|
async def read(self, size: int) -> bytes:
|
136
136
|
while len(self.buffer) < size:
|
137
137
|
chunk = await self.download_stream.__anext__()
|
138
|
+
if not chunk:
|
139
|
+
continue
|
138
140
|
self.buffer += chunk
|
139
141
|
result = self.buffer[:size]
|
140
142
|
self.buffer = self.buffer[size:]
|
nucliadb/backups/tasks.py
CHANGED
@@ -19,10 +19,11 @@
|
|
19
19
|
#
|
20
20
|
from typing import Awaitable, Callable
|
21
21
|
|
22
|
-
from nucliadb.backups.
|
22
|
+
from nucliadb.backups.const import BackupsNatsStream
|
23
|
+
from nucliadb.backups.create import backup_kb_task
|
23
24
|
from nucliadb.backups.delete import delete_backup
|
24
25
|
from nucliadb.backups.models import CreateBackupRequest, DeleteBackupRequest, RestoreBackupRequest
|
25
|
-
from nucliadb.backups.restore import
|
26
|
+
from nucliadb.backups.restore import restore_kb_task
|
26
27
|
from nucliadb.common.context import ApplicationContext
|
27
28
|
from nucliadb.tasks import create_consumer, create_producer
|
28
29
|
from nucliadb.tasks.consumer import NatsTaskConsumer
|
@@ -32,10 +33,10 @@ from nucliadb.tasks.producer import NatsTaskProducer
|
|
32
33
|
def creator_consumer() -> NatsTaskConsumer[CreateBackupRequest]:
|
33
34
|
consumer: NatsTaskConsumer = create_consumer(
|
34
35
|
name="backup_creator",
|
35
|
-
stream=
|
36
|
-
stream_subjects=
|
37
|
-
consumer_subject=
|
38
|
-
callback=
|
36
|
+
stream=BackupsNatsStream.name,
|
37
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
38
|
+
consumer_subject=BackupsNatsStream.create_subject,
|
39
|
+
callback=backup_kb_task,
|
39
40
|
msg_type=CreateBackupRequest,
|
40
41
|
max_concurrent_messages=10,
|
41
42
|
)
|
@@ -45,9 +46,9 @@ def creator_consumer() -> NatsTaskConsumer[CreateBackupRequest]:
|
|
45
46
|
async def create(kbid: str, backup_id: str) -> None:
|
46
47
|
producer: NatsTaskProducer[CreateBackupRequest] = create_producer(
|
47
48
|
name="backup_creator",
|
48
|
-
stream=
|
49
|
-
stream_subjects=
|
50
|
-
producer_subject=
|
49
|
+
stream=BackupsNatsStream.name,
|
50
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
51
|
+
producer_subject=BackupsNatsStream.create_subject,
|
51
52
|
msg_type=CreateBackupRequest,
|
52
53
|
)
|
53
54
|
msg = CreateBackupRequest(
|
@@ -60,10 +61,10 @@ async def create(kbid: str, backup_id: str) -> None:
|
|
60
61
|
def restorer_consumer() -> NatsTaskConsumer[RestoreBackupRequest]:
|
61
62
|
consumer: NatsTaskConsumer = create_consumer(
|
62
63
|
name="backup_restorer",
|
63
|
-
stream=
|
64
|
-
stream_subjects=
|
65
|
-
consumer_subject=
|
66
|
-
callback=
|
64
|
+
stream=BackupsNatsStream.name,
|
65
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
66
|
+
consumer_subject=BackupsNatsStream.restore_subject,
|
67
|
+
callback=restore_kb_task,
|
67
68
|
msg_type=RestoreBackupRequest,
|
68
69
|
max_concurrent_messages=10,
|
69
70
|
)
|
@@ -73,9 +74,9 @@ def restorer_consumer() -> NatsTaskConsumer[RestoreBackupRequest]:
|
|
73
74
|
async def restore(kbid: str, backup_id: str) -> None:
|
74
75
|
producer: NatsTaskProducer[RestoreBackupRequest] = create_producer(
|
75
76
|
name="backup_restorer",
|
76
|
-
stream=
|
77
|
-
stream_subjects=
|
78
|
-
producer_subject=
|
77
|
+
stream=BackupsNatsStream.name,
|
78
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
79
|
+
producer_subject=BackupsNatsStream.restore_subject,
|
79
80
|
msg_type=RestoreBackupRequest,
|
80
81
|
)
|
81
82
|
msg = RestoreBackupRequest(
|
@@ -88,9 +89,9 @@ async def restore(kbid: str, backup_id: str) -> None:
|
|
88
89
|
def deleter_consumer() -> NatsTaskConsumer[DeleteBackupRequest]:
|
89
90
|
consumer: NatsTaskConsumer = create_consumer(
|
90
91
|
name="backup_deleter",
|
91
|
-
stream=
|
92
|
-
stream_subjects=
|
93
|
-
consumer_subject=
|
92
|
+
stream=BackupsNatsStream.name,
|
93
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
94
|
+
consumer_subject=BackupsNatsStream.delete_subject,
|
94
95
|
callback=delete_backup,
|
95
96
|
msg_type=DeleteBackupRequest,
|
96
97
|
max_concurrent_messages=2,
|
@@ -101,9 +102,9 @@ def deleter_consumer() -> NatsTaskConsumer[DeleteBackupRequest]:
|
|
101
102
|
async def delete(backup_id: str) -> None:
|
102
103
|
producer: NatsTaskProducer[DeleteBackupRequest] = create_producer(
|
103
104
|
name="backup_deleter",
|
104
|
-
stream=
|
105
|
-
stream_subjects=
|
106
|
-
producer_subject=
|
105
|
+
stream=BackupsNatsStream.name,
|
106
|
+
stream_subjects=BackupsNatsStream.stream_subjects,
|
107
|
+
producer_subject=BackupsNatsStream.delete_subject,
|
107
108
|
msg_type=DeleteBackupRequest,
|
108
109
|
)
|
109
110
|
msg = DeleteBackupRequest(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.3.1.
|
3
|
+
Version: 6.3.1.post3544
|
4
4
|
Summary: NucliaDB
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
6
6
|
License: AGPL
|
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
21
21
|
Requires-Python: <4,>=3.9
|
22
22
|
Description-Content-Type: text/markdown
|
23
|
-
Requires-Dist: nucliadb-telemetry[all]>=6.3.1.
|
24
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.
|
25
|
-
Requires-Dist: nucliadb-protos>=6.3.1.
|
26
|
-
Requires-Dist: nucliadb-models>=6.3.1.
|
27
|
-
Requires-Dist: nidx-protos>=6.3.1.
|
23
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.3.1.post3544
|
24
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.post3544
|
25
|
+
Requires-Dist: nucliadb-protos>=6.3.1.post3544
|
26
|
+
Requires-Dist: nucliadb-models>=6.3.1.post3544
|
27
|
+
Requires-Dist: nidx-protos>=6.3.1.post3544
|
28
28
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
29
29
|
Requires-Dist: nuclia-models>=0.24.2
|
30
30
|
Requires-Dist: uvicorn
|
@@ -40,13 +40,13 @@ nucliadb/metrics_exporter.py,sha256=6u0geEYFxgE5I2Fhl_sxsvGN-ZkaFZNGutSXwrzrsVs,
|
|
40
40
|
nucliadb/openapi.py,sha256=wDiw0dVEvTpJvbatkJ0JZLkKm9RItZT5PWRHjqRfqTA,2272
|
41
41
|
nucliadb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
42
|
nucliadb/backups/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
43
|
-
nucliadb/backups/const.py,sha256=
|
44
|
-
nucliadb/backups/create.py,sha256
|
45
|
-
nucliadb/backups/delete.py,sha256=
|
43
|
+
nucliadb/backups/const.py,sha256=llb5TaC53Ce6BMmlPKPUrVhVGl7uQrqv_Vle-P4GET4,1673
|
44
|
+
nucliadb/backups/create.py,sha256=4RsvwY808X22kr06_uiASz6hEqmMirWQZgA_RoTbkqw,10440
|
45
|
+
nucliadb/backups/delete.py,sha256=1rnBhVUGYYZJXSZUrrgYMDZ5NyswEWkIA-G-crRCyHk,2404
|
46
46
|
nucliadb/backups/models.py,sha256=13-Z4p-Ypjdtg5NuDE2m-09CTdFYHh-W6U9FyWSEhPA,1270
|
47
|
-
nucliadb/backups/restore.py,sha256=
|
47
|
+
nucliadb/backups/restore.py,sha256=X-Ai5HjujNWIjqxegDaJp33dSUIDaTzJ3K8n_heeDeo,9702
|
48
48
|
nucliadb/backups/settings.py,sha256=SyzsInj1BRbBI0atg5IXWbMbOZ_eVg4eSQ3IcnUhCxQ,1357
|
49
|
-
nucliadb/backups/tasks.py,sha256=
|
49
|
+
nucliadb/backups/tasks.py,sha256=e0J85c7RjqYO92hcG9GT_g_LK-enyisWuSWxAUl5IZE,4528
|
50
50
|
nucliadb/backups/utils.py,sha256=ayDaxfWP5cPnAkQH-tF4M6cnowsPQgU2ljYz_iL1CbE,1249
|
51
51
|
nucliadb/common/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
52
52
|
nucliadb/common/constants.py,sha256=QpigxJh_CtD85Evy0PtV5cVq6x0U_f9xfIcXz1ymkUg,869
|
@@ -349,8 +349,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
349
349
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
350
350
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
351
351
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
352
|
-
nucliadb-6.3.1.
|
353
|
-
nucliadb-6.3.1.
|
354
|
-
nucliadb-6.3.1.
|
355
|
-
nucliadb-6.3.1.
|
356
|
-
nucliadb-6.3.1.
|
352
|
+
nucliadb-6.3.1.post3544.dist-info/METADATA,sha256=vKxvrIe5oh3QKwI-JxIAA8NJ2V0bwXCdg6K_O4wOCFg,4291
|
353
|
+
nucliadb-6.3.1.post3544.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
354
|
+
nucliadb-6.3.1.post3544.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
355
|
+
nucliadb-6.3.1.post3544.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
356
|
+
nucliadb-6.3.1.post3544.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|