20 backend_file_mode_(default_backend_file_mode_ ^
GetUmask()),
21 backend_dir_mode_(default_backend_dir_mode_ ^
GetUmask()),
22 upstream_path_(spooler_definition.spooler_configuration),
23 temporary_path_(spooler_definition.temporary_path)
55 "failed to create temp path for "
56 "upload of file '%s' (errno: %d)",
57 source->
GetPath().c_str(), errno);
64 bool rvb = source->
Open();
67 unlink(tmp_path.c_str());
78 wbytes = fwrite(buffer, 1, rbytes, ftmp);
80 if ((rbytes < 0) || (static_cast<size_t>(rbytes) != wbytes)) {
83 unlink(tmp_path.c_str());
93 int rvi =
Move(tmp_path, remote_path);
96 "failed to move file '%s' from the "
97 "staging area to the final location: "
99 tmp_path.c_str(), remote_path.c_str());
100 unlink(tmp_path.c_str());
111 std::string tmp_path;
126 const size_t bytes_written =
128 if (bytes_written != buffer.
size) {
129 const int cpy_errno = errno;
131 "failed to write %lu bytes to '%s' "
151 const int cpy_errno = errno;
153 "failed to close temp file '%s' "
162 std::string final_path;
166 final_path =
"data/" + content_hash.
MakePath();
168 if (!
Peek(final_path)) {
171 const int cpy_errno = errno;
173 "failed to move temp file '%s' to "
174 "final location '%s' (errno: %d)",
194 "failed to remove temporary file '%s' (errno: %d)",
211 const int retval = unlink((
upstream_path_ +
"/" + file_to_delete).c_str());
212 if ((retval != 0) && (errno != ENOENT))
227 const std::string src =
"data/" +
object.MakePath();
228 const std::string dest =
upstream_path_ +
"/" +
object.MakeAlternativePath();
233 const std::string &remote_path)
const {
234 const std::string destination_path =
upstream_path_ +
"/" + remote_path;
238 int retcode = (retval == 0) ? 0 : 101;
241 "failed to set file permission '%s' "
243 local_path.c_str(), errno);
248 retval = rename(local_path.c_str(), destination_path.c_str());
249 retcode = (retval == 0) ? 0 : errno;
252 "failed to move file '%s' to '%s' "
254 local_path.c_str(), remote_path.c_str(), errno);
bool MakeCacheDirectories(const std::string &path, const mode_t mode)
const std::string upstream_path_
bool SymlinkForced(const std::string &src, const std::string &dest)
DriverType driver_type
the type of the spooler driver
int CreateAndOpenTemporaryChunkFile(std::string *path) const
LocalUploader(const SpoolerDefinition &spooler_definition)
UploadStreamHandle * InitStreamedUpload(const CallbackTN *callback)
FILE * CreateTempFile(const std::string &path_prefix, const int mode, const char *open_flags, std::string *final_path)
void Respond(const CallbackTN *callback, const UploaderResults &result) const
bool Peek(const std::string &path)
const std::string temporary_path_
assert((mem||(size==0))&&"Out Of Memory")
void StreamedUpload(UploadStreamHandle *handle, UploadBuffer buffer, const CallbackTN *callback=NULL)
void FinalizeStreamedUpload(UploadStreamHandle *handle, const shash::Any &content_hash)
void CountUploadedChunks() const
bool FileExists(const std::string &path)
const CallbackTN * commit_callback
unsigned int GetNumberOfErrors() const
int Move(const std::string &local_path, const std::string &remote_path) const
bool Mkdir(const std::string &path)
const char kSuffixPartial
const char kSuffixCatalog
bool MkdirDeep(const std::string &path, const mode_t mode, bool verify_writable)
const int file_descriptor
void CountUploadedBytes(int64_t bytes_written) const
const std::string temporary_path
const mode_t backend_file_mode_
int64_t DoGetObjectSize(const std::string &file_name)
void CountDuplicates() const
virtual std::string GetPath() const =0
bool PlaceBootstrappingShortcut(const shash::Any &object)
void CountUploadedCatalogBytes(int64_t bytes_written) const
void DoRemoveAsync(const std::string &file_to_delete)
void DoUpload(const std::string &remote_path, IngestionSource *source, const CallbackTN *callback)
const mode_t backend_dir_mode_
void CountUploadedCatalogs() const
virtual ssize_t Read(void *buffer, size_t nbyte)=0
int64_t GetFileSize(const std::string &path)
atomic_int32 copy_errors_
std::string MakePath() const
static bool WillHandle(const SpoolerDefinition &spooler_definition)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)