b.s.r._ByteStreamDecoder(object) : class documentation

Part of bzrlib.smart.repository View In Hierarchy

Helper for _byte_stream_to_stream.

The expected usage of this class is via the function _byte_stream_to_stream which creates a _ByteStreamDecoder, pops off the stream format and then yields the output of record_stream(), the main entry point to _ByteStreamDecoder.

Broadly this class has to unwrap two layers of iterators: (type, substream) (substream details)

This is complicated by wishing to return type, iterator_for_type, but getting the data for iterator_for_type when we find out type: we can't simply pass a generator down to the NetworkRecordStream parser, instead we have a little local state to seed each NetworkRecordStream instance, and gather the type that we'll be yielding.

Instance Variablesbyte_streamThe byte stream being decoded.
stream_decoderA pack parser used to decode the bytestream
current_typeThe current type, used to join adjacent records of the same type into a single stream.
first_bytesThe first bytes to give the next NetworkRecordStream.
Method __init__ Create a _ByteStreamDecoder.
Method iter_stream_decoder Iterate the contents of the pack from stream_decoder.
Method iter_substream_bytes Undocumented
Method record_stream Yield substream_type, substream from the byte stream.
Method seed_state Prepare the _ByteStreamDecoder to decode from the pack stream.
def __init__(self, byte_stream, record_counter):
Create a _ByteStreamDecoder.
def iter_stream_decoder(self):
Iterate the contents of the pack from stream_decoder.
def iter_substream_bytes(self):
Undocumented
def record_stream(self):
Yield substream_type, substream from the byte stream.
def seed_state(self):
Prepare the _ByteStreamDecoder to decode from the pack stream.
API Documentation for Bazaar, generated by pydoctor at 2019-10-20 00:34:54.