CernVM-FS  2.12.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 "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;
31  const std::string &repository_url, const std::string &repository_name,
32  manifest::ManifestEnsemble *ensemble) const;
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 
48  const perf::Statistics *statistics() const { return &statistics_; }
49 
50  protected:
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_
perf::Statistics statistics_
Definition: server_tool.h:53
static const unsigned kDownloadTimeout
Definition: server_tool.h:56
UniquePtr< download::DownloadManager > download_manager_
Definition: server_tool.h:51
manifest::Reflog * FetchReflog(ObjectFetcherT *object_fetcher, const std::string &repo_name, const shash::Any &reflog_hash)
static const unsigned kDownloadRetries
Definition: server_tool.h:57
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:123
manifest::Failures FetchRemoteManifestEnsemble(const std::string &repository_url, const std::string &repository_name, manifest::ManifestEnsemble *ensemble) const
Definition: server_tool.cc:113
signature::SignatureManager * signature_manager() const
Definition: server_tool.cc:103
download::DownloadManager * download_manager() const
Definition: server_tool.cc:98
perf::Statistics * statistics()
Definition: server_tool.h:47
const perf::Statistics * statistics() const
Definition: server_tool.h:48
UniquePtr< signature::SignatureManager > signature_manager_
Definition: server_tool.h:52
manifest::Manifest * OpenLocalManifest(const std::string path) const
Definition: server_tool.cc:108
bool InitSignatureManager(const std::string &pubkey_path, const std::string &certificate_path="", const std::string &private_key_path="")
Definition: server_tool.cc:44
virtual ~ServerTool()
Definition: server_tool.cc:11
manifest::Reflog * CreateEmptyReflog(const std::string &temp_directory, const std::string &repo_name)
Definition: server_tool.cc:165
bool InitDownloadManager(const bool follow_redirects, const std::string &proxy, const unsigned max_pool_handles=1)
Definition: server_tool.cc:17