1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_INGESTION_TASK_REGISTER_H_ |
6 |
|
|
#define CVMFS_INGESTION_TASK_REGISTER_H_ |
7 |
|
|
|
8 |
|
|
#include "ingestion/item.h" |
9 |
|
|
#include "ingestion/task.h" |
10 |
|
|
#include "ingestion/tube.h" |
11 |
|
|
#include "upload_spooler_result.h" |
12 |
|
|
#include "util_concurrency.h" |
13 |
|
|
|
14 |
|
|
/** |
15 |
|
|
* Runs the callback to register processed files in the file catalog. |
16 |
|
|
* Encapsulated in a task so that only a single thread operates on the file |
17 |
|
|
* catalog, which is serialized anyway. |
18 |
|
|
*/ |
19 |
|
|
class TaskRegister |
20 |
|
|
: public TubeConsumer<FileItem> |
21 |
|
|
, public Observable<upload::SpoolerResult> |
22 |
✗✗✓ |
174 |
{ |
23 |
|
|
public: |
24 |
|
87 |
TaskRegister(Tube<FileItem> *tube_in, |
25 |
|
|
Tube<FileItem> *tube_counter) |
26 |
|
|
: TubeConsumer<FileItem>(tube_in) |
27 |
|
87 |
, tube_counter_(tube_counter) |
28 |
|
87 |
{ } |
29 |
|
|
|
30 |
|
|
protected: |
31 |
|
|
virtual void Process(FileItem *file_item); |
32 |
|
|
|
33 |
|
|
private: |
34 |
|
|
Tube<FileItem> *tube_counter_; |
35 |
|
|
}; // class TaskRegister |
36 |
|
|
|
37 |
|
|
#endif // CVMFS_INGESTION_TASK_REGISTER_H_ |