MCPcopy
hub / github.com/valyala/fasthttp / acquireRealZstdWriter

Function acquireRealZstdWriter

zstd.go:65–79  ·  view source on GitHub ↗
(w io.Writer, level int)

Source from the content-addressed store, hash-verified

63}
64
65func acquireRealZstdWriter(w io.Writer, level int) *zstd.Encoder {
66 nLevel := normalizeZstdCompressLevel(level)
67 p := realZstdWriterPoolMap[nLevel]
68 v := p.Get()
69 if v == nil {
70 zw, err := zstd.NewWriter(w, zstd.WithEncoderLevel(zstd.EncoderLevel(nLevel)))
71 if err != nil {
72 panic(err)
73 }
74 return zw
75 }
76 zw := v.(*zstd.Encoder)
77 zw.Reset(w)
78 return zw
79}
80
81func releaseRealZstdWriter(zw *zstd.Encoder, level int) {
82 zw.Close()

Callers 2

nonblockingWriteZstdFunction · 0.85

Calls 3

ResetMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…