BundleReader, Containers, and file IO

Andrew Bennetts andrew at canonical.com
Sun Oct 28 08:02:58 GMT 2007


John Arbash Meinel wrote:
[...]
> Aaron Bentley wrote:
> > Aaron Bentley wrote:
> >> I think what happens with pipes is that when you over-read, you get a
> >> short read.  Then the next time you read, you get an IO error.
> > 
> > Further testing shows that read pipes behave just like files; they do
> > not raise an IO error when you reach the end.  So I think over-reading a
> > pipe is no problem.
> > 
> > Aaron
> 
> Unless you want to be able to stream multiple packs over the pipe.
> 
> But generally, I would agree with you.

That's not a problem; the container format has an end-of-container marker, so
the parser can easily keep track of which bytes are excess to the container.  So
if you're expecting multiple packs on one pipe, you can then just feed those
unused bytes into a fresh container parser before reading more from the pipe.

-Andrew.




More information about the bazaar mailing list