b.i.InMemoryGraphIndex(GraphIndexBuilder) : class documentation

Part of bzrlib.index View In Hierarchy

A GraphIndex which operates entirely out of memory and is mutable.

This is designed to allow the accumulation of GraphIndex entries during a single write operation, where the accumulated entries need to be immediately available - for example via a CombinedGraphIndex.

Method add_nodes Add nodes to the index.
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 key_count Return an estimate of the number of keys in this index.
Method validate In memory index's have no known corruption at the moment.

Inherited from GraphIndexBuilder:

Method __init__ Create a GraphIndex builder.
Method add_node Add a node to the index.
Method clear_cache See GraphIndex.clear_cache()
Method finish Finish the index.
Method set_optimize Change how the builder tries to optimize the result.
Method find_ancestry See CombinedGraphIndex.find_ancestry()
Method _check_key Raise BadIndexKey if key is not a valid key for this index.
Method _external_references Return references that are not present in this index.
Method _get_nodes_by_key Undocumented
Method _update_nodes_by_key Update the _nodes_by_key dict with a new key.
Method _check_key_ref_value Check that 'key' and 'references' are all valid.
def add_nodes(self, nodes):
Add nodes to the index.
ParametersnodesAn iterable of (key, node_refs, value) entries to add.
def iter_all_entries(self):
Iterate over all keys within the index
ReturnsAn 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 (in this case dictionary hash order).
def iter_entries(self, keys):
Iterate over keys within the index.
ParameterskeysAn iterable providing the keys to be retrieved.
ReturnsAn iterable of (index, key, value, reference_lists). There is no defined order for the result iteration - it will be in the most efficient order for the index (keys iteration order in this case).
def iter_entries_prefix(self, keys):
Iterate over keys within the index using prefix matching.

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.

ParameterskeysAn 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'.
ReturnsAn 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.
def key_count(self):
Return an estimate of the number of keys in this index.

For InMemoryGraphIndex the estimate is exact.

def validate(self):
In memory index's have no known corruption at the moment.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.