aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Backups/BackupEntryWithChecksumCalculation.h
blob: 99ed4a324624ed482082ee9b6d7cb9576a4dd015 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <Backups/IBackupEntry.h>


namespace DB
{

/// Calculates the checksum and the partial checksum for a backup entry based on ReadBuffer returned by getReadBuffer().
template <typename Base>
class BackupEntryWithChecksumCalculation : public Base
{
public:
    UInt128 getChecksum(const ReadSettings & read_settings) const override;
    std::optional<UInt128> getPartialChecksum(size_t prefix_length, const ReadSettings & read_settings) const override;

private:
    mutable std::optional<UInt128> calculated_checksum;
    mutable std::mutex checksum_calculation_mutex;
};

}