partial-io icon indicating copy to clipboard operation
partial-io copied to clipboard

Fix definition of PartialOp::Limited to consume just the number of bytes written

Open sunshowers opened this issue 2 years ago • 0 comments

Let's say we have a PartialOp::Limited(4096). If a write call results in 1024 bytes being written, we consume the entire PartialOp::Limited.

Because of buffering and such, this means that we can't predict how many bytes would be written out before an error.

Instead, what we should do is consume just the number of bytes written, in this case transforming the PartialOp::Limited(4096) to PartialOp::Limited(3072). That would make it so that we can statically analyze a list of operations to determine how many bytes would be written before an error occurs.

sunshowers avatar Mar 01 '23 00:03 sunshowers