aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/codecs/zstd_dict_codec.h
blob: 59c1ad6c60691f673c893086d2bc0624b89281a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "codecs.h"

#include <util/generic/ptr.h>

namespace NCodecs {
    // benchmarks are here: https://st.yandex-team.ru/SEARCH-1655

    class TZStdDictCodec: public ICodec {
        class TImpl;
        TIntrusivePtr<TImpl> Impl;

    public:
        explicit TZStdDictCodec(ui32 comprLevel = 1);
        ~TZStdDictCodec() override;

        static TStringBuf MyName() {
            return "zstd08d";
        }

        TString GetName() const override;

        ui8 Encode(TStringBuf in, TBuffer& out) const override;

        void Decode(TStringBuf in, TBuffer& out) const override;

        static TVector<TString> ListCompressionNames();
        static int ParseCompressionName(TStringBuf);

    protected:
        void DoLearn(ISequenceReader& in) override;
        bool DoTryToLearn(ISequenceReader& in) final;
        void Save(IOutputStream* out) const override;
        void Load(IInputStream* in) override;
    };

}