GCC Code Coverage Report


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