@@ -3453,12 +3453,21 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM
3453
3453
"""
3454
3454
# TODO: consider first fetching array metadata, and only fetching group metadata when we don't
3455
3455
# find an array
3456
- print (f"Reading metadata from { path } in store { store } " , file = sys .stderr )
3457
- zarray_bytes , zgroup_bytes , zattrs_bytes = await asyncio .gather (
3458
- store .get (_join_paths ([path , ZARRAY_JSON ]), prototype = default_buffer_prototype ()),
3459
- store .get (_join_paths ([path , ZGROUP_JSON ]), prototype = default_buffer_prototype ()),
3460
- store .get (_join_paths ([path , ZATTRS_JSON ]), prototype = default_buffer_prototype ()),
3461
- )
3456
+ requests = [
3457
+ (_join_paths ([path , ZARRAY_JSON ]), default_buffer_prototype (), None ),
3458
+ (_join_paths ([path , ZGROUP_JSON ]), default_buffer_prototype (), None ),
3459
+ (_join_paths ([path , ZATTRS_JSON ]), default_buffer_prototype (), None ),
3460
+ ]
3461
+
3462
+ # Use the _get_many method to retrieve the data
3463
+ results = {}
3464
+ async for key , buffer in store ._get_many (requests ):
3465
+ results [key ] = buffer
3466
+
3467
+ zarray_bytes = results .get (_join_paths ([path , ZARRAY_JSON ]))
3468
+ zgroup_bytes = results .get (_join_paths ([path , ZGROUP_JSON ]))
3469
+ zattrs_bytes = results .get (_join_paths ([path , ZATTRS_JSON ]))
3470
+
3462
3471
if zattrs_bytes is None :
3463
3472
zattrs = {}
3464
3473
else :
0 commit comments