54
52
_newline_null_re = re.compile('[\n\0]')
57
def _has_key_from_parent_map(self, key):
58
"""Check if this index has one key.
60
If it's possible to check for multiple keys at once through
61
calling get_parent_map that should be faster.
63
return (key in self.get_parent_map([key]))
66
def _missing_keys_from_parent_map(self, keys):
67
return set(keys) - set(self.get_parent_map(keys))
70
55
class GraphIndexBuilder(object):
71
56
"""A builder that can build a GraphIndex.
73
The resulting graph has the structure::
75
_SIGNATURE OPTIONS NODES NEWLINE
76
_SIGNATURE := 'Bazaar Graph Index 1' NEWLINE
77
OPTIONS := 'node_ref_lists=' DIGITS NEWLINE
79
NODE := KEY NULL ABSENT? NULL REFERENCES NULL VALUE NEWLINE
80
KEY := Not-whitespace-utf8
82
REFERENCES := REFERENCE_LIST (TAB REFERENCE_LIST){node_ref_lists - 1}
83
REFERENCE_LIST := (REFERENCE (CR REFERENCE)*)?
84
REFERENCE := DIGITS ; digits is the byte offset in the index of the
86
VALUE := no-newline-no-null-bytes
58
The resulting graph has the structure:
60
_SIGNATURE OPTIONS NODES NEWLINE
61
_SIGNATURE := 'Bazaar Graph Index 1' NEWLINE
62
OPTIONS := 'node_ref_lists=' DIGITS NEWLINE
64
NODE := KEY NULL ABSENT? NULL REFERENCES NULL VALUE NEWLINE
65
KEY := Not-whitespace-utf8
67
REFERENCES := REFERENCE_LIST (TAB REFERENCE_LIST){node_ref_lists - 1}
68
REFERENCE_LIST := (REFERENCE (CR REFERENCE)*)?
69
REFERENCE := DIGITS ; digits is the byte offset in the index of the
71
VALUE := no-newline-no-null-bytes
89
74
def __init__(self, reference_lists=0, key_elements=1):
113
94
if not element or _whitespace_re.search(element) is not None:
114
95
raise errors.BadIndexKey(element)
116
def _external_references(self):
117
"""Return references that are not present in this index.
121
# TODO: JAM 2008-11-21 This makes an assumption about how the reference
122
# lists are used. It is currently correct for pack-0.92 through
123
# 1.9, which use the node references (3rd column) second
124
# reference list as the compression parent. Perhaps this should
125
# be moved into something higher up the stack, since it
126
# makes assumptions about how the index is used.
127
if self.reference_lists > 1:
128
for node in self.iter_all_entries():
130
refs.update(node[3][1])
133
# If reference_lists == 0 there can be no external references, and
134
# if reference_lists == 1, then there isn't a place to store the
138
def _get_nodes_by_key(self):
139
if self._nodes_by_key is None:
141
if self.reference_lists:
142
for key, (absent, references, value) in self._nodes.iteritems():
145
key_dict = nodes_by_key
146
for subkey in key[:-1]:
147
key_dict = key_dict.setdefault(subkey, {})
148
key_dict[key[-1]] = key, value, references
150
for key, (absent, references, value) in self._nodes.iteritems():
153
key_dict = nodes_by_key
154
for subkey in key[:-1]:
155
key_dict = key_dict.setdefault(subkey, {})
156
key_dict[key[-1]] = key, value
157
self._nodes_by_key = nodes_by_key
158
return self._nodes_by_key
160
def _update_nodes_by_key(self, key, value, node_refs):
161
"""Update the _nodes_by_key dict with a new key.
163
For a key of (foo, bar, baz) create
164
_nodes_by_key[foo][bar][baz] = key_value
166
if self._nodes_by_key is None:
168
key_dict = self._nodes_by_key
169
if self.reference_lists:
170
key_value = StaticTuple(key, value, node_refs)
172
key_value = StaticTuple(key, value)
173
for subkey in key[:-1]:
174
key_dict = key_dict.setdefault(subkey, {})
175
key_dict[key[-1]] = key_value
177
def _check_key_ref_value(self, key, references, value):
178
"""Check that 'key' and 'references' are all valid.
180
:param key: A key tuple. Must conform to the key interface (be a tuple,
181
be of the right length, not have any whitespace or nulls in any key
183
:param references: An iterable of reference lists. Something like
184
[[(ref, key)], [(ref, key), (other, key)]]
185
:param value: The value associate with this key. Must not contain
186
newlines or null characters.
187
:return: (node_refs, absent_references)
189
* node_refs: basically a packed form of 'references' where all
191
* absent_references: reference keys that are not in self._nodes.
192
This may contain duplicates if the same key is referenced in
195
as_st = StaticTuple.from_sequence
97
def add_node(self, key, value, references=()):
98
"""Add a node to the index.
100
:param key: The key. keys are non-empty tuples containing
101
as many whitespace-free utf8 bytestrings as the key length
102
defined for this index.
103
:param references: An iterable of iterables of keys. Each is a
104
reference to another key.
105
:param value: The value to associate with the key. It may be any
106
bytes as long as it does not contain \0 or \n.
196
108
self._check_key(key)
197
109
if _newline_null_re.search(value) is not None:
198
110
raise errors.BadIndexValue(value)
199
111
if len(references) != self.reference_lists:
200
112
raise errors.BadIndexValue(references)
202
absent_references = []
203
114
for reference_list in references:
204
115
for reference in reference_list:
205
# If reference *is* in self._nodes, then we know it has already
116
self._check_key(reference)
207
117
if reference not in self._nodes:
208
self._check_key(reference)
209
absent_references.append(reference)
210
reference_list = as_st([as_st(ref).intern()
211
for ref in reference_list])
212
node_refs.append(reference_list)
213
return as_st(node_refs), absent_references
215
def add_node(self, key, value, references=()):
216
"""Add a node to the index.
218
:param key: The key. keys are non-empty tuples containing
219
as many whitespace-free utf8 bytestrings as the key length
220
defined for this index.
221
:param references: An iterable of iterables of keys. Each is a
222
reference to another key.
223
:param value: The value to associate with the key. It may be any
224
bytes as long as it does not contain \\0 or \\n.
227
absent_references) = self._check_key_ref_value(key, references, value)
228
if key in self._nodes and self._nodes[key][0] != 'a':
118
self._nodes[reference] = ('a', (), '')
119
node_refs.append(tuple(reference_list))
120
if key in self._nodes and self._nodes[key][0] == '':
229
121
raise errors.BadIndexDuplicateKey(key, self)
230
for reference in absent_references:
231
# There may be duplicates, but I don't think it is worth worrying
233
self._nodes[reference] = ('a', (), '')
234
self._absent_keys.update(absent_references)
235
self._absent_keys.discard(key)
236
self._nodes[key] = ('', node_refs, value)
237
if self._nodes_by_key is not None and self._key_length > 1:
238
self._update_nodes_by_key(key, value, node_refs)
240
def clear_cache(self):
241
"""See GraphIndex.clear_cache()
243
This is a no-op, but we need the api to conform to a generic 'Index'
122
self._nodes[key] = ('', tuple(node_refs), value)
124
if self._key_length > 1:
125
key_dict = self._nodes_by_key
126
if self.reference_lists:
127
key_value = key, value, tuple(node_refs)
129
key_value = key, value
130
# possibly should do this on-demand, but it seems likely it is
132
# For a key of (foo, bar, baz) create
133
# _nodes_by_key[foo][bar][baz] = key_value
134
for subkey in key[:-1]:
135
key_dict = key_dict.setdefault(subkey, {})
136
key_dict[key[-1]] = key_value
247
138
def finish(self):
250
:returns: cStringIO holding the full context of the index as it
251
should be written to disk.
253
139
lines = [_SIGNATURE]
254
140
lines.append(_OPTION_NODE_REFS + str(self.reference_lists) + '\n')
255
141
lines.append(_OPTION_KEY_ELEMENTS + str(self._key_length) + '\n')
256
key_count = len(self._nodes) - len(self._absent_keys)
257
lines.append(_OPTION_LEN + str(key_count) + '\n')
142
lines.append(_OPTION_LEN + str(len(self._keys)) + '\n')
258
143
prefix_length = sum(len(x) for x in lines)
259
144
# references are byte offsets. To avoid having to do nasty
260
# polynomial work to resolve offsets (references to later in the
145
# polynomial work to resolve offsets (references to later in the
261
146
# file cannot be determined until all the inbetween references have
262
147
# been calculated too) we pad the offsets with 0's to make them be
263
148
# of consistent length. Using binary offsets would break the trivial
334
219
raise errors.BzrError('Failed index creation. Internal error:'
335
220
' mismatched output length and expected length: %d %d' %
336
221
(len(result.getvalue()), expected_bytes))
339
def set_optimize(self, for_size=None, combine_backing_indices=None):
340
"""Change how the builder tries to optimize the result.
342
:param for_size: Tell the builder to try and make the index as small as
344
:param combine_backing_indices: If the builder spills to disk to save
345
memory, should the on-disk indices be combined. Set to True if you
346
are going to be probing the index, but to False if you are not. (If
347
you are not querying, then the time spent combining is wasted.)
350
# GraphIndexBuilder itself doesn't pay attention to the flag yet, but
352
if for_size is not None:
353
self._optimize_for_size = for_size
354
if combine_backing_indices is not None:
355
self._combine_backing_indices = combine_backing_indices
357
def find_ancestry(self, keys, ref_list_num):
358
"""See CombinedGraphIndex.find_ancestry()"""
364
for _, key, value, ref_lists in self.iter_entries(pending):
365
parent_keys = ref_lists[ref_list_num]
366
parent_map[key] = parent_keys
367
next_pending.update([p for p in parent_keys if p not in
369
missing_keys.update(pending.difference(parent_map))
370
pending = next_pending
371
return parent_map, missing_keys
222
return StringIO(''.join(lines))
374
225
class GraphIndex(object):
375
226
"""An index for data with embedded graphs.
377
228
The index maps keys to a list of key reference lists, and a value.
378
229
Each node has the same number of key reference lists. Each key reference
379
230
list can be empty or an arbitrary length. The value is an opaque NULL
380
terminated string without any newlines. The storage of the index is
231
terminated string without any newlines. The storage of the index is
381
232
hidden in the interface: keys and key references are always tuples of
382
233
bytestrings, never the internal representation (e.g. dictionary offsets).
484
315
node_value = value
485
316
self._nodes[key] = node_value
317
if self._key_length > 1:
318
subkey = list(reversed(key[:-1]))
319
key_dict = self._nodes_by_key
320
if self.node_ref_lists:
321
key_value = key, node_value[0], node_value[1]
323
key_value = key, node_value
324
# possibly should do this on-demand, but it seems likely it is
326
# For a key of (foo, bar, baz) create
327
# _nodes_by_key[foo][bar][baz] = key_value
328
for subkey in key[:-1]:
329
key_dict = key_dict.setdefault(subkey, {})
330
key_dict[key[-1]] = key_value
486
331
# cache the keys for quick set intersections
332
self._keys = set(self._nodes)
487
333
if trailers != 1:
488
334
# there must be one line - the empty trailer line.
489
335
raise errors.BadIndexData(self)
491
def clear_cache(self):
492
"""Clear out any cached/memoized values.
494
This can be called at any time, but generally it is used when we have
495
extracted some information, but don't expect to be requesting any more
499
def external_references(self, ref_list_num):
500
"""Return references that are not present in this index.
503
if ref_list_num + 1 > self.node_ref_lists:
504
raise ValueError('No ref list %d, index has %d ref lists'
505
% (ref_list_num, self.node_ref_lists))
508
for key, (value, ref_lists) in nodes.iteritems():
509
ref_list = ref_lists[ref_list_num]
510
refs.update([ref for ref in ref_list if ref not in nodes])
513
def _get_nodes_by_key(self):
514
if self._nodes_by_key is None:
516
if self.node_ref_lists:
517
for key, (value, references) in self._nodes.iteritems():
518
key_dict = nodes_by_key
519
for subkey in key[:-1]:
520
key_dict = key_dict.setdefault(subkey, {})
521
key_dict[key[-1]] = key, value, references
523
for key, value in self._nodes.iteritems():
524
key_dict = nodes_by_key
525
for subkey in key[:-1]:
526
key_dict = key_dict.setdefault(subkey, {})
527
key_dict[key[-1]] = key, value
528
self._nodes_by_key = nodes_by_key
529
return self._nodes_by_key
531
337
def iter_all_entries(self):
532
338
"""Iterate over all keys within the index.
1194
951
self._parsed_key_map.insert(index + 1, new_key)
1196
953
def _read_and_parse(self, readv_ranges):
1197
"""Read the ranges and parse the resulting data.
954
"""Read the the ranges and parse the resulting data.
1199
956
:param readv_ranges: A prepared readv range list.
1201
if not readv_ranges:
1203
if self._nodes is None and self._bytes_read * 2 >= self._size:
1204
# We've already read more than 50% of the file and we are about to
1205
# request more data, just _buffer_all() and be done
1209
base_offset = self._base_offset
1210
if base_offset != 0:
1211
# Rewrite the ranges for the offset
1212
readv_ranges = [(start+base_offset, size)
1213
for start, size in readv_ranges]
1214
readv_data = self._transport.readv(self._name, readv_ranges, True,
1215
self._size + self._base_offset)
1217
for offset, data in readv_data:
1218
offset -= base_offset
1219
self._bytes_read += len(data)
1221
# transport.readv() expanded to extra data which isn't part of
1223
data = data[-offset:]
1225
if offset == 0 and len(data) == self._size:
1226
# We read the whole range, most likely because the
1227
# Transport upcast our readv ranges into one long request
1228
# for enough total data to grab the whole index.
1229
self._buffer_all(StringIO(data))
1231
if self._bisect_nodes is None:
1232
# this must be the start
1233
if not (offset == 0):
1234
raise AssertionError()
1235
offset, data = self._parse_header_from_bytes(data)
1236
# print readv_ranges, "[%d:%d]" % (offset, offset + len(data))
1237
self._parse_region(offset, data)
959
readv_data = self._transport.readv(self._name, readv_ranges, True,
962
for offset, data in readv_data:
963
if self._bisect_nodes is None:
964
# this must be the start
965
if not (offset == 0):
966
raise AssertionError()
967
offset, data = self._parse_header_from_bytes(data)
968
# print readv_ranges, "[%d:%d]" % (offset, offset + len(data))
969
self._parse_region(offset, data)
1239
971
def _signature(self):
1240
972
"""The file signature for this index type."""
1250
982
class CombinedGraphIndex(object):
1251
983
"""A GraphIndex made up from smaller GraphIndices.
1253
985
The backing indices must implement GraphIndex, and are presumed to be
1256
988
Queries against the combined index will be made against the first index,
1257
and then the second and so on. The order of indices can thus influence
989
and then the second and so on. The order of index's can thus influence
1258
990
performance significantly. For example, if one index is on local disk and a
1259
991
second on a remote server, the local disk index should be before the other
1260
992
in the index list.
1262
Also, queries tend to need results from the same indices as previous
1263
queries. So the indices will be reordered after every query to put the
1264
indices that had the result(s) of that query first (while otherwise
1265
preserving the relative ordering).
1268
def __init__(self, indices, reload_func=None):
995
def __init__(self, indices):
1269
996
"""Create a CombinedGraphIndex backed by indices.
1271
998
:param indices: An ordered list of indices to query for data.
1272
:param reload_func: A function to call if we find we are missing an
1273
index. Should have the form reload_func() => True/False to indicate
1274
if reloading actually changed anything.
1276
1000
self._indices = indices
1277
self._reload_func = reload_func
1278
# Sibling indices are other CombinedGraphIndex that we should call
1279
# _move_to_front_by_name on when we auto-reorder ourself.
1280
self._sibling_indices = []
1281
# A list of names that corresponds to the instances in self._indices,
1282
# so _index_names[0] is always the name for _indices[0], etc. Sibling
1283
# indices must all use the same set of names as each other.
1284
self._index_names = [None] * len(self._indices)
1286
1002
def __repr__(self):
1287
1003
return "%s(%s)" % (
1288
1004
self.__class__.__name__,
1289
1005
', '.join(map(repr, self._indices)))
1291
def clear_cache(self):
1292
"""See GraphIndex.clear_cache()"""
1293
for index in self._indices:
1007
@symbol_versioning.deprecated_method(symbol_versioning.one_one)
1008
def get_parents(self, revision_ids):
1009
"""See graph._StackedParentsProvider.get_parents.
1011
This implementation thunks the graph.Graph.get_parents api across to
1014
:param revision_ids: An iterable of graph keys for this graph.
1015
:return: A list of parent details for each key in revision_ids.
1016
Each parent details will be one of:
1017
* None when the key was missing
1018
* (NULL_REVISION,) when the key has no parents.
1019
* (parent_key, parent_key...) otherwise.
1021
parent_map = self.get_parent_map(revision_ids)
1022
return [parent_map.get(r, None) for r in revision_ids]
1296
1024
def get_parent_map(self, keys):
1297
"""See graph.StackedParentsProvider.get_parent_map"""
1025
"""See graph._StackedParentsProvider.get_parent_map"""
1298
1026
search_keys = set(keys)
1299
if _mod_revision.NULL_REVISION in search_keys:
1300
search_keys.discard(_mod_revision.NULL_REVISION)
1301
found_parents = {_mod_revision.NULL_REVISION:[]}
1027
if NULL_REVISION in search_keys:
1028
search_keys.discard(NULL_REVISION)
1029
found_parents = {NULL_REVISION:[]}
1303
1031
found_parents = {}
1304
1032
for index, key, value, refs in self.iter_entries(search_keys):
1305
1033
parents = refs[0]
1306
1034
if not parents:
1307
parents = (_mod_revision.NULL_REVISION,)
1035
parents = (NULL_REVISION,)
1308
1036
found_parents[key] = parents
1309
1037
return found_parents
1311
has_key = _has_key_from_parent_map
1313
def insert_index(self, pos, index, name=None):
1039
def insert_index(self, pos, index):
1314
1040
"""Insert a new index in the list of indices to query.
1316
1042
:param pos: The position to insert the index.
1317
1043
:param index: The index to insert.
1318
:param name: a name for this index, e.g. a pack name. These names can
1319
be used to reflect index reorderings to related CombinedGraphIndex
1320
instances that use the same names. (see set_sibling_indices)
1322
1045
self._indices.insert(pos, index)
1323
self._index_names.insert(pos, name)
1325
1047
def iter_all_entries(self):
1326
1048
"""Iterate over all keys within the index
1400
1106
seen_keys = set()
1404
for index in self._indices:
1406
for node in index.iter_entries_prefix(keys):
1407
if node[1] in seen_keys:
1409
seen_keys.add(node[1])
1413
hit_indices.append(index)
1415
except errors.NoSuchFile:
1416
self._reload_or_raise()
1417
self._move_to_front(hit_indices)
1419
def _move_to_front(self, hit_indices):
1420
"""Rearrange self._indices so that hit_indices are first.
1422
Order is maintained as much as possible, e.g. the first unhit index
1423
will be the first index in _indices after the hit_indices, and the
1424
hit_indices will be present in exactly the order they are passed to
1427
_move_to_front propagates to all objects in self._sibling_indices by
1428
calling _move_to_front_by_name.
1430
if self._indices[:len(hit_indices)] == hit_indices:
1431
# The 'hit_indices' are already at the front (and in the same
1432
# order), no need to re-order
1434
hit_names = self._move_to_front_by_index(hit_indices)
1435
for sibling_idx in self._sibling_indices:
1436
sibling_idx._move_to_front_by_name(hit_names)
1438
def _move_to_front_by_index(self, hit_indices):
1439
"""Core logic for _move_to_front.
1441
Returns a list of names corresponding to the hit_indices param.
1443
indices_info = zip(self._index_names, self._indices)
1444
if 'index' in debug.debug_flags:
1445
trace.mutter('CombinedGraphIndex reordering: currently %r, '
1446
'promoting %r', indices_info, hit_indices)
1449
new_hit_indices = []
1452
for offset, (name, idx) in enumerate(indices_info):
1453
if idx in hit_indices:
1454
hit_names.append(name)
1455
new_hit_indices.append(idx)
1456
if len(new_hit_indices) == len(hit_indices):
1457
# We've found all of the hit entries, everything else is
1459
unhit_names.extend(self._index_names[offset+1:])
1460
unhit_indices.extend(self._indices[offset+1:])
1463
unhit_names.append(name)
1464
unhit_indices.append(idx)
1466
self._indices = new_hit_indices + unhit_indices
1467
self._index_names = hit_names + unhit_names
1468
if 'index' in debug.debug_flags:
1469
trace.mutter('CombinedGraphIndex reordered: %r', self._indices)
1472
def _move_to_front_by_name(self, hit_names):
1473
"""Moves indices named by 'hit_names' to front of the search order, as
1474
described in _move_to_front.
1476
# Translate names to index instances, and then call
1477
# _move_to_front_by_index.
1478
indices_info = zip(self._index_names, self._indices)
1480
for name, idx in indices_info:
1481
if name in hit_names:
1482
hit_indices.append(idx)
1483
self._move_to_front_by_index(hit_indices)
1485
def find_ancestry(self, keys, ref_list_num):
1486
"""Find the complete ancestry for the given set of keys.
1488
Note that this is a whole-ancestry request, so it should be used
1491
:param keys: An iterable of keys to look for
1492
:param ref_list_num: The reference list which references the parents
1494
:return: (parent_map, missing_keys)
1496
# XXX: make this call _move_to_front?
1497
missing_keys = set()
1499
keys_to_lookup = set(keys)
1501
while keys_to_lookup:
1502
# keys that *all* indexes claim are missing, stop searching them
1504
all_index_missing = None
1505
# print 'gen\tidx\tsub\tn_keys\tn_pmap\tn_miss'
1506
# print '%4d\t\t\t%4d\t%5d\t%5d' % (generation, len(keys_to_lookup),
1508
# len(missing_keys))
1509
for index_idx, index in enumerate(self._indices):
1510
# TODO: we should probably be doing something with
1511
# 'missing_keys' since we've already determined that
1512
# those revisions have not been found anywhere
1513
index_missing_keys = set()
1514
# Find all of the ancestry we can from this index
1515
# keep looking until the search_keys set is empty, which means
1516
# things we didn't find should be in index_missing_keys
1517
search_keys = keys_to_lookup
1519
# print ' \t%2d\t\t%4d\t%5d\t%5d' % (
1520
# index_idx, len(search_keys),
1521
# len(parent_map), len(index_missing_keys))
1524
# TODO: ref_list_num should really be a parameter, since
1525
# CombinedGraphIndex does not know what the ref lists
1527
search_keys = index._find_ancestors(search_keys,
1528
ref_list_num, parent_map, index_missing_keys)
1529
# print ' \t \t%2d\t%4d\t%5d\t%5d' % (
1530
# sub_generation, len(search_keys),
1531
# len(parent_map), len(index_missing_keys))
1532
# Now set whatever was missing to be searched in the next index
1533
keys_to_lookup = index_missing_keys
1534
if all_index_missing is None:
1535
all_index_missing = set(index_missing_keys)
1537
all_index_missing.intersection_update(index_missing_keys)
1538
if not keys_to_lookup:
1540
if all_index_missing is None:
1541
# There were no indexes, so all search keys are 'missing'
1542
missing_keys.update(keys_to_lookup)
1543
keys_to_lookup = None
1545
missing_keys.update(all_index_missing)
1546
keys_to_lookup.difference_update(all_index_missing)
1547
return parent_map, missing_keys
1107
for index in self._indices:
1108
for node in index.iter_entries_prefix(keys):
1109
if node[1] in seen_keys:
1111
seen_keys.add(node[1])
1549
1114
def key_count(self):
1550
1115
"""Return an estimate of the number of keys in this index.
1552
1117
For CombinedGraphIndex this is approximated by the sum of the keys of
1553
1118
the child indices. As child indices may have duplicate keys this can
1554
1119
have a maximum error of the number of child indices * largest number of
1555
1120
keys in any index.
1559
return sum((index.key_count() for index in self._indices), 0)
1560
except errors.NoSuchFile:
1561
self._reload_or_raise()
1563
missing_keys = _missing_keys_from_parent_map
1565
def _reload_or_raise(self):
1566
"""We just got a NoSuchFile exception.
1568
Try to reload the indices, if it fails, just raise the current
1571
if self._reload_func is None:
1573
exc_type, exc_value, exc_traceback = sys.exc_info()
1574
trace.mutter('Trying to reload after getting exception: %s',
1576
if not self._reload_func():
1577
# We tried to reload, but nothing changed, so we fail anyway
1578
trace.mutter('_reload_func indicated nothing has changed.'
1579
' Raising original exception.')
1580
raise exc_type, exc_value, exc_traceback
1582
def set_sibling_indices(self, sibling_combined_graph_indices):
1583
"""Set the CombinedGraphIndex objects to reorder after reordering self.
1585
self._sibling_indices = sibling_combined_graph_indices
1122
return sum((index.key_count() for index in self._indices), 0)
1587
1124
def validate(self):
1588
1125
"""Validate that everything in the index can be accessed."""
1591
for index in self._indices:
1594
except errors.NoSuchFile:
1595
self._reload_or_raise()
1126
for index in self._indices:
1598
1130
class InMemoryGraphIndex(GraphIndexBuilder):