14 Spooler *Spooler::Construct(
const SpoolerDefinition &spooler_definition,
16 Spooler *result =
new Spooler(spooler_definition);
17 if (!result->Initialize(statistics)) {
24 Spooler::Spooler(
const SpoolerDefinition &spooler_definition)
25 : spooler_definition_(spooler_definition) { }
28 FinalizeSession(
false);
29 if (uploader_.IsValid()) {
30 uploader_->TearDown();
34 std::string Spooler::backend_name()
const {
return uploader_->name(); }
38 uploader_ = AbstractUploader::Construct(spooler_definition_);
39 if (!uploader_.IsValid()) {
41 "Failed to initialize backend upload "
42 "facility in Spooler.");
46 if (statistics != NULL) {
47 uploader_->InitCounters(statistics);
54 ingestion_pipeline_->Spawn();
63 ingestion_pipeline_->Process(source, allow_chunking);
66 void Spooler::ProcessCatalog(
const std::string &local_path) {
71 void Spooler::ProcessHistory(
const std::string &local_path) {
76 void Spooler::ProcessCertificate(
const std::string &local_path) {
85 void Spooler::ProcessMetainfo(
const std::string &local_path) {
94 void Spooler::Upload(
const std::string &local_path,
95 const std::string &remote_path) {
96 uploader_->UploadFile(
97 local_path, remote_path,
98 AbstractUploader::MakeCallback(&Spooler::UploadingCallback,
this));
101 void Spooler::Upload(
const std::string &remote_path,
IngestionSource *source) {
102 uploader_->UploadIngestionSource(
104 AbstractUploader::MakeCallback(&Spooler::UploadingCallback,
this));
109 void Spooler::UploadManifest(
const std::string &local_path) {
110 Upload(local_path,
".cvmfspublished");
113 void Spooler::UploadReflog(
const std::string &local_path) {
114 Upload(local_path,
".cvmfsreflog");
117 void Spooler::RemoveAsync(
const std::string &file_to_delete) {
118 uploader_->RemoveAsync(file_to_delete);
122 return uploader_->Peek(path);
125 bool Spooler::Mkdir(
const std::string &path) {
return uploader_->Mkdir(path); }
127 bool Spooler::PlaceBootstrappingShortcut(
const shash::Any &
object)
const {
129 return uploader_->PlaceBootstrappingShortcut(
object);
132 void Spooler::ProcessingCallback(
const SpoolerResult &data) {
133 NotifyListeners(data);
136 void Spooler::UploadingCallback(
const UploaderResults &data) {
137 NotifyListeners(SpoolerResult(data.return_code, data.local_path));
140 void Spooler::WaitForUpload()
const {
141 ingestion_pipeline_->WaitFor();
142 uploader_->WaitForUpload();
145 bool Spooler::FinalizeSession(
bool commit,
const std::string &old_root_hash,
146 const std::string &new_root_hash,
148 return uploader_->FinalizeSession(commit, old_root_hash, new_root_hash, tag);
151 unsigned int Spooler::GetNumberOfErrors()
const {
152 return uploader_->GetNumberOfErrors();
CallbackPtr RegisterListener(typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data)
static Publisher * Create(const SettingsPublisher &settings)
CVMFS_EXPORT const LogSource source
const char kSuffixCertificate
assert((mem||(size==0))&&"Out Of Memory")
const char kSuffixCatalog
const char kSuffixMetainfo
const char kSuffixHistory
static bool Peek(const string &remote_path)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)