37 "Failed to configure gateway uploader. "
38 "Missing session token file.\n");
43 if (spooler_definition.
key_file.empty()) {
45 "Failed to configure gateway uploader. "
46 "Missing API key file.\n");
52 config->
api_url = config_string;
79 "cannot create repository storage area when using the gateway");
87 std::string session_token;
101 const std::string& old_root_hash,
102 const std::string& new_root_hash,
139 bool rvb = source->
Open();
142 "File upload - could not open local file.");
151 std::vector<char> buf(1024);
152 ssize_t read_bytes = 0;
154 read_bytes = source->
Read(&buf[0], buf.size());
157 shash::Update(reinterpret_cast<unsigned char *>(&buf[0]), read_bytes,
159 }
while (static_cast<size_t>(read_bytes) == buf.size());
165 handle->bucket, remote_path)) {
167 "File upload - could not commit bucket");
187 "Streamed upload - incompatible upload handle");
203 "Finalize streamed upload - incompatible upload handle");
214 "Finalize streamed upload - could not commit bucket");
233 std::string* token) {
235 *token =
"INVALIDTOKEN";
237 FILE* token_file = std::fopen(token_file_name.c_str(),
"r");
240 "HTTP Uploader - Could not open session token file.");
249 std::string* secret) {
static bool WillHandle(const SpoolerDefinition &spooler_definition)
const unsigned kMaxContextSize
virtual int64_t DoGetObjectSize(const std::string &file_name)
DriverType driver_type
the type of the spooler driver
void Respond(const CallbackTN *callback, const UploaderResults &result) const
virtual std::string name() const
virtual bool Peek(const std::string &path)
virtual bool PlaceBootstrappingShortcut(const shash::Any &object)
assert((mem||(size==0))&&"Out Of Memory")
const SpoolerDefinition & spooler_definition() const
void CountUploadedChunks() const
ObjectPack::BucketHandle NewBucket()
void Init(ContextPtr context)
const CallbackTN * commit_callback
bool GetLineFile(FILE *f, std::string *line)
virtual bool Initialize()
const char kSuffixPartial
virtual void StreamedUpload(UploadStreamHandle *handle, UploadBuffer buffer, const CallbackTN *callback)
const char kSuffixCatalog
bool CommitBucket(const ObjectPack::BucketContentType type, const shash::Any &id, const ObjectPack::BucketHandle handle, const std::string &name="", const bool force_dispatch=false)
virtual bool FinalizeSession(bool commit, const std::string &old_root_hash, const std::string &new_root_hash, const RepositoryTag &tag)
SessionContext * session_context_
std::string session_token_file
virtual unsigned int GetNumberOfErrors() const
bool ReadKeys(const std::string &key_file_name, std::string *key_id, std::string *secret)
void CountUploadedBytes(int64_t bytes_written) const
void Final(ContextPtr context, Any *any_digest)
virtual ~GatewayUploader()
virtual void FinalizeStreamedUpload(UploadStreamHandle *handle, const shash::Any &content_hash)
GatewayStreamHandle(const CallbackTN *commit_callback, ObjectPack::BucketHandle bkt)
bool Finalize(bool commit, const std::string &old_root_hash, const std::string &new_root_hash, const RepositoryTag &tag)
static bool ParseSpoolerDefinition(const SpoolerDefinition &spooler_definition, Config *config)
virtual void WaitForUpload() const
virtual std::string GetPath() const =0
void Update(const unsigned char *buffer, const unsigned buffer_length, ContextPtr context)
AbstractUploader::CallbackTN CallbackTN
void CountUploadedCatalogBytes(int64_t bytes_written) const
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
void CountUploadedCatalogs() const
virtual ssize_t Read(void *buffer, size_t nbyte)=0
virtual bool ReadKey(const std::string &key_file, std::string *key_id, std::string *secret)
virtual void ReadSessionTokenFile(const std::string &token_file_name, std::string *token)
static void AddToBucket(const void *buf, const uint64_t size, const BucketHandle handle)
bool Initialize(const std::string &api_url, const std::string &session_token, const std::string &key_id, const std::string &secret, uint64_t max_pack_size=ObjectPack::kDefaultLimit, uint64_t max_queue_size=10)
std::string spooler_configuration
GatewayUploader(const SpoolerDefinition &spooler_definition)
virtual UploadStreamHandle * InitStreamedUpload(const CallbackTN *callback)
virtual bool Initialize()
std::string session_token_file
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)