MCPcopy
hub / github.com/klauspost/compress / encodeBlockSnappy

Function encodeBlockSnappy

s2/encode_go.go:64–72  ·  view source on GitHub ↗

encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It assumes that the varint-encoded length of the decompressed bytes has already been written. It also assumes that: len(dst) >= MaxEncodedLen(len(src))

(dst, src []byte)

Source from the content-addressed store, hash-verified

62//
63// len(dst) >= MaxEncodedLen(len(src))
64func encodeBlockSnappy(dst, src []byte) (d int) {
65 if len(src) < minNonLiteralBlockSize {
66 return 0
67 }
68 if len(src) <= 64<<10 {
69 return encodeBlockSnappyGo64K(dst, src)
70 }
71 return encodeBlockSnappyGo(dst, src)
72}
73
74// emitLiteral writes a literal chunk and returns the number of bytes written.
75//

Callers 2

EncodeSnappyFunction · 0.70
encodeBlockMethod · 0.70

Calls 2

encodeBlockSnappyGo64KFunction · 0.85
encodeBlockSnappyGoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…