b.knit : module documentation

Part of bzrlib

Knit versionedfile implementation.

A knit is a versioned file implementation that supports efficient append only updates.

Knit file layout: lifeless: the data file is made up of "delta records". each delta record has a delta header that contains; (1) a version id, (2) the size of the delta (in lines), and (3) the digest of the -expanded data- (ie, the delta applied to the parent). the delta also ends with a end-marker; simply "end VERSION"

delta can be line or full contents.a ... the 8's there are the index number of the annotation. version robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad 7 c7d23b2a5bd6ca00e8e266cec0ec228158ee9f9e 59,59,3 8 8 if ie.executable: 8 e.set('executable', 'yes') 130,130,2 8 if elt.get('executable') == 'yes': 8 ie.executable = True end robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad

whats in an index: 09:33 < jrydberg> lifeless: each index is made up of a tuple of; version id, options, position, size, parents 09:33 < jrydberg> lifeless: the parents are currently dictionary compressed 09:33 < jrydberg> lifeless: (meaning it currently does not support ghosts) 09:33 < lifeless> right 09:33 < jrydberg> lifeless: the position and size is the range in the data file

so the index sequence is the dictionary compressed sequence number used in the deltas to provide line annotation

Class KnitAdapter Base class for knit record adaption.
Class FTAnnotatedToUnannotated An adapter from FT annotated knits to unannotated ones.
Class DeltaAnnotatedToUnannotated An adapter for deltas from annotated to unannotated.
Class FTAnnotatedToFullText An adapter from FT annotated knits to unannotated ones.
Class DeltaAnnotatedToFullText An adapter for deltas from annotated to unannotated.
Class FTPlainToFullText An adapter from FT plain knits to unannotated ones.
Class DeltaPlainToFullText An adapter for deltas from annotated to unannotated.
Class KnitContentFactory Content factory for streaming from knits.
Class LazyKnitContentFactory A ContentFactory which can either generate full text or a wire form.
Function knit_delta_closure_to_records Convert a network record to a iterator over stream records.
Function knit_network_to_record Convert a network record to a record object.
Class KnitContent Content of a knit version to which deltas can be applied.
Class AnnotatedKnitContent Annotated content.
Class PlainKnitContent Unannotated content.
Class KnitAnnotateFactory Factory for creating annotated Content objects.
Class KnitPlainFactory Factory for creating plain Content objects.
Function make_file_factory Create a factory for creating a file based KnitVersionedFiles.
Function make_pack_factory Create a factory for creating a pack based VersionedFiles.
Function cleanup_pack_knit Undocumented
Class KnitVersionedFiles Storage for many versioned files using knit compression.
Function annotate_knit Annotate a knit with no cached annotations.
Class _KnitFactory Base class for common Factory functions.
Function _get_total_build_size Determine the total bytes to build these keys.
Class _ContentMapGenerator Generate texts or expose raw deltas for a set of texts.
Class _VFContentMapGenerator Content map generator reading from a VersionedFiles object.
Class _NetworkContentMapGenerator Content map generator sourced from a network stream.
Class _KndxIndex Manages knit index files
Class _KnitGraphIndex A KnitVersionedFiles index layered on GraphIndex.
Class _KnitKeyAccess Access to records in .knit files.
Class _KnitAnnotator Build up the annotations for a text.
def knit_delta_closure_to_records(storage_kind, bytes, line_end):
Convert a network record to a iterator over stream records.
Parametersstorage_kindThe storage kind of the record. Must be 'knit-delta-closure'.
bytesThe bytes of the record on the network.
def knit_network_to_record(storage_kind, bytes, line_end):
Convert a network record to a record object.
Parametersstorage_kindThe storage kind of the record.
bytesThe bytes of the record on the network.
def make_file_factory(annotated, mapper):
Create a factory for creating a file based KnitVersionedFiles.

This is only functional enough to run interface tests, it doesn't try to provide a full pack environment.

Parametersannotatedknit annotations are wanted.
mapperThe mapper from keys to paths.
def make_pack_factory(graph, delta, keylength):
Create a factory for creating a pack based VersionedFiles.

This is only functional enough to run interface tests, it doesn't try to provide a full pack environment.

ParametersgraphStore a graph.
deltaDelta compress contents.
keylengthHow long should keys be.
def cleanup_pack_knit(versioned_files):
Undocumented
def _get_total_build_size(self, keys, positions):
Determine the total bytes to build these keys.

(helper function because _KnitGraphIndex and _KndxIndex work the same, but don't inherit from a common base.)

ParameterskeysKeys that we want to build
positionsdict of {key, (info, index_memo, comp_parent)} (such as returned by _get_components_positions)
ReturnsNumber of bytes to build those keys
def annotate_knit(knit, revision_id):
Annotate a knit with no cached annotations.

This implementation is for knits with no cached annotations. It will work for knits with cached annotations, but this is not recommended.

API Documentation for Bazaar, generated by pydoctor at 2019-08-17 00:32:45.