@@ -205,7 +205,8 @@ async def delete_bulk(cls, bulk_keys: list = [], bulk_custom_keys: list = []):
205205 return await cls ._run_query (query )
206206
207207 @classmethod
208- async def get_bulk (cls , bulk_keys : list = [], bulk_custom_keys : list = [], limit : list = [], with_pointers : bool = False , key_included : bool = False , pointers_metadata : bool = False ):
208+ async def get_bulk (
209+ cls , bulk_keys : list = [], bulk_custom_keys : list = [], limit : list = [], with_pointers : bool = False , key_included : bool = False , pointers_metadata : bool = False , volumes : list [str ] = [], latest_volume : bool = False ):
209210 """
210211 Retrieve multiple keys in bulk. Custom keys can be converted and added to the bulk retrieval list.
211212 Additionally, a limit on the number of records to retrieve can be applied, and whether to include pointers
@@ -220,13 +221,19 @@ async def get_bulk(cls, bulk_keys: list = [], bulk_custom_keys: list = [], limit
220221 no limit is applied.
221222 with_pointers (bool, optional): If True, the query will include pointer information with the results.
222223 Default is False.
224+ key_included (bool, optional): If True, the query will include the keys in the results.
225+ Default is False.
226+ pointers_metadata (bool, optional): If True, the query will include metadata about pointers in the results.
227+ Default is False.
228+ volumes (list[str], optional): A list of volumes to retrieve. Default is an empty list.
229+ latest_volume (bool, optional): If True, the query will retrieve the latest volume. Default is False.
223230
224231 Returns:
225232 dict | str: Returns a dictionary of keys and their associated values if successful, or a string
226233 message if the retrieval fails or there is an error.
227234
228235 Raises:
229- ValueError: If both `bulk_keys` and `bulk_custom_keys` are empty.
236+ ValueError: If both `bulk_keys` and `bulk_custom_keys` are empty and neither `volumes` nor `latest_volume` is specified .
230237 ValueError: If both `pointers_metadata` and `with_pointers` are True.
231238 """
232239
@@ -237,12 +244,18 @@ async def get_bulk(cls, bulk_keys: list = [], bulk_custom_keys: list = [], limit
237244 bulk_custom_keys = convert_custom_keys (bulk_custom_keys )
238245 bulk_keys += bulk_custom_keys
239246
240- if not bulk_keys :
241- raise ValueError ("No keys provided for retrieval." )
247+ selected_options = sum ([
248+ bool (bulk_keys ),
249+ bool (volumes ),
250+ bool (latest_volume )
251+ ])
252+
253+ if selected_options != 1 :
254+ raise ValueError ("Multiple conflicting options provided. Please provide exactly one of the following: keys, volumes, or latest volume." )
242255
243256 cls .command = "get_bulk"
244257 cls .limit_output = handle_limit (limit )
245- query = convert_to_binary_query (cls , bulk_keys = bulk_keys , with_pointers = with_pointers , key_included = key_included , pointers_metadata = pointers_metadata )
258+ query = convert_to_binary_query (cls , bulk_keys = bulk_keys , with_pointers = with_pointers , key_included = key_included , pointers_metadata = pointers_metadata , volumes = volumes , latest_volume = latest_volume )
246259 return await cls ._run_query (query )
247260
248261 @classmethod
0 commit comments