b.c.InternalNode(Node) : class documentation

Part of bzrlib.chk_map View In Hierarchy

A node that contains references to other nodes.

An InternalNode is responsible for mapping search key prefixes to child nodes.

Instance Variables_itemsserialised_key => node dictionary. node may be a tuple, LeafNode or InternalNode.
Method __init__ Create a node.
Method add_node Add a child node with prefix prefix, and node node.
Class Method deserialise Deserialise bytes to an InternalNode, with key key.
Method iteritems Undocumented
Method map Map key to value.
Method serialise Serialise the node to store.
Method refs Return the references to other CHK's held by this node.
Method unmap Remove key from this node and its children.
Method _current_size Answer the current serialised size of this node.
Method _iter_nodes Iterate over node objects which match key_filter.
Method _new_child Create a new child node of type klass.
Method _search_key Return the serialised key for key in this node.
Method _search_prefix_filter Serialise key for use as a prefix filter in iteritems.
Method _split Split this node into smaller nodes starting at offset.
Method _compute_search_prefix Return the unique key prefix for this node.
Method _check_remap Check if all keys contained by children fit in a single LeafNode.

Inherited from Node:

Method __repr__ Undocumented
Method key Undocumented
Method __len__ Undocumented
Method maximum_size What is the upper limit for adding references to a node.
Method set_maximum_size Set the size threshold for nodes.
Class Method common_prefix Given 2 strings, return the longest prefix common to both.
Class Method common_prefix_for_keys Given a list of keys, find their common prefix.
def __init__(self, prefix='', search_key_func=None):
Create a node.
Parameterskey_widthThe width of keys for this node.
def add_node(self, prefix, node):
Add a child node with prefix prefix, and node node.
ParametersprefixThe search key prefix for node.
nodeThe node being added.
def _current_size(self):
Answer the current serialised size of this node.
@classmethod
def deserialise(klass, bytes, key, search_key_func=None):
Deserialise bytes to an InternalNode, with key key.
ParametersbytesThe bytes of the node.
keyThe key that the serialised node has.
ReturnsAn InternalNode instance.
def iteritems(self, store, key_filter=None):
Undocumented
def _iter_nodes(self, store, key_filter=None, batch_size=None):
Iterate over node objects which match key_filter.
ParametersstoreA store to use for accessing content.
key_filterA key filter to filter nodes. Only nodes that might contain a key in key_filter will be returned.
batch_sizeIf not None, then we will return the nodes that had to be read using get_record_stream in batches, rather than reading them all at once.
ReturnsAn iterable of nodes. This function does not have to be fully consumed. (There will be no pending I/O when items are being returned.)
def map(self, store, key, value):
Map key to value.
def _new_child(self, search_key, klass):
Create a new child node of type klass.
def serialise(self, store):
Serialise the node to store.
ParametersstoreA VersionedFiles honouring the CHK extensions.
ReturnsAn iterable of the keys inserted by this operation.
def _search_key(self, key):
Return the serialised key for key in this node.
def _search_prefix_filter(self, key):
Serialise key for use as a prefix filter in iteritems.
def _split(self, offset):
Split this node into smaller nodes starting at offset.
ParametersoffsetThe offset to start the new child nodes at.
ReturnsAn iterable of (prefix, node) tuples. prefix is a byte prefix for reaching node.
def refs(self):
Return the references to other CHK's held by this node.
def _compute_search_prefix(self, extra_key=None):
Return the unique key prefix for this node.
ReturnsA bytestring of the longest search key prefix that is unique within this node.
def unmap(self, store, key, check_remap=True):
Remove key from this node and its children.
def _check_remap(self, store):
Check if all keys contained by children fit in a single LeafNode.
ParametersstoreA store to use for reading more nodes
ReturnsEither self, or a new LeafNode which should replace self.
API Documentation for Bazaar, generated by pydoctor at 2019-07-20 00:30:16.