Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoder should buffer writes until flushed #10

Open
Steelskin opened this issue Sep 19, 2014 · 1 comment
Open

Encoder should buffer writes until flushed #10

Steelskin opened this issue Sep 19, 2014 · 1 comment

Comments

@Steelskin
Copy link
Contributor

Original issue 10 created by openvcdiff on 2008-09-12T16:46:51.000Z:

The current encoder interface VCDiffStreamingEncoder::EncodeChunk() accepts a contiguous block of memory and creates a single VCDIFF delta window (including a window header) each time it is called. The intended use is for the caller to gather all available input data into a buffer before calling EncodeChunk(), so that the encoded delta window can be sent to streaming output such as a TCP connection or output file.

However, there may be cases in which the currently available input data is split up into more than one contiguous memory block. Imagine that, instead of a single block "ABCDEF", two blocks "ABC" and "DEF" are available for encoding. EncodeChunk("ABC", ...) will be called, then EncodeChunk("DEF", ...), and each of the two blocks will get its own delta window header (about a dozen bytes.) To avoid wasting that space, the caller has to copy the multiple blocks into a single contiguous memory buffer before calling EncodeChunk().

Proposed enhancement: add a new interface (probably a new encoder class in addition to VCDiffStreamingEncoder) that will queue up calls to EncodeChunk() and not output a delta window until a function FinishWindow() is called. The caller will use FinishWindow() to indicate that no more
input data is available at the moment, and that the encoder should generate as much output data as it can. Calling FinishEncoding() will implicitly finish the current window.

@Steelskin
Copy link
Contributor Author

This would be nice improvement but not as important as other urgent improvements. Lowering priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant