b.k._KnitGraphIndex(object) : class documentation

Part of bzrlib.knit View In Hierarchy

A KnitVersionedFiles index layered on GraphIndex.
Method __init__ Construct a KnitGraphIndex on a graph_index.
Method __repr__ Undocumented
Method add_records Add multiple records to the index.
Method scan_unvalidated_index Inform this _KnitGraphIndex that there is an unvalidated index.
Method get_missing_compression_parents Return the keys of missing compression parents.
Method get_missing_parents Return the keys of missing parents.
Method get_build_details Get the method, index_memo and compression parent for version_ids.
Method get_method Return compression method of specified key.
Method get_options Return a list representing options.
Method find_ancestry See CombinedGraphIndex.find_ancestry()
Method get_parent_map Get a map of the parents of keys.
Method get_position Return details needed to access the version.
Method keys Get all the keys in the collection.
Method _check_read raise if reads are not permitted.
Method _check_write_ok Assert if writes are not permitted.
Method _compression_parent Undocumented
Method _get_entries Get the entries for keys.
Method _get_method Undocumented
Method _get_node Undocumented
Method _node_to_position Convert an index value to position details.
Method _sort_keys_by_io Figure out an optimal order to read the records for the given keys.
def __init__(self, graph_index, is_locked, deltas=False, parents=True, add_callback=None, track_external_parent_refs=False):
Construct a KnitGraphIndex on a graph_index.
Parametersgraph_indexAn implementation of bzrlib.index.GraphIndex.
is_lockedA callback to check whether the object should answer queries.
deltasAllow delta-compressed records.
parentsIf True, record knits parents, if not do not record parents.
add_callbackIf not None, allow additions to the index and call this callback with a list of added GraphIndex nodes: [(node, value, node_refs), ...]
is_lockedA callback, returns True if the index is locked and thus usable.
track_external_parent_refsIf True, record all external parent references parents from added records. These can be retrieved later by calling get_missing_parents().
def __repr__(self):
Undocumented
def add_records(self, records, random_id=False, missing_compression_parents=False):
Add multiple records to the index.

This function does not insert data into the Immutable GraphIndex backing the KnitGraphIndex, instead it prepares data for insertion by the caller and checks that it is safe to insert then calls self._add_callback with the prepared GraphIndex nodes.

Parametersrecordsa list of tuples: (key, options, access_memo, parents).
random_idIf True the ids being added were randomly generated and no check for existence will be performed.
missing_compression_parentsIf True the records being added are only compressed against texts already in the index (or inside records). If False the records all refer to unavailable texts (or texts inside records) as compression parents.
def scan_unvalidated_index(self, graph_index):
Inform this _KnitGraphIndex that there is an unvalidated index.

This allows this _KnitGraphIndex to keep track of any missing compression parents we may want to have filled in to make those indices valid.

Parametersgraph_indexA GraphIndex
def get_missing_compression_parents(self):
Return the keys of missing compression parents.

Missing compression parents occur when a record stream was missing basis texts, or a index was scanned that had missing basis texts.

def get_missing_parents(self):
Return the keys of missing parents.
def _check_read(self):
raise if reads are not permitted.
def _check_write_ok(self):
Assert if writes are not permitted.
def _compression_parent(self, an_entry):
Undocumented
def get_build_details(self, keys):
Get the method, index_memo and compression parent for version_ids.

Ghosts are omitted from the result.

:param keys: An iterable of keys.
:return: A dict of key:
    (index_memo, compression_parent, parents, record_details).
    index_memo
        opaque structure to pass to read_records to extract the raw
        data
    compression_parent
        Content that this record is built upon, may be None
    parents
        Logical parents of this node
    record_details
        extra information about the content which needs to be passed to
        Factory.parse_record
def _get_entries(self, keys, check_present=False):
Get the entries for keys.
ParameterskeysAn iterable of index key tuples.
def get_method(self, key):
Return compression method of specified key.
def _get_method(self, node):
Undocumented
def _get_node(self, key):
Undocumented
def get_options(self, key):
Return a list representing options.

e.g. ['foo', 'bar']

def find_ancestry(self, keys):
See CombinedGraphIndex.find_ancestry()
def get_parent_map(self, keys):
Get a map of the parents of keys.
ParameterskeysThe keys to look up parents for.
ReturnsA mapping from keys to parents. Absent keys are absent from the mapping.
def get_position(self, key):
Return details needed to access the version.
Returnsa tuple (index, data position, size) to hand to the access logic to get the record.
def keys(self):
Get all the keys in the collection.

The keys are not ordered.

def _node_to_position(self, node):
Convert an index value to position details.
def _sort_keys_by_io(self, keys, positions):
Figure out an optimal order to read the records for the given keys.

Sort keys, grouped by index and sorted by position.

ParameterskeysA list of keys whose records we want to read. This will be sorted 'in-place'.
positionsA dict, such as the one returned by _get_components_positions()
ReturnsNone
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.