@@ -513,19 +513,23 @@ async def open(
513513 consolidated_key = use_consolidated
514514
515515 if zarr_format == 2 :
516- paths = [store_path / ZGROUP_JSON , store_path / ZATTRS_JSON ]
516+ requests = [
517+ (key , default_buffer_prototype (), None ) for key in [ZGROUP_JSON , ZATTRS_JSON ]
518+ ]
517519 if use_consolidated or use_consolidated is None :
518- paths .append (store_path / consolidated_key )
520+ requests .append (( consolidated_key , default_buffer_prototype (), None ) )
519521
520- zgroup_bytes , zattrs_bytes , * rest = await asyncio .gather (
521- * [path .get () for path in paths ]
522+ retrieved_buffers = {key : value async for key , value in store_path .get_many (requests )}
523+ zgroup_bytes , zattrs_bytes = (
524+ retrieved_buffers [ZGROUP_JSON ],
525+ retrieved_buffers [ZATTRS_JSON ],
522526 )
527+
523528 if zgroup_bytes is None :
524529 raise FileNotFoundError (store_path )
525530
526531 if use_consolidated or use_consolidated is None :
527- maybe_consolidated_metadata_bytes = rest [0 ]
528-
532+ maybe_consolidated_metadata_bytes = retrieved_buffers [consolidated_key ]
529533 else :
530534 maybe_consolidated_metadata_bytes = None
531535
@@ -534,17 +538,18 @@ async def open(
534538 if zarr_json_bytes is None :
535539 raise FileNotFoundError (store_path )
536540 elif zarr_format is None :
541+ requests = [
542+ (key , default_buffer_prototype (), None )
543+ for key in [ZARR_JSON , ZGROUP_JSON , ZATTRS_JSON , consolidated_key ]
544+ ]
545+ retrieved_buffers = {key : value async for key , value in store_path .get_many (requests )}
537546 (
538547 zarr_json_bytes ,
539548 zgroup_bytes ,
540549 zattrs_bytes ,
541550 maybe_consolidated_metadata_bytes ,
542- ) = await store_path .get_many_ordered (
543- ZARR_JSON ,
544- ZGROUP_JSON ,
545- ZATTRS_JSON ,
546- consolidated_key ,
547- )
551+ ) = tuple (retrieved_buffers .get (req [0 ]) for req in requests )
552+
548553 if zarr_json_bytes is not None and zgroup_bytes is not None :
549554 # warn and favor v3
550555 msg = f"Both zarr.json (Zarr format 3) and .zgroup (Zarr format 2) metadata objects exist at { store_path } . Zarr format 3 will be used."
@@ -3476,12 +3481,14 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM
34763481 """
34773482 # TODO: consider first fetching array metadata, and only fetching group metadata when we don't
34783483 # find an array
3479- zarray_bytes , zgroup_bytes , zattrs_bytes = await store ._get_many_ordered (
3480- [
3481- (_join_paths ([path , ZARRAY_JSON ]), default_buffer_prototype (), None ),
3482- (_join_paths ([path , ZGROUP_JSON ]), default_buffer_prototype (), None ),
3483- (_join_paths ([path , ZATTRS_JSON ]), default_buffer_prototype (), None ),
3484- ]
3484+ requests = [
3485+ (_join_paths ([path , ZARRAY_JSON ]), default_buffer_prototype (), None ),
3486+ (_join_paths ([path , ZGROUP_JSON ]), default_buffer_prototype (), None ),
3487+ (_join_paths ([path , ZATTRS_JSON ]), default_buffer_prototype (), None ),
3488+ ]
3489+ retrieved_buffers = {key : value async for key , value in store ._get_many (requests )}
3490+ zarray_bytes , zgroup_bytes , zattrs_bytes = tuple (
3491+ retrieved_buffers .get (req [0 ]) for req in requests
34853492 )
34863493
34873494 if zattrs_bytes is None :
0 commit comments