574
574
readv_ranges = []
575
575
for location, key in location_keys:
576
576
# can we answer from cache?
577
# - if we know the answer - yes
577
if self._bisect_nodes and key in self._bisect_nodes:
578
# We have the key parsed.
578
580
index = self._parsed_key_index(key)
579
581
if (len(self._parsed_key_map) and
580
582
self._parsed_key_map[index][0] <= key and
581
(self._parsed_key_map[index][1] > key or
583
(self._parsed_key_map[index][1] >= key or
582
584
# end of the file has been parsed
583
585
self._parsed_byte_map[index][1] == self._size)):
584
# the key has been parsed, so no lookup is needed
586
# the key has been parsed, so no lookup is needed even if its
586
589
# - if we have examined this part of the file already - yes
587
590
index = self._parsed_byte_index(location)
609
612
pending_locations = set()
610
613
for location, key in location_keys:
611
614
# can we answer from cache?
612
index = self._parsed_key_index(key)
613
if (self._parsed_key_map[index][0] <= key and
614
(self._parsed_key_map[index][1] > key or
615
# end of the file has been parsed
616
self._parsed_byte_map[index][1] == self._size)):
615
if key in self._bisect_nodes:
617
616
# the key has been parsed, so no lookup is needed
618
if key in self._bisect_nodes:
619
if self.node_ref_lists:
620
# the references may not have been all parsed.
621
value, refs = self._bisect_nodes[key]
622
wanted_locations = []
623
for ref_list in refs:
625
if ref not in self._keys_by_offset:
626
wanted_locations.append(ref)
628
pending_locations.update(wanted_locations)
629
pending_references.append((location, key))
631
result.append(((location, key), (self, key,
632
value, self._resolve_references(refs))))
634
result.append(((location, key),
635
(self, key, self._bisect_nodes[key])))
617
if self.node_ref_lists:
618
# the references may not have been all parsed.
619
value, refs = self._bisect_nodes[key]
620
wanted_locations = []
621
for ref_list in refs:
623
if ref not in self._keys_by_offset:
624
wanted_locations.append(ref)
626
pending_locations.update(wanted_locations)
627
pending_references.append((location, key))
629
result.append(((location, key), (self, key,
630
value, self._resolve_references(refs))))
632
result.append(((location, key),
633
(self, key, self._bisect_nodes[key])))
636
# has the region the key should be in, been parsed?
637
index = self._parsed_key_index(key)
638
if (self._parsed_key_map[index][0] <= key and
639
(self._parsed_key_map[index][1] >= key or
640
# end of the file has been parsed
641
self._parsed_byte_map[index][1] == self._size)):
637
642
result.append(((location, key), False))
639
644
# no, is the key above or below the probed location:
640
645
# get the range of the probed & parsed location
641
646
index = self._parsed_byte_index(location)