Part of bzrlib.index View In Hierarchy
The backing indices must implement GraphIndex, and are presumed to be static data.
Queries against the combined index will be made against the first index, and then the second and so on. The order of indices can thus influence performance significantly. For example, if one index is on local disk and a second on a remote server, the local disk index should be before the other in the index list.
Also, queries tend to need results from the same indices as previous queries. So the indices will be reordered after every query to put the indices that had the result(s) of that query first (while otherwise preserving the relative ordering).
Method | __init__ | Create a CombinedGraphIndex backed by indices. |
Method | __repr__ | Undocumented |
Method | clear_cache | See GraphIndex.clear_cache() |
Method | get_parent_map | See graph.StackedParentsProvider.get_parent_map |
Method | insert_index | Insert a new index in the list of indices to query. |
Method | iter_all_entries | Iterate over all keys within the index |
Method | iter_entries | Iterate over keys within the index. |
Method | iter_entries_prefix | Iterate over keys within the index using prefix matching. |
Method | find_ancestry | Find the complete ancestry for the given set of keys. |
Method | key_count | Return an estimate of the number of keys in this index. |
Method | set_sibling_indices | Set the CombinedGraphIndex objects to reorder after reordering self. |
Method | validate | Validate that everything in the index can be accessed. |
Method | _move_to_front | Rearrange self._indices so that hit_indices are first. |
Method | _move_to_front_by_index | Core logic for _move_to_front. |
Method | _move_to_front_by_name | Moves indices named by 'hit_names' to front of the search order, as |
Method | _reload_or_raise | We just got a NoSuchFile exception. |
Parameters | indices | An ordered list of indices to query for data. |
reload_func | A function to call if we find we are missing an index. Should have the form reload_func() => True/False to indicate if reloading actually changed anything. |
Parameters | pos | The position to insert the index. |
index | The index to insert. | |
name | a name for this index, e.g. a pack name. These names can be used to reflect index reorderings to related CombinedGraphIndex instances that use the same names. (see set_sibling_indices) |
Duplicate keys across child indices are presumed to have the same value and are only reported once.
Returns | An iterable of (index, key, reference_lists, value). There is no defined order for the result iteration - it will be in the most efficient order for the index. |
Duplicate keys across child indices are presumed to have the same value and are only reported once.
Parameters | keys | An iterable providing the keys to be retrieved. |
Returns | An iterable of (index, key, reference_lists, value). There is no defined order for the result iteration - it will be in the most efficient order for the index. |
Duplicate keys across child indices are presumed to have the same value and are only reported once.
Prefix matching is applied within the tuple of a key, not to within the bytestring of each key element. e.g. if you have the keys ('foo', 'bar'), ('foobar', 'gam') and do a prefix search for ('foo', None) then only the former key is returned.
Parameters | keys | An iterable providing the key prefixes to be retrieved. Each key prefix takes the form of a tuple the length of a key, but with the last N elements 'None' rather than a regular bytestring. The first element cannot be 'None'. |
Returns | An iterable as per iter_all_entries, but restricted to the keys with a matching prefix to those supplied. No additional keys will be returned, and every match that is in the index will be returned. |
Order is maintained as much as possible, e.g. the first unhit index will be the first index in _indices after the hit_indices, and the hit_indices will be present in exactly the order they are passed to _move_to_front.
_move_to_front propagates to all objects in self._sibling_indices by calling _move_to_front_by_name.
Returns a list of names corresponding to the hit_indices param.
Note that this is a whole-ancestry request, so it should be used sparingly.
Parameters | keys | An iterable of keys to look for |
ref_list_num | The reference list which references the parents we care about. | |
Returns | (parent_map, missing_keys) |
For CombinedGraphIndex this is approximated by the sum of the keys of the child indices. As child indices may have duplicate keys this can have a maximum error of the number of child indices * largest number of keys in any index.
Try to reload the indices, if it fails, just raise the current exception.