GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/ingestion/task_compress.h
Date: 2024-04-21 02:33:16
Exec Total Coverage
Lines: 8 8 100.0%
Branches: 2 4 50.0%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
4
5 #ifndef CVMFS_INGESTION_TASK_COMPRESS_H_
6 #define CVMFS_INGESTION_TASK_COMPRESS_H_
7
8 #include <map>
9
10 #include "ingestion/item.h"
11 #include "ingestion/task.h"
12 #include "smallhash.h"
13 #include "util/murmur.hxx"
14 #include "util/posix.h"
15
16 class ItemAllocator;
17
18 class TaskCompress : public TubeConsumer<BlockItem> {
19 public:
20 static const unsigned kCompressedBlockSize = kPageSize * 2;
21
22 1378 TaskCompress(
23 Tube<BlockItem> *tube_in,
24 TubeGroup<BlockItem> *tubes_out,
25 ItemAllocator *allocator)
26 1378 : TubeConsumer<BlockItem>(tube_in)
27 1378 , tubes_out_(tubes_out)
28
1/2
✓ Branch 2 taken 1378 times.
✗ Branch 3 not taken.
1378 , allocator_(allocator)
29 {
30
1/2
✓ Branch 1 taken 1378 times.
✗ Branch 2 not taken.
1378 tag_map_.Init(16, -1, hasher_int64t);
31 1378 }
32
33 protected:
34 virtual void Process(BlockItem *input_block);
35
36 private:
37 1208779 static inline uint32_t hasher_int64t(const int64_t &value) {
38 1208779 return MurmurHash2(&value, sizeof(value), 0x07387a4f);
39 }
40
41 /**
42 * Maps input block tag (hence: chunk) to the output block with the compressed
43 * data.
44 */
45 typedef SmallHashDynamic<int64_t, BlockItem *> TagMap;
46
47 TubeGroup<BlockItem> *tubes_out_;
48 ItemAllocator *allocator_;
49 TagMap tag_map_;
50 };
51
52 #endif // CVMFS_INGESTION_TASK_COMPRESS_H_
53