GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/ingestion/task_compress.h
Date: 2025-06-15 02:35:55
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 1442 TaskCompress(Tube<BlockItem> *tube_in,
23 TubeGroup<BlockItem> *tubes_out,
24 ItemAllocator *allocator)
25 1442 : TubeConsumer<BlockItem>(tube_in)
26 1442 , tubes_out_(tubes_out)
27
1/2
✓ Branch 2 taken 1442 times.
✗ Branch 3 not taken.
1442 , allocator_(allocator) {
28
1/2
✓ Branch 1 taken 1442 times.
✗ Branch 2 not taken.
1442 tag_map_.Init(16, -1, hasher_int64t);
29 1442 }
30
31 protected:
32 virtual void Process(BlockItem *input_block);
33
34 private:
35 1210754 static inline uint32_t hasher_int64t(const int64_t &value) {
36 1210754 return MurmurHash2(&value, sizeof(value), 0x07387a4f);
37 }
38
39 /**
40 * Maps input block tag (hence: chunk) to the output block with the compressed
41 * data.
42 */
43 typedef SmallHashDynamic<int64_t, BlockItem *> TagMap;
44
45 TubeGroup<BlockItem> *tubes_out_;
46 ItemAllocator *allocator_;
47 TagMap tag_map_;
48 };
49
50 #endif // CVMFS_INGESTION_TASK_COMPRESS_H_
51