MCPcopy Create free account
hub / github.com/go-git/go-git / GetZlibReader

Function GetZlibReader

utils/sync/zlib.go:43–50  ·  view source on GitHub ↗

GetZlibReader returns a ZLibReader that is managed by a sync.Pool. Returns a ZLibReader that is reset using a dictionary that is also managed by a sync.Pool. After use, the ZLibReader should be put back into the sync.Pool by calling PutZlibReader.

(r io.Reader)

Source from the content-addressed store, hash-verified

41// After use, the ZLibReader should be put back into the sync.Pool
42// by calling PutZlibReader.
43func GetZlibReader(r io.Reader) (ZLibReader, error) {
44 z := zlibReader.Get().(ZLibReader)
45 z.dict = GetByteSlice()
46
47 err := z.Reader.Reset(r, *z.dict)
48
49 return z, err
50}
51
52// PutZlibReader puts z back into its sync.Pool, first closing the reader.
53// The Byte slice dictionary is also put back into its sync.Pool.

Callers 5

asyncReaderFunction · 0.92
ReadObjectMethod · 0.92
copyObjectMethod · 0.92
NewReaderFunction · 0.92
TestGetAndPutZlibReaderFunction · 0.85

Calls 3

GetByteSliceFunction · 0.85
GetMethod · 0.65
ResetMethod · 0.45

Tested by 1

TestGetAndPutZlibReaderFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…