b.g._GCGraphIndex(object) : class documentation

Part of bzrlib.groupcompress View In Hierarchy

Mapper from GroupCompressVersionedFiles needs into GraphIndex storage.
Method __init__ Construct a _GCGraphIndex on a graph_index.
Method add_records Add multiple records to the index.
Method find_ancestry See CombinedGraphIndex.find_ancestry
Method get_parent_map Get a map of the parents of keys.
Method get_missing_parents Return the keys of missing parents.
Method get_build_details Get the various build details for keys.
Method keys Get all the keys in the collection.
Method scan_unvalidated_index Inform this _GCGraphIndex that there is an unvalidated index.
Method _check_read Raise an exception if reads are not permitted.
Method _check_write_ok Raise an exception if writes are not permitted.
Method _get_entries Get the entries for keys.
Method _node_to_position Convert an index value to position details.
def __init__(self, graph_index, is_locked, parents=True, add_callback=None, track_external_parent_refs=False, inconsistency_fatal=True, track_new_keys=False):
Construct a _GCGraphIndex on a graph_index.
Parametersgraph_indexAn implementation of bzrlib.index.GraphIndex.
is_lockedA callback, returns True if the index is locked and thus usable.
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), ...]
track_external_parent_refsAs keys are added, keep track of the keys they reference, so that we can query get_missing_parents(), etc.
inconsistency_fatalWhen asked to add records that are already present, and the details are inconsistent with the existing record, raise an exception instead of warning (and skipping the record).
def add_records(self, records, random_id=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.
def _check_read(self):
Raise an exception if reads are not permitted.
def _check_write_ok(self):
Raise an exception if writes are not permitted.
def _get_entries(self, keys, check_present=False):
Get the entries for keys.

Note: Callers are responsible for checking that the index is locked before calling this method.

ParameterskeysAn iterable of index key tuples.
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_missing_parents(self):
Return the keys of missing parents.
def get_build_details(self, keys):
Get the various build details for keys.

Ghosts are omitted from the result.

ParameterskeysAn iterable of keys.
Returns

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 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 scan_unvalidated_index(self, graph_index):
Inform this _GCGraphIndex that there is an unvalidated index.

This allows this _GCGraphIndex to keep track of any missing compression parents we may want to have filled in to make those indices valid. It also allows _GCGraphIndex to track any new keys.

Parametersgraph_indexA GraphIndex
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.