aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-05 18:04:22 +0800
committerGravatar Runxi Yu2026-03-05 18:38:33 +0800
commitfdf1bd9a68091a1640b79fcb4ea979ed10f8b904 (patch)
treeb7b07f0e389fef267a2760fc6a4328c9e881e6a7
parentinternal/compress: Import flate and such from klauspost/compress (diff)
signatureNo signature
internal/compress/flate: Add InputConsumed
-rw-r--r--internal/compress/flate/inflate.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/compress/flate/inflate.go b/internal/compress/flate/inflate.go
index 6e90126d..d200d244 100644
--- a/internal/compress/flate/inflate.go
+++ b/internal/compress/flate/inflate.go
@@ -286,6 +286,14 @@ type Reader interface {
io.ByteReader
}
+// InputProgress reports compressed input bytes consumed by inflate state.
+//
+// InputConsumed returns bytes that have been consumed by the decompressor's
+// parser and state machine, not bytes merely read ahead from the source.
+type InputProgress interface {
+ InputConsumed() int64
+}
+
type step uint8
const (
@@ -344,6 +352,11 @@ type decompressor struct {
flushMode flushMode
}
+// InputConsumed returns compressed input bytes consumed by receiver.
+func (f *decompressor) InputConsumed() int64 {
+ return f.roffset
+}
+
func (f *decompressor) nextBlock() {
for f.nb < 1+2 {
if f.err = f.moreBits(); f.err != nil {