GCC Code Coverage Report
Directory: cvmfs/ Exec Total Coverage
File: cvmfs/upload_spooler_definition.h Lines: 2 2 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_UPLOAD_SPOOLER_DEFINITION_H_
6
#define CVMFS_UPLOAD_SPOOLER_DEFINITION_H_
7
8
#include <string>
9
10
#include "compression.h"
11
#include "hash.h"
12
13
namespace upload {
14
15
/**
16
 * SpoolerDefinition is given by a string of the form:
17
 * <spooler type>:<spooler description>
18
 *
19
 * F.e: local:/srv/cvmfs/dev.cern.ch
20
 *      to define a local spooler with upstream path /srv/cvmfs/dev.cern.ch
21
 */
22
803
struct SpoolerDefinition {
23
  static const unsigned kDefaultMaxConcurrentUploads = 512;
24
  static const unsigned kDefaultNumUploadTasks = 1;
25
  enum DriverType { S3, Local, Gateway, Mock, Unknown };
26
27
  /**
28
   * Reads a given definition_string as described above and interprets
29
   * it. If the provided string turns out to be malformed the created
30
   * SpoolerDefinition object will not be valid. A user should check this
31
   * after creation using IsValid().
32
   *
33
   * @param definition_string   the spooler definition string to be inter-
34
   *                            preted by the constructor
35
   */
36
  SpoolerDefinition(
37
      const std::string& definition_string,
38
      const shash::Algorithms hash_algorithm,
39
      const zlib::Algorithms compression_algorithm = zlib::kZlibDefault,
40
      const bool generate_legacy_bulk_chunks = false,
41
      const bool use_file_chunking = false,
42
      const size_t min_file_chunk_size = 0,
43
      const size_t avg_file_chunk_size = 0,
44
      const size_t max_file_chunk_size = 0,
45
      const std::string& session_token_file = "",
46
      const std::string& key_file = "");
47
48
135
  bool IsValid() const { return valid_; }
49
50
  /**
51
   * Creates a new SpoolerDefinition based on an existing one.  The new spooler
52
   * has compression set to zlib, which is required for catalogs and other meta-
53
   * objects.
54
   */
55
  SpoolerDefinition Dup2DefaultCompression() const;
56
57
  DriverType driver_type;      //!< the type of the spooler driver
58
  std::string temporary_path;  //!< scratch space for the IngestionPipeline
59
60
  /**
61
  * A driver specific spooler configuration string (interpreted by the concrete
62
  * spooler)
63
  */
64
  std::string spooler_configuration;
65
66
  shash::Algorithms hash_algorithm;
67
  zlib::Algorithms compression_alg;
68
  /**
69
   * If a file is chunked, clients >= 2.1.7 do not need the bulk chunk.  We can
70
   * force creating the bulk chunks for backwards compatibility.
71
   */
72
  bool generate_legacy_bulk_chunks;
73
  bool use_file_chunking;
74
  size_t min_file_chunk_size;
75
  size_t avg_file_chunk_size;
76
  size_t max_file_chunk_size;
77
78
  /**
79
   * This is the number of concurrently open files to be uploaded. It does not,
80
   * however, specify the degree of parallelism of the I/O write operations.
81
   */
82
  unsigned int number_of_concurrent_uploads;
83
84
  /**
85
   * Number of threads used for I/O write calls. Effectively this paramater
86
   * sets the I/O depth.
87
   */
88
  unsigned int num_upload_tasks;
89
90
  // The session_token_file parameter is only used for the HTTP driver
91
  std::string session_token_file;
92
  std::string key_file;
93
94
  bool valid_;
95
};
96
97
}  // namespace upload
98
99
#endif  // CVMFS_UPLOAD_SPOOLER_DEFINITION_H_