1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_UPLOAD_SPOOLER_RESULT_H_ |
6 |
|
|
#define CVMFS_UPLOAD_SPOOLER_RESULT_H_ |
7 |
|
|
|
8 |
|
|
#include <string> |
9 |
|
|
|
10 |
|
|
#include "compression.h" |
11 |
|
|
#include "file_chunk.h" |
12 |
|
|
|
13 |
|
|
namespace upload { |
14 |
|
|
|
15 |
|
|
/** |
16 |
|
|
* This data structure will be passed to every callback spoolers will invoke. |
17 |
|
|
* It encapsulates the results of a spooler command along with the given |
18 |
|
|
* local_path to identify the spooler action performed. |
19 |
|
|
* |
20 |
|
|
* Note: When the return_code is different from 0 the content_hash is most |
21 |
|
|
* likely undefined, Null or rubbish. |
22 |
|
|
*/ |
23 |
|
169 |
struct SpoolerResult { |
24 |
|
169 |
SpoolerResult(const int return_code = -1, |
25 |
|
|
const std::string &local_path = "", |
26 |
|
|
const shash::Any &digest = shash::Any(), |
27 |
|
|
const FileChunkList &file_chunks = FileChunkList(), |
28 |
|
|
const zlib::Algorithms compression_alg = zlib::kZlibDefault) : |
29 |
|
|
return_code(return_code), |
30 |
|
|
local_path(local_path), |
31 |
|
|
content_hash(digest), |
32 |
|
|
file_chunks(file_chunks), |
33 |
|
169 |
compression_alg(compression_alg) {} |
34 |
|
|
|
35 |
|
|
inline bool IsChunked() const { return !file_chunks.IsEmpty(); } |
36 |
|
|
|
37 |
|
|
int return_code; //!< the return value of the spooler operation |
38 |
|
|
std::string local_path; //!< the local_path previously given as input |
39 |
|
|
/** |
40 |
|
|
* The content_hash of the bulk file derived during processing |
41 |
|
|
*/ |
42 |
|
|
shash::Any content_hash; |
43 |
|
|
FileChunkList file_chunks; //!< the file chunks generated during processing |
44 |
|
|
zlib::Algorithms compression_alg; |
45 |
|
|
}; |
46 |
|
|
|
47 |
|
|
} // namespace upload |
48 |
|
|
|
49 |
|
|
#endif // CVMFS_UPLOAD_SPOOLER_RESULT_H_ |