CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
server_tool.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_SERVER_TOOL_H_
6 #define CVMFS_SERVER_TOOL_H_
7 
8 #include <string>
9 
10 #include "download.h"
11 #include "manifest_fetch.h"
12 #include "reflog.h"
13 #include "signature.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 unsigned max_pool_handles = 1,
24  const bool use_system_proxy = true);
25  bool InitVerifyingSignatureManager(const std::string &pubkey_path,
26  const std::string &trusted_certs = "");
27  bool InitSigningSignatureManager(const std::string &certificate_path,
28  const std::string &private_key_path,
29  const std::string &private_key_password);
30 
31  manifest::Manifest *OpenLocalManifest(const std::string path) const;
33  const std::string &repository_url, const std::string &repository_name,
34  manifest::ManifestEnsemble *ensemble) const;
36  const std::string &repository_url, const std::string &repository_name,
37  const shash::Any &base_hash = shash::Any()) const;
38 
39  template <class ObjectFetcherT>
40  manifest::Reflog *FetchReflog(ObjectFetcherT *object_fetcher,
41  const std::string &repo_name,
42  const shash::Any &reflog_hash);
43 
44  manifest::Reflog *CreateEmptyReflog(const std::string &temp_directory,
45  const std::string &repo_name);
46 
50  const perf::Statistics *statistics() const { return &statistics_; }
51 
52  protected:
56 
57  private:
58  static const unsigned kDownloadTimeout = 60; // 1 minute
59  static const unsigned kDownloadRetries = 3; // 4 attempts in total
60 };
61 
62 #include "server_tool_impl.h"
63 
64 #endif // CVMFS_SERVER_TOOL_H_
perf::Statistics statistics_
Definition: server_tool.h:55
static const unsigned kDownloadTimeout
Definition: server_tool.h:58
UniquePtr< download::DownloadManager > download_manager_
Definition: server_tool.h:53
manifest::Reflog * FetchReflog(ObjectFetcherT *object_fetcher, const std::string &repo_name, const shash::Any &reflog_hash)
static const unsigned kDownloadRetries
Definition: server_tool.h:59
manifest::Manifest * FetchRemoteManifest(const std::string &repository_url, const std::string &repository_name, const shash::Any &base_hash=shash::Any()) const
Definition: server_tool.cc:133
manifest::Failures FetchRemoteManifestEnsemble(const std::string &repository_url, const std::string &repository_name, manifest::ManifestEnsemble *ensemble) const
Definition: server_tool.cc:123
bool InitVerifyingSignatureManager(const std::string &pubkey_path, const std::string &trusted_certs="")
Definition: server_tool.cc:44
signature::SignatureManager * signature_manager() const
Definition: server_tool.cc:113
download::DownloadManager * download_manager() const
Definition: server_tool.cc:108
bool InitDownloadManager(const bool follow_redirects, const unsigned max_pool_handles=1, const bool use_system_proxy=true)
Definition: server_tool.cc:21
perf::Statistics * statistics()
Definition: server_tool.h:49
const perf::Statistics * statistics() const
Definition: server_tool.h:50
UniquePtr< signature::SignatureManager > signature_manager_
Definition: server_tool.h:54
manifest::Manifest * OpenLocalManifest(const std::string path) const
Definition: server_tool.cc:118
virtual ~ServerTool()
Definition: server_tool.cc:11
manifest::Reflog * CreateEmptyReflog(const std::string &temp_directory, const std::string &repo_name)
Definition: server_tool.cc:175
bool InitSigningSignatureManager(const std::string &certificate_path, const std::string &private_key_path, const std::string &private_key_password)
Definition: server_tool.cc:69