Part of bzrlib.smart.repository View In Hierarchy
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 Variables | byte_stream | The byte stream being decoded. |
stream_decoder | A pack parser used to decode the bytestream | |
current_type | The current type, used to join adjacent records of the same type into a single stream. | |
first_bytes | The 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. |