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

Function WithDecoderDicts

zstd/decoder_options.go:112–126  ·  view source on GitHub ↗

WithDecoderDicts allows to register one or more dictionaries for the decoder. Each slice in dict must be in the [dictionary format] produced by "zstd --train" from the Zstandard reference implementation. If several dictionaries with the same ID are provided, the last one will be used. Can be chang

(dicts ...[]byte)

Source from the content-addressed store, hash-verified

110//
111// [dictionary format]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary-format
112func WithDecoderDicts(dicts ...[]byte) DOption {
113 return func(o *decoderOptions) error {
114 if o.dicts == nil {
115 o.dicts = make(map[uint32]*dict)
116 }
117 for _, b := range dicts {
118 d, err := loadDict(b)
119 if err != nil {
120 return err
121 }
122 o.dicts[d.id] = d
123 }
124 return nil
125 }
126}
127
128// WithDecoderDictRaw registers a dictionary that may be used by the decoder.
129// The slice content can be arbitrary data.

Callers 8

FuzzEncodingFunction · 0.85
TestDecoder_SmallDictFunction · 0.85
TestEncoder_SmallDictFunction · 0.85
TestDecoder_MoreDictsFunction · 0.85
TestDecoder_MoreDicts2Function · 0.85

Calls 1

loadDictFunction · 0.85

Tested by 8

FuzzEncodingFunction · 0.68
TestDecoder_SmallDictFunction · 0.68
TestEncoder_SmallDictFunction · 0.68
TestDecoder_MoreDictsFunction · 0.68
TestDecoder_MoreDicts2Function · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…