CernVM-FS  2.9.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 "murmur.h"
13 #include "smallhash.h"
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  Tube<BlockItem> *tube_in,
24  TubeGroup<BlockItem> *tubes_out,
25  ItemAllocator *allocator)
26  : TubeConsumer<BlockItem>(tube_in)
27  , tubes_out_(tubes_out)
28  , allocator_(allocator)
29  {
30  tag_map_.Init(16, -1, hasher_int64t);
31  }
32 
33  protected:
34  virtual void Process(BlockItem *input_block);
35 
36  private:
37  static inline uint32_t hasher_int64t(const int64_t &value) {
38  return MurmurHash2(&value, sizeof(value), 0x07387a4f);
39  }
40 
46 
50 };
51 
52 #endif // CVMFS_INGESTION_TASK_COMPRESS_H_
virtual void Process(BlockItem *input_block)
TagMap tag_map_
Definition: task_compress.h:49
ItemAllocator * allocator_
Definition: task_compress.h:48
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:45
static const unsigned kCompressedBlockSize
Definition: task_compress.h:20
const unsigned kPageSize
Definition: posix.h:29
static uint32_t hasher_int64t(const int64_t &value)
Definition: task_compress.h:37
uint32_t MurmurHash2(const void *key, int len, uint32_t seed)
Definition: murmur.h:23
void Init(uint32_t expected_size, Key empty, uint32_t(*hasher)(const Key &key))
Definition: smallhash.h:59
TubeGroup< BlockItem > * tubes_out_
Definition: task_compress.h:47