b.g._CommonGroupCompressor(object) : class documentation

Part of bzrlib.groupcompress View In Hierarchy

Known subclasses: bzrlib.groupcompress.PyrexGroupCompressor, bzrlib.groupcompress.PythonGroupCompressor

No class docstring
Method __init__ Create a GroupCompressor.
Method compress Compress lines with label key.
Method extract Extract a key previously added to the compressor.
Method flush Finish this group, creating a formatted stream.
Method pop_last Call this if you want to 'revoke' the last compression.
Method ratio Return the overall compression ratio.
Method _compress Compress lines with label key.
def __init__(self, settings=None):
Create a GroupCompressor.
def compress(self, key, bytes, expected_sha, nostore_sha=None, soft=False):
Compress lines with label key.
ParameterskeyA key tuple. It is stored in the output for identification of the text during decompression. If the last element is 'None' it is replaced with the sha1 of the text - e.g. sha1:xxxxxxx.
bytesThe bytes to be compressed
expected_shaIf non-None, the sha the lines are believed to have. During compression the sha is calculated; a mismatch will cause an error.
nostore_shaIf the computed sha1 sum matches, we will raise ExistingContent rather than adding the text.
softDo a 'soft' compression. This means that we require larger ranges to match to be considered for a copy command.
ReturnsThe sha1 of lines, the start and end offsets in the delta, and the type ('fulltext' or 'delta').
See Also
def _compress(self, key, bytes, max_delta_size, soft=False):
Compress lines with label key.
ParameterskeyA key tuple. It is stored in the output for identification of the text during decompression.
bytesThe bytes to be compressed
max_delta_sizeThe size above which we issue a fulltext instead of a delta.
softDo a 'soft' compression. This means that we require larger ranges to match to be considered for a copy command.
ReturnsThe sha1 of lines, the start and end offsets in the delta, and the type ('fulltext' or 'delta').
def extract(self, key):
Extract a key previously added to the compressor.
ParameterskeyThe key to extract.
ReturnsAn iterable over bytes and the sha1.
def flush(self):
Finish this group, creating a formatted stream.

After calling this, the compressor should no longer be used

def pop_last(self):
Call this if you want to 'revoke' the last compression.

After this, the data structures will be rolled back, but you cannot do more compression.

def ratio(self):
Return the overall compression ratio.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.