CernVM-FS  2.13.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
task_compress.h
Go to the documentation of this file.
1 
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 
23  TubeGroup<BlockItem> *tubes_out,
24  ItemAllocator *allocator)
25  : TubeConsumer<BlockItem>(tube_in)
26  , tubes_out_(tubes_out)
27  , allocator_(allocator) {
28  tag_map_.Init(16, -1, hasher_int64t);
29  }
30 
31  protected:
32  virtual void Process(BlockItem *input_block);
33 
34  private:
35  static inline uint32_t hasher_int64t(const int64_t &value) {
36  return MurmurHash2(&value, sizeof(value), 0x07387a4f);
37  }
38 
44 
48 };
49 
50 #endif // CVMFS_INGESTION_TASK_COMPRESS_H_
virtual void Process(BlockItem *input_block)
TagMap tag_map_
Definition: task_compress.h:47
ItemAllocator * allocator_
Definition: task_compress.h:46
TaskCompress(Tube< BlockItem > *tube_in, TubeGroup< BlockItem > *tubes_out, ItemAllocator *allocator)
Definition: task_compress.h:22
SmallHashDynamic< int64_t, BlockItem * > TagMap
Definition: task_compress.h:43
static const unsigned kCompressedBlockSize
Definition: task_compress.h:20
const unsigned kPageSize
Definition: posix.h:30
static uint32_t hasher_int64t(const int64_t &value)
Definition: task_compress.h:35
void Init(uint32_t expected_size, Key empty, uint32_t(*hasher)(const Key &key))
Definition: smallhash.h:58
TubeGroup< BlockItem > * tubes_out_
Definition: task_compress.h:45
uint32_t MurmurHash2(const void *key, int len, uint32_t seed)
Definition: murmur.hxx:23