1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_SWISSKNIFE_PULL_H_ |
6 |
|
|
#define CVMFS_SWISSKNIFE_PULL_H_ |
7 |
|
|
|
8 |
|
|
#include <string> |
9 |
|
|
|
10 |
|
|
#include "swissknife.h" |
11 |
|
|
|
12 |
|
|
namespace catalog { |
13 |
|
|
class Catalog; |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
namespace shash { |
17 |
|
|
struct Any; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
namespace swissknife { |
21 |
|
|
|
22 |
|
|
class CommandPull : public Command { |
23 |
|
|
public: |
24 |
|
|
~CommandPull() { } |
25 |
|
|
virtual std::string GetName() const { return "pull"; } |
26 |
|
|
virtual std::string GetDescription() const { |
27 |
|
|
return "Makes a Stratum 1 replica of a Stratum 0 repository."; |
28 |
|
|
} |
29 |
|
|
virtual ParameterList GetParams() const { |
30 |
|
|
ParameterList r; |
31 |
|
|
r.push_back(Parameter::Mandatory('u', "repository url")); |
32 |
|
|
r.push_back(Parameter::Mandatory('m', "repository name")); |
33 |
|
|
r.push_back(Parameter::Mandatory('r', "spooler definition")); |
34 |
|
|
r.push_back(Parameter::Mandatory('k', "repository master key(s) / dir")); |
35 |
|
|
r.push_back(Parameter::Optional('y', "trusted certificate directories")); |
36 |
|
|
r.push_back(Parameter::Mandatory('x', "directory for temporary files")); |
37 |
|
|
r.push_back(Parameter::Optional('R', "path to reflog.chksum file")); |
38 |
|
|
r.push_back(Parameter::Optional('w', "repository stratum1 url")); |
39 |
|
|
r.push_back(Parameter::Optional('n', "number of download threads")); |
40 |
|
|
r.push_back(Parameter::Optional('l', "log level (0-4, default: 2)")); |
41 |
|
|
r.push_back(Parameter::Optional('t', "timeout (s)")); |
42 |
|
|
r.push_back(Parameter::Optional('a', "number of retries")); |
43 |
|
|
r.push_back(Parameter::Optional('d', "directory for path specification")); |
44 |
|
|
r.push_back(Parameter::Optional('Z', "pull revisions younger than <Z>")); |
45 |
|
|
r.push_back(Parameter::Switch('p', "pull catalog history, too")); |
46 |
|
|
r.push_back(Parameter::Switch('i', "mark as an 'initial snapshot'")); |
47 |
|
|
r.push_back(Parameter::Switch('c', "preload cache instead of stratum 1")); |
48 |
|
|
// Required for preloading client cache with a dirtab. If the dirtab |
49 |
|
|
// changes, the existence of a catalog does not anymore indicate if |
50 |
|
|
// everything in the corresponding subtree is already fetched, too. |
51 |
|
|
r.push_back( |
52 |
|
|
Parameter::Switch('z', "look into all catalogs even if already present")); |
53 |
|
|
return r; |
54 |
|
|
} |
55 |
|
|
int Main(const ArgumentList &args); |
56 |
|
|
|
57 |
|
|
protected: |
58 |
|
|
bool PullRecursion(catalog::Catalog *catalog, const std::string &path); |
59 |
|
|
bool Pull(const shash::Any &catalog_hash, const std::string &path); |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
} // namespace swissknife |
63 |
|
|
|
64 |
|
|
#endif // CVMFS_SWISSKNIFE_PULL_H_ |