CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
task_chunk.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_INGESTION_TASK_CHUNK_H_
6 #define CVMFS_INGESTION_TASK_CHUNK_H_
7 
8 #include <stdint.h>
9 
10 #include <map>
11 
12 #include "atomic.h"
13 #include "ingestion/item.h"
14 #include "ingestion/task.h"
15 #include "ingestion/tube.h"
16 #include "murmur.h"
17 #include "smallhash.h"
18 #include "util/posix.h"
19 
20 class ItemAllocator;
21 
22 class TaskChunk : public TubeConsumer<BlockItem> {
23  public:
25  TubeGroup<BlockItem> *tubes_out,
26  ItemAllocator *allocator)
27  : TubeConsumer<BlockItem>(tube_in)
28  , tubes_out_(tubes_out)
29  , allocator_(allocator)
30  {
31  tag_map_.Init(16, -1, hasher_int64t);
32  }
33 
34  protected:
35  virtual void Process(BlockItem *input_block);
36 
37  private:
38  static inline uint32_t hasher_int64t(const int64_t &value) {
39  return MurmurHash2(&value, sizeof(value), 0x07387a4f);
40  }
41 
45  struct ChunkInfo {
47  : offset(0)
48  , output_tag_chunk(-1)
49  , output_tag_bulk(-1)
50  , next_chunk(NULL)
51  , bulk_chunk(NULL)
52  { }
56  uint64_t offset;
64  int64_t output_tag_bulk;
74  };
75 
80 
86 
90 };
91 
92 #endif // CVMFS_INGESTION_TASK_CHUNK_H_
static uint32_t hasher_int64t(const int64_t &value)
Definition: task_chunk.h:38
int64_t atomic_int64
Definition: atomic.h:18
ItemAllocator * allocator_
Definition: task_chunk.h:88
virtual void Process(BlockItem *input_block)
Definition: task_chunk.cc:23
TagMap tag_map_
Definition: task_chunk.h:89
int64_t output_tag_bulk
Definition: task_chunk.h:64
ChunkItem * next_chunk
Definition: task_chunk.h:69
ChunkItem * bulk_chunk
Definition: task_chunk.h:73
int64_t output_tag_chunk
Definition: task_chunk.h:60
static atomic_int64 tag_seq_
Definition: task_chunk.h:85
TubeGroup< BlockItem > * tubes_out_
Definition: task_chunk.h:87
SmallHashDynamic< int64_t, ChunkInfo > TagMap
Definition: task_chunk.h:79
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
TaskChunk(Tube< BlockItem > *tube_in, TubeGroup< BlockItem > *tubes_out, ItemAllocator *allocator)
Definition: task_chunk.h:24