Part of bzrlib.index View In Hierarchy
Queries against this will emit queries against the adapted Graph with the prefix added, queries for all items use iter_entries_prefix. The returned nodes will have their keys and node references adjusted to remove the prefix. Finally, an add_nodes_callback can be supplied - when called the nodes and references being added will have prefix prepended.
Method | __init__ | Construct an adapter against adapted with prefix. |
Method | add_nodes | Add nodes to the index. |
Method | add_node | Add a node 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 | Call the adapted's validate. |
Method | _strip_prefix | Strip prefix data from nodes and return it. |
Parameters | nodes | An iterable of (key, node_refs, value) entries to add. |
Add a node to the index. :param key: The key. keys are non-empty tuples containing as many whitespace-free utf8 bytestrings as the key length defined for this index. :param references: An iterable of iterables of keys. Each is a reference to another key. :param value: The value to associate with the key. It may be any bytes as long as it does not contain or .
iter_all_entries is implemented against the adapted index using iter_entries_prefix.
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 (in this case dictionary hash order). |
Parameters | keys | An iterable providing the keys to be retrieved. |
Returns | An 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). |
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. |