Line |
Branch |
Exec |
Source |
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 "upload_spooler_result.h" |
11 |
|
|
#include "util/concurrency.h" |
12 |
|
|
#include "util/tube.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 |
|
|
{ |
23 |
|
|
public: |
24 |
|
344 |
TaskRegister(Tube<FileItem> *tube_in, |
25 |
|
|
Tube<FileItem> *tube_ctr_inflight_pre, |
26 |
|
|
Tube<FileItem> *tube_ctr_inflight_post) |
27 |
|
344 |
: TubeConsumer<FileItem>(tube_in) |
28 |
|
344 |
, tube_ctr_inflight_pre_(tube_ctr_inflight_pre) |
29 |
|
344 |
, tube_ctr_inflight_post_(tube_ctr_inflight_post) |
30 |
|
344 |
{ } |
31 |
|
|
|
32 |
|
|
protected: |
33 |
|
|
virtual void Process(FileItem *file_item); |
34 |
|
|
|
35 |
|
|
private: |
36 |
|
|
Tube<FileItem> *tube_ctr_inflight_pre_; |
37 |
|
|
Tube<FileItem> *tube_ctr_inflight_post_; |
38 |
|
|
}; // class TaskRegister |
39 |
|
|
|
40 |
|
|
#endif // CVMFS_INGESTION_TASK_REGISTER_H_ |
41 |
|
|
|