CernVM-FS  2.11.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 <string>
9 
10 #include "pack.h"
11 #include "repository_tag.h"
12 #include "session_context.h"
13 #include "upload_facility.h"
14 #include "util/atomic.h"
15 
16 namespace upload {
17 
21 
23 };
24 
26  public:
27  struct Config {
29  Config(const std::string& session_token_file, const std::string& key_file,
30  const std::string& api_url)
31  : session_token_file(session_token_file),
32  key_file(key_file),
33  api_url(api_url) {}
34  std::string session_token_file;
35  std::string key_file;
36  std::string api_url;
37  };
38 
40 
41  static bool ParseSpoolerDefinition(
43 
45 
46  virtual ~GatewayUploader();
47 
48  virtual bool Initialize();
49 
50  // Can't "create" a repository storage area with the gateway backend
51  virtual bool Create();
52 
53  virtual bool FinalizeSession(bool commit, const std::string& old_root_hash,
54  const std::string& new_root_hash,
55  const RepositoryTag& tag);
56 
57  virtual void WaitForUpload() const;
58 
59  virtual std::string name() const;
60 
61  virtual bool Peek(const std::string& path);
62 
63  virtual bool Mkdir(const std::string &path);
64 
65  virtual bool PlaceBootstrappingShortcut(const shash::Any& object);
66 
67  virtual unsigned int GetNumberOfErrors() const;
68 
69  protected:
70  virtual void DoUpload(const std::string& remote_path,
71  IngestionSource *source,
72  const CallbackTN* callback);
73 
75  const CallbackTN* callback);
76 
77  virtual void StreamedUpload(UploadStreamHandle* handle, UploadBuffer buffer,
78  const CallbackTN* callback);
79 
80  virtual void FinalizeStreamedUpload(UploadStreamHandle* handle,
81  const shash::Any& content_hash);
82 
83  virtual void DoRemoveAsync(const std::string& file_to_delete);
84 
85  protected:
86  virtual bool ReadSessionTokenFile(const std::string& token_file_name,
87  std::string* token);
88 
89  virtual bool ReadKey(const std::string& key_file, std::string* key_id,
90  std::string* secret);
91 
92  virtual int64_t DoGetObjectSize(const std::string &file_name);
93 
94  private:
95  void BumpErrors() const;
96 
100 };
101 
102 } // namespace upload
103 
104 #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()