GCC Code Coverage Report
Directory: cvmfs/ Exec Total Coverage
File: cvmfs/server_tool.h Lines: 1 1 100.0 %
Date: 2019-02-03 02:48:13 Branches: 0 0 - %

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 "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;
32
  manifest::Failures FetchRemoteManifestEnsemble(
33
      const std::string &repository_url, const std::string &repository_name,
34
      manifest::ManifestEnsemble *ensemble) const;
35
  manifest::Manifest *FetchRemoteManifest(
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
47
  download::DownloadManager *download_manager() const;
48
  signature::SignatureManager *signature_manager() const;
49
21
  perf::Statistics *statistics() { return &statistics_; }
50
  const perf::Statistics *statistics() const { return &statistics_; }
51
52
 protected:
53
  UniquePtr<download::DownloadManager> download_manager_;
54
  UniquePtr<signature::SignatureManager> signature_manager_;
55
  perf::Statistics statistics_;
56
57
 private:
58
  static const unsigned kDownloadTimeout = 60;  // 1 minute
59
  static const unsigned kDownloadRetries = 1;   // 2 attempts in total
60
};
61
62
#include "server_tool_impl.h"
63
64
#endif  // CVMFS_SERVER_TOOL_H_