GCC Code Coverage Report


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