@@ -1022,12 +1022,14 @@ def _get_selection(self, indexer, out=None, fields=None):
1022
1022
1023
1023
# iterate over chunks
1024
1024
if not hasattr (self .store , "getitems" ):
1025
+ # sequentially get one key at a time from storage
1025
1026
for chunk_coords , chunk_selection , out_selection in indexer :
1026
1027
1027
1028
# load chunk selection into output array
1028
1029
self ._chunk_getitem (chunk_coords , chunk_selection , out , out_selection ,
1029
1030
drop_axes = indexer .drop_axes , fields = fields )
1030
1031
else :
1032
+ # allow storage to get multiple items at once
1031
1033
lchunk_coords , lchunk_selection , lout_selection = zip (* indexer )
1032
1034
self ._chunk_getitems (lchunk_coords , lchunk_selection , out , lout_selection ,
1033
1035
drop_axes = indexer .drop_axes , fields = fields )
@@ -1556,6 +1558,7 @@ def _set_selection(self, indexer, value, fields=None):
1556
1558
1557
1559
def _process_chunk (self , out , cdata , chunk_selection , drop_axes ,
1558
1560
out_is_ndarray , fields , out_selection ):
1561
+ """Take binary data from storage and fill output array"""
1559
1562
if (out_is_ndarray and
1560
1563
not fields and
1561
1564
is_contiguous_selection (out_selection ) and
@@ -1649,6 +1652,11 @@ def _chunk_getitem(self, chunk_coords, chunk_selection, out, out_selection,
1649
1652
1650
1653
def _chunk_getitems (self , lchunk_coords , lchunk_selection , out , lout_selection ,
1651
1654
drop_axes = None , fields = None ):
1655
+ """As _chunk_getitem, but for lists of chunks
1656
+
1657
+ This gets called where the storage supports ``getitems``, so that
1658
+ it can decide how to fetch the keys, allowing concurrency.
1659
+ """
1652
1660
out_is_ndarray = True
1653
1661
try :
1654
1662
out = ensure_ndarray (out )
0 commit comments