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

Function WithDecoderDictRaw

zstd/decoder_options.go:131–142  ·  view source on GitHub ↗

WithDecoderDictRaw registers a dictionary that may be used by the decoder. The slice content can be arbitrary data. Can be changed with ResetWithOptions.

(id uint32, content []byte)

Source from the content-addressed store, hash-verified

129// The slice content can be arbitrary data.
130// Can be changed with ResetWithOptions.
131func WithDecoderDictRaw(id uint32, content []byte) DOption {
132 return func(o *decoderOptions) error {
133 if bits.UintSize > 32 && uint(len(content)) > dictMaxLength {
134 return fmt.Errorf("dictionary of size %d > 2GiB too large", len(content))
135 }
136 if o.dicts == nil {
137 o.dicts = make(map[uint32]*dict)
138 }
139 o.dicts[id] = &dict{id: id, content: content, offsets: [3]int{1, 4, 8}}
140 return nil
141 }
142}
143
144// WithDecoderMaxWindow allows to set a maximum window size for decodes.
145// This allows rejecting packets that will cause big memory usage.

Callers 6

TestDecoderRawDictFunction · 0.85
TestDecoderDictDeleteFunction · 0.85

Calls

no outgoing calls

Tested by 6

TestDecoderRawDictFunction · 0.68
TestDecoderDictDeleteFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…