@@ -3476,12 +3476,21 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM
3476
3476
"""
3477
3477
# TODO: consider first fetching array metadata, and only fetching group metadata when we don't
3478
3478
# find an array
3479
- print (f"Reading metadata from { path } in store { store } " , file = sys .stderr )
3480
- zarray_bytes , zgroup_bytes , zattrs_bytes = await asyncio .gather (
3481
- store .get (_join_paths ([path , ZARRAY_JSON ]), prototype = default_buffer_prototype ()),
3482
- store .get (_join_paths ([path , ZGROUP_JSON ]), prototype = default_buffer_prototype ()),
3483
- store .get (_join_paths ([path , ZATTRS_JSON ]), prototype = default_buffer_prototype ()),
3484
- )
3479
+ requests = [
3480
+ (_join_paths ([path , ZARRAY_JSON ]), default_buffer_prototype (), None ),
3481
+ (_join_paths ([path , ZGROUP_JSON ]), default_buffer_prototype (), None ),
3482
+ (_join_paths ([path , ZATTRS_JSON ]), default_buffer_prototype (), None ),
3483
+ ]
3484
+
3485
+ # Use the _get_many method to retrieve the data
3486
+ results = {}
3487
+ async for key , buffer in store ._get_many (requests ):
3488
+ results [key ] = buffer
3489
+
3490
+ zarray_bytes = results .get (_join_paths ([path , ZARRAY_JSON ]))
3491
+ zgroup_bytes = results .get (_join_paths ([path , ZGROUP_JSON ]))
3492
+ zattrs_bytes = results .get (_join_paths ([path , ZATTRS_JSON ]))
3493
+
3485
3494
if zattrs_bytes is None :
3486
3495
zattrs = {}
3487
3496
else :
0 commit comments