Skip to content

Commit 5862457

Browse files
encoding: remove unused DecompressedSize API (grpc#8830)
Fixes: grpc#7788 This change removes the unused `DecompressedSize` API from the gzip `compressor` and the corresponding documentation in the encoding package. RELEASE NOTES: N/A
1 parent e15b867 commit 5862457

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

encoding/encoding.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ func init() {
5858

5959
// Compressor is used for compressing and decompressing when sending or
6060
// receiving messages.
61-
//
62-
// If a Compressor implements `DecompressedSize(compressedBytes []byte) int`,
63-
// gRPC will invoke it to determine the size of the buffer allocated for the
64-
// result of decompression. A return value of -1 indicates unknown size.
6561
type Compressor interface {
6662
// Compress writes the data written to wc to w after compressing it. If an
6763
// error occurs while initializing the compressor, that error is returned

encoding/gzip/gzip.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ package gzip
2727

2828
import (
2929
"compress/gzip"
30-
"encoding/binary"
3130
"fmt"
3231
"io"
3332
"sync"
@@ -111,17 +110,6 @@ func (z *reader) Read(p []byte) (n int, err error) {
111110
return n, err
112111
}
113112

114-
// RFC1952 specifies that the last four bytes "contains the size of
115-
// the original (uncompressed) input data modulo 2^32."
116-
// gRPC has a max message size of 2GB so we don't need to worry about wraparound.
117-
func (c *compressor) DecompressedSize(buf []byte) int {
118-
last := len(buf)
119-
if last < 4 {
120-
return -1
121-
}
122-
return int(binary.LittleEndian.Uint32(buf[last-4 : last]))
123-
}
124-
125113
func (c *compressor) Name() string {
126114
return Name
127115
}

0 commit comments

Comments
 (0)