Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_SERVER_TOOL_H_ |
6 |
|
|
#define CVMFS_SERVER_TOOL_H_ |
7 |
|
|
|
8 |
|
|
#include <string> |
9 |
|
|
|
10 |
|
|
#include "crypto/signature.h" |
11 |
|
|
#include "manifest_fetch.h" |
12 |
|
|
#include "network/download.h" |
13 |
|
|
#include "reflog.h" |
14 |
|
|
#include "statistics.h" |
15 |
|
|
#include "util/pointer.h" |
16 |
|
|
|
17 |
|
|
class ServerTool { |
18 |
|
|
public: |
19 |
|
|
ServerTool(); |
20 |
|
|
virtual ~ServerTool(); |
21 |
|
|
|
22 |
|
|
bool InitDownloadManager(const bool follow_redirects, |
23 |
|
|
const std::string &proxy, |
24 |
|
|
const unsigned max_pool_handles = 1); |
25 |
|
|
bool InitSignatureManager(const std::string &pubkey_path, |
26 |
|
|
const std::string &certificate_path = "", |
27 |
|
|
const std::string &private_key_path = ""); |
28 |
|
|
|
29 |
|
|
manifest::Manifest *OpenLocalManifest(const std::string path) const; |
30 |
|
|
manifest::Failures FetchRemoteManifestEnsemble( |
31 |
|
|
const std::string &repository_url, const std::string &repository_name, |
32 |
|
|
manifest::ManifestEnsemble *ensemble) const; |
33 |
|
|
manifest::Manifest *FetchRemoteManifest( |
34 |
|
|
const std::string &repository_url, const std::string &repository_name, |
35 |
|
|
const shash::Any &base_hash = shash::Any()) const; |
36 |
|
|
|
37 |
|
|
template <class ObjectFetcherT> |
38 |
|
|
manifest::Reflog *FetchReflog(ObjectFetcherT *object_fetcher, |
39 |
|
|
const std::string &repo_name, |
40 |
|
|
const shash::Any &reflog_hash); |
41 |
|
|
|
42 |
|
|
manifest::Reflog *CreateEmptyReflog(const std::string &temp_directory, |
43 |
|
|
const std::string &repo_name); |
44 |
|
|
|
45 |
|
|
download::DownloadManager *download_manager() const; |
46 |
|
|
signature::SignatureManager *signature_manager() const; |
47 |
|
24 |
perf::Statistics *statistics() { return &statistics_; } |
48 |
|
|
const perf::Statistics *statistics() const { return &statistics_; } |
49 |
|
|
|
50 |
|
|
protected: |
51 |
|
|
UniquePtr<download::DownloadManager> download_manager_; |
52 |
|
|
UniquePtr<signature::SignatureManager> signature_manager_; |
53 |
|
|
perf::Statistics statistics_; |
54 |
|
|
|
55 |
|
|
private: |
56 |
|
|
static const unsigned kDownloadTimeout = 60; // 1 minute |
57 |
|
|
static const unsigned kDownloadRetries = 3; // 4 attempts in total |
58 |
|
|
}; |
59 |
|
|
|
60 |
|
|
#include "server_tool_impl.h" |
61 |
|
|
|
62 |
|
|
#endif // CVMFS_SERVER_TOOL_H_ |
63 |
|
|
|