CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
upload_gateway.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_UPLOAD_GATEWAY_H_
6 #define CVMFS_UPLOAD_GATEWAY_H_
7 
8 #include <atomic.h>
9 
10 #include <string>
11 
12 #include "pack.h"
13 #include "repository_tag.h"
14 #include "session_context.h"
15 #include "upload_facility.h"
16 
17 namespace upload {
18 
22 
24 };
25 
27  public:
28  struct Config {
30  Config(const std::string& session_token_file, const std::string& key_file,
31  const std::string& api_url)
32  : session_token_file(session_token_file),
33  key_file(key_file),
34  api_url(api_url) {}
35  std::string session_token_file;
36  std::string key_file;
37  std::string api_url;
38  };
39 
41 
42  static bool ParseSpoolerDefinition(
44 
46 
47  virtual ~GatewayUploader();
48 
49  virtual bool Initialize();
50 
51  // Can't "create" a repository storage area with the gateway backend
52  virtual bool Create();
53 
54  virtual bool FinalizeSession(bool commit, const std::string& old_root_hash,
55  const std::string& new_root_hash,
56  const RepositoryTag& tag);
57 
58  virtual void WaitForUpload() const;
59 
60  virtual std::string name() const;
61 
62  virtual bool Peek(const std::string& path);
63 
64  virtual bool Mkdir(const std::string &path);
65 
66  virtual bool PlaceBootstrappingShortcut(const shash::Any& object);
67 
68  virtual unsigned int GetNumberOfErrors() const;
69 
70  protected:
71  virtual void DoUpload(const std::string& remote_path,
72  IngestionSource *source,
73  const CallbackTN* callback);
74 
76  const CallbackTN* callback);
77 
78  virtual void StreamedUpload(UploadStreamHandle* handle, UploadBuffer buffer,
79  const CallbackTN* callback);
80 
81  virtual void FinalizeStreamedUpload(UploadStreamHandle* handle,
82  const shash::Any& content_hash);
83 
84  virtual void DoRemoveAsync(const std::string& file_to_delete);
85 
86  protected:
87  virtual bool ReadSessionTokenFile(const std::string& token_file_name,
88  std::string* token);
89 
90  virtual bool ReadKey(const std::string& key_file, std::string* key_id,
91  std::string* secret);
92 
93  virtual int64_t DoGetObjectSize(const std::string &file_name);
94 
95  private:
96  void BumpErrors() const;
97 
101 };
102 
103 } // namespace upload
104 
105 #endif // CVMFS_UPLOAD_GATEWAY_H_
static bool WillHandle(const SpoolerDefinition &spooler_definition)
virtual int64_t DoGetObjectSize(const std::string &file_name)
virtual std::string name() const
virtual bool Peek(const std::string &path)
virtual bool PlaceBootstrappingShortcut(const shash::Any &object)
const SpoolerDefinition & spooler_definition() const
int32_t atomic_int32
Definition: atomic.h:17
const CallbackTN * commit_callback
Config(const std::string &session_token_file, const std::string &key_file, const std::string &api_url)
virtual void StreamedUpload(UploadStreamHandle *handle, UploadBuffer buffer, const CallbackTN *callback)
virtual bool FinalizeSession(bool commit, const std::string &old_root_hash, const std::string &new_root_hash, const RepositoryTag &tag)
SessionContext * session_context_
virtual unsigned int GetNumberOfErrors() const
virtual void FinalizeStreamedUpload(UploadStreamHandle *handle, const shash::Any &content_hash)
GatewayStreamHandle(const CallbackTN *commit_callback, ObjectPack::BucketHandle bkt)
static bool ParseSpoolerDefinition(const SpoolerDefinition &spooler_definition, Config *config)
virtual bool ReadSessionTokenFile(const std::string &token_file_name, std::string *token)
virtual void WaitForUpload() const
AbstractUploader::CallbackTN CallbackTN
virtual void DoRemoveAsync(const std::string &file_to_delete)
virtual void DoUpload(const std::string &remote_path, IngestionSource *source, const CallbackTN *callback)
virtual bool Mkdir(const std::string &path)
ObjectPack::BucketHandle bucket
virtual bool ReadKey(const std::string &key_file, std::string *key_id, std::string *secret)
GatewayUploader(const SpoolerDefinition &spooler_definition)
virtual UploadStreamHandle * InitStreamedUpload(const CallbackTN *callback)
virtual bool Initialize()