15 Spooler *Spooler::Construct(
const SpoolerDefinition &spooler_definition,
17 Spooler *result =
new Spooler(spooler_definition);
18 if (!result->Initialize(statistics)) {
25 Spooler::Spooler(
const SpoolerDefinition &spooler_definition)
26 : spooler_definition_(spooler_definition) {}
29 FinalizeSession(
false);
30 if (uploader_.IsValid()) {
31 uploader_->TearDown();
35 std::string Spooler::backend_name()
const {
return uploader_->name(); }
39 uploader_ = AbstractUploader::Construct(spooler_definition_);
40 if (!uploader_.IsValid()) {
42 "Failed to initialize backend upload "
43 "facility in Spooler.");
47 if (statistics != NULL) {
48 uploader_->InitCounters(statistics);
55 ingestion_pipeline_->Spawn();
62 return uploader_->Create();
65 void Spooler::Process(
IngestionSource *source,
const bool allow_chunking) {
66 ingestion_pipeline_->Process(source, allow_chunking);
69 void Spooler::ProcessCatalog(
const std::string &local_path) {
74 void Spooler::ProcessHistory(
const std::string &local_path) {
79 void Spooler::ProcessCertificate(
const std::string &local_path) {
88 void Spooler::ProcessMetainfo(
const std::string &local_path) {
97 void Spooler::Upload(
const std::string &local_path,
98 const std::string &remote_path) {
99 uploader_->UploadFile(
100 local_path, remote_path,
101 AbstractUploader::MakeCallback(&Spooler::UploadingCallback,
this));
104 void Spooler::Upload(
const std::string &remote_path,
IngestionSource *source) {
105 uploader_->UploadIngestionSource(
107 AbstractUploader::MakeCallback(&Spooler::UploadingCallback,
this));
112 void Spooler::UploadManifest(
const std::string &local_path) {
113 Upload(local_path,
".cvmfspublished");
116 void Spooler::UploadReflog(
const std::string &local_path) {
117 Upload(local_path,
".cvmfsreflog");
120 void Spooler::RemoveAsync(
const std::string &file_to_delete) {
121 uploader_->RemoveAsync(file_to_delete);
125 return uploader_->Peek(path);
128 bool Spooler::Mkdir(
const std::string &path) {
129 return uploader_->Mkdir(path);
132 bool Spooler::PlaceBootstrappingShortcut(
const shash::Any &
object)
const {
134 return uploader_->PlaceBootstrappingShortcut(
object);
137 void Spooler::ProcessingCallback(
const SpoolerResult &data) {
138 NotifyListeners(data);
141 void Spooler::UploadingCallback(
const UploaderResults &data) {
142 NotifyListeners(SpoolerResult(data.return_code, data.local_path));
145 void Spooler::WaitForUpload()
const {
146 ingestion_pipeline_->WaitFor();
147 uploader_->WaitForUpload();
150 bool Spooler::FinalizeSession(
bool commit,
const std::string &old_root_hash,
151 const std::string &new_root_hash,
153 return uploader_->FinalizeSession(commit, old_root_hash,
157 unsigned int Spooler::GetNumberOfErrors()
const {
158 return uploader_->GetNumberOfErrors();
CallbackPtr RegisterListener(typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data)
static Publisher * Create(const SettingsPublisher &settings)
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,...)