aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/transactionlog/chunks.h
blob: 572893d4975e2c07039f1817e5d229d57a299f85 (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
39
40
41
42
43
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "ichunk.h"
#include <vespa/vespalib/util/compressionconfig.h>

namespace search::transactionlog {

/// Current default chunk serialisation format
class XXH64NoneChunk : public IChunk {
protected:
    Encoding onEncode(nbostream &os) const override;
    void onDecode(nbostream &is) override;
public:
};

/// TODO Legacy chunk serialisation format to be removed soon.
class CCITTCRC32NoneChunk : public IChunk {
protected:
    Encoding onEncode(nbostream &os) const override;
    void onDecode(nbostream &is) override;
public:
};

/// Future default chunk serialisation format
class XXH64CompressedChunk : public IChunk {
public:
    using CompressionConfig = vespalib::compression::CompressionConfig;
    XXH64CompressedChunk(CompressionConfig::Type, uint8_t level);
    ~XXH64CompressedChunk() override;
protected:
    void decompress(nbostream & os, uint32_t uncompressedLen);
    Encoding compress(nbostream & os, Encoding::Crc crc) const;
    Encoding onEncode(nbostream &os) const override;
    void onDecode(nbostream &is) override;
private:
    CompressionConfig::Type _type;
    uint8_t                 _level;
    vespalib::alloc::Alloc  _backing;
};

}