CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
upload.h
Go to the documentation of this file.
1 
109 #ifndef CVMFS_UPLOAD_H_
110 #define CVMFS_UPLOAD_H_
111 
112 #include <cstdio>
113 #include <string>
114 #include <vector>
115 
116 #include "file_chunk.h"
117 #include "hash.h"
119 #include "ingestion/pipeline.h"
120 #include "repository_tag.h"
121 #include "upload_facility.h"
123 #include "upload_spooler_result.h"
124 #include "util/pointer.h"
125 #include "util/shared_ptr.h"
126 #include "util_concurrency.h"
127 
128 namespace upload {
129 
142 class Spooler : public Observable<SpoolerResult> {
143  public:
144  static Spooler *Construct(const SpoolerDefinition &spooler_definition,
145  perf::StatisticsTemplate *statistics = NULL);
146  virtual ~Spooler();
147 
152  std::string backend_name() const;
153 
157  bool Create();
158 
170  void Upload(const std::string &local_path, const std::string &remote_path);
171 
175  void Upload(const std::string &remote_path, IngestionSource *source);
176 
182  void UploadManifest(const std::string &local_path);
183 
189  void UploadReflog(const std::string &local_path);
190 
208  void Process(IngestionSource *source, const bool allow_chunking = true);
209 
216  void ProcessCatalog(const std::string &local_path);
217 
224  void ProcessHistory(const std::string &local_path);
225 
232  void ProcessCertificate(const std::string &local_path);
236  void ProcessCertificate(IngestionSource *source);
237 
243  void ProcessMetainfo(const std::string &local_path);
247  void ProcessMetainfo(IngestionSource *source);
248 
257  void RemoveAsync(const std::string &file_to_delete);
258 
265  bool Peek(const std::string &path) const;
266 
274  bool Mkdir(const std::string &path);
275 
284  bool PlaceBootstrappingShortcut(const shash::Any &object) const;
285 
293  void WaitForUpload() const;
294 
295  bool FinalizeSession(bool commit, const std::string &old_root_hash = "",
296  const std::string &new_root_hash = "",
297  const RepositoryTag &tag = RepositoryTag()) const;
298 
304  unsigned int GetNumberOfErrors() const;
305 
306  shash::Algorithms GetHashAlgorithm() const {
307  return spooler_definition_.hash_algorithm;
308  }
309 
310  SpoolerDefinition::DriverType GetDriverType() const {
311  return spooler_definition_.driver_type;
312  }
313 
314  protected:
319  bool Initialize(perf::StatisticsTemplate *statistics);
320 
325  explicit Spooler(const SpoolerDefinition &spooler_definition);
326 
331  void ProcessingCallback(const SpoolerResult &data);
332 
333  void UploadingCallback(const UploaderResults &data);
334 
335  /*
336  * @return the spooler definition that was initially given to any Spooler
337  * constructor.
338  */
339  inline const SpoolerDefinition &spooler_definition() const {
340  return spooler_definition_;
341  }
342 
343  private:
344  // Status Information
345  const SpoolerDefinition spooler_definition_;
346 
347  UniquePtr<IngestionPipeline> ingestion_pipeline_;
348  UniquePtr<AbstractUploader> uploader_;
349 };
350 
351 } // namespace upload
352 
353 #endif // CVMFS_UPLOAD_H_
static Publisher * Create(const SettingsPublisher &settings)
Algorithms
Definition: hash.h:39
static bool Peek(const string &remote_path)