b.i.GraphIndexPrefixAdapter(object) : class documentation

Part of bzrlib.index View In Hierarchy

An adapter between GraphIndex with different key lengths.

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.
def __init__(self, adapted, prefix, missing_key_length, add_nodes_callback=None):
Construct an adapter against adapted with prefix.
def add_nodes(self, nodes):
Add nodes to the index.
ParametersnodesAn iterable of (key, node_refs, value) entries to add.
def add_node(self, key, value, references=()):
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 
.
        
def _strip_prefix(self, an_iter):
Strip prefix data from nodes and return it.
def iter_all_entries(self):
Iterate over all keys within the index

iter_all_entries is implemented against the adapted index using iter_entries_prefix.

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 GraphIndexPrefixAdapter this is relatively expensive - key iteration with the prefix is done.

def validate(self):
Call the adapted's validate.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.