-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathZstdFile.h
43 lines (31 loc) · 901 Bytes
/
ZstdFile.h
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
#ifndef ZSTDFILE_H
#define ZSTDFILE_H
#include "lzopfs.h"
#include "CompressedFile.h"
#include "FileList.h"
#include <zstd.h>
class ZstdFile : public BlockListCompFile {
protected:
struct SeekTableInfo {
uint64_t start;
bool hasChecksums;
uint32_t count;
size_t entrySize() const {
return 8 + (hasChecksums ? 4 : 0);
}
size_t totalSize() const {
return entrySize() * count;
}
};
SeekTableInfo findSeekTable(FileHandle& fh) const;
public:
static CompressedFile* open(const std::string& path, const OpenParams& params)
{ return new ZstdFile(path, params.maxBlock); }
ZstdFile(const std::string& path, uint64_t maxBlock);
virtual std::string destName() const;
virtual void checkFileType(FileHandle &fh);
virtual void decompressBlock(const FileHandle& fh, const Block& b,
Buffer& ubuf) const;
virtual void buildIndex(FileHandle& fh);
};
#endif // ZSTDFILE_H