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 "util/posix.h" |
13 |
|
|
|
14 |
|
|
class ItemAllocator; |
15 |
|
|
|
16 |
✗✗✓ |
700 |
class TaskCompress : public TubeConsumer<BlockItem> { |
17 |
|
|
public: |
18 |
|
|
static const unsigned kCompressedBlockSize = kPageSize * 2; |
19 |
|
|
|
20 |
|
350 |
TaskCompress( |
21 |
|
|
Tube<BlockItem> *tube_in, |
22 |
|
|
TubeGroup<BlockItem> *tubes_out, |
23 |
|
|
ItemAllocator *allocator) |
24 |
|
|
: TubeConsumer<BlockItem>(tube_in) |
25 |
|
|
, tubes_out_(tubes_out) |
26 |
|
350 |
, allocator_(allocator) |
27 |
|
|
{ } |
28 |
|
|
|
29 |
|
|
protected: |
30 |
|
|
virtual void Process(BlockItem *input_block); |
31 |
|
|
|
32 |
|
|
private: |
33 |
|
|
/** |
34 |
|
|
* Maps input block tag (hence: chunk) to the output block with the compressed |
35 |
|
|
* data. |
36 |
|
|
*/ |
37 |
|
|
typedef std::map<int64_t, BlockItem *> TagMap; |
38 |
|
|
|
39 |
|
|
TubeGroup<BlockItem> *tubes_out_; |
40 |
|
|
ItemAllocator *allocator_; |
41 |
|
|
TagMap tag_map_; |
42 |
|
|
}; |
43 |
|
|
|
44 |
|
|
#endif // CVMFS_INGESTION_TASK_COMPRESS_H_ |