erioon 0.1.3__tar.gz → 0.1.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: erioon
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Erioon Python SDK for seamless interaction with Erioon data services
5
5
  Author: Zyber Pireci
6
6
  Author-email: zyber.pireci@erioon.com
@@ -13,62 +13,15 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- from azure.storage.blob import ContainerClient
17
16
  import uuid
18
- import json
19
17
  from erioon.functions import (
20
18
  create_msgpack_file,
21
19
  update_index_file_insert,
22
20
  calculate_shard_number,
23
- async_log
21
+ async_log,
22
+ is_duplicate_id
24
23
  )
25
24
 
26
- # GET INDEX OF DOCUMENTS
27
- def get_index_data(user_id_cont, database, collection, container_url):
28
- """
29
- Retrieves the content of the index.json file that tracks which records are stored in which shards.
30
-
31
- Args:
32
- user_id_cont: User identifier or context.
33
- database: Database name.
34
- collection: Collection name.
35
- container_url: Blob Storage container SAS URL.
36
-
37
- Returns:
38
- List of shard mappings (list of dicts) or empty list if file not found or error.
39
- """
40
- container_client = ContainerClient.from_container_url(container_url)
41
- index_blob_client = container_client.get_blob_client(blob=f"{database}/{collection}/index.json")
42
-
43
- try:
44
- index_data = index_blob_client.download_blob().readall()
45
- return json.loads(index_data) if index_data else []
46
- except Exception:
47
- return []
48
-
49
- # CHECK DUPLICATE IDs
50
- def is_duplicate_id(user_id_cont, database, collection, _id, container_url):
51
- """
52
- Checks if the given record _id is already present in the index.json across shards.
53
-
54
- Args:
55
- user_id_cont: User identifier.
56
- database: Database name.
57
- collection: Collection name.
58
- _id: Record ID to check.
59
- container_url: Blob Storage container SAS URL.
60
-
61
- Returns:
62
- True if _id exists in any shard, else False.
63
- """
64
- index_data = get_index_data(user_id_cont, database, collection, container_url)
65
-
66
- for shard in index_data:
67
- for shard_name, ids in shard.items():
68
- if _id in ids:
69
- return True
70
- return False
71
-
72
25
  # INSERT ONE RECORD
73
26
  def handle_insert_one(user_id_cont, database, collection, record, container_url):
74
27
  """
@@ -132,6 +132,52 @@ def create_msgpack_file(user_id_cont, database, collection, data, container_url)
132
132
 
133
133
  return msgpack_filename
134
134
 
135
+ # GET INDEX OF DOCUMENTS
136
+ def get_index_data(user_id_cont, database, collection, container_url):
137
+ """
138
+ Retrieves the content of the index.json file that tracks which records are stored in which shards.
139
+
140
+ Args:
141
+ user_id_cont: User identifier or context.
142
+ database: Database name.
143
+ collection: Collection name.
144
+ container_url: Blob Storage container SAS URL.
145
+
146
+ Returns:
147
+ List of shard mappings (list of dicts) or empty list if file not found or error.
148
+ """
149
+ container_client = ContainerClient.from_container_url(container_url)
150
+ index_blob_client = container_client.get_blob_client(blob=f"{database}/{collection}/index.json")
151
+
152
+ try:
153
+ index_data = index_blob_client.download_blob().readall()
154
+ return json.loads(index_data) if index_data else []
155
+ except Exception:
156
+ return []
157
+
158
+ # CHECK DUPLICATE IDs
159
+ def is_duplicate_id(user_id_cont, database, collection, _id, container_url):
160
+ """
161
+ Checks if the given record _id is already present in the index.json across shards.
162
+
163
+ Args:
164
+ user_id_cont: User identifier.
165
+ database: Database name.
166
+ collection: Collection name.
167
+ _id: Record ID to check.
168
+ container_url: Blob Storage container SAS URL.
169
+
170
+ Returns:
171
+ True if _id exists in any shard, else False.
172
+ """
173
+ index_data = get_index_data(user_id_cont, database, collection, container_url)
174
+
175
+ for shard in index_data:
176
+ for shard_name, ids in shard.items():
177
+ if _id in ids:
178
+ return True
179
+ return False
180
+
135
181
  # SAVE LOGS
136
182
  def save_logs(user_id_cont, database, collection, method, log_type, log_message, count, container_url):
137
183
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: erioon
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Erioon Python SDK for seamless interaction with Erioon data services
5
5
  Author: Zyber Pireci
6
6
  Author-email: zyber.pireci@erioon.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='erioon',
5
- version='0.1.3',
5
+ version='0.1.4',
6
6
  author='Zyber Pireci',
7
7
  author_email='zyber.pireci@erioon.com',
8
8
  description='Erioon Python SDK for seamless interaction with Erioon data services',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes