Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CCDB/src/CcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ int CcdbApi::storeAsBinaryFile(const char* buffer, size_t size, const std::strin
sanitizedEndValidityTimestamp = getFutureTimestamp(60 * 60 * 24 * 1);
}
if (mInSnapshotMode) { // write local file
if (filename.empty() || buffer == nullptr || size == 0) {
LOGP(alarm, "Snapshot mode does not support headers-only upload");
return -3;
}
auto pthLoc = getSnapshotDir(mSnapshotTopPath, path);
o2::utils::createDirectoriesIfAbsent(pthLoc);
auto flLoc = getSnapshotFile(mSnapshotTopPath, path, filename);
Expand Down Expand Up @@ -418,8 +422,14 @@ int CcdbApi::storeAsBinaryFile(const char* buffer, size_t size, const std::strin
auto mime = curl_mime_init(curl);
auto field = curl_mime_addpart(mime);
curl_mime_name(field, "send");
curl_mime_filedata(field, filename.c_str());
curl_mime_data(field, buffer, size);
if (filename.empty()) {
curl_mime_filedata(field, filename.c_str());
}
if (buffer != nullptr && size > 0) {
curl_mime_data(field, buffer, size);
} else {
curl_mime_data(field, "", 0);
}

struct curl_slist* headerlist = nullptr;
static const char buf[] = "Expect:";
Expand Down
3 changes: 3 additions & 0 deletions CCDB/src/UploadTool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ int main(int argc, char* argv[])
}

if (filename == "headersOnly") {
auto ent = meta.find("Redirect");
std::cout << " Uploading a headers-only object to path " << path << " with timestamp validity from " << starttimestamp << " to " << endtimestamp
<< " Redirection to: " << ((ent != meta.end()) ? ent->second : std::string{"none"}) << "\n";
api.storeAsBinaryFile(nullptr, 0, "ignored", "", path, meta, starttimestamp, endtimestamp);
if (!api.isSnapshotMode() && meta.find("adjustableEOV") != meta.end() && meta.find("default") == meta.end()) {
o2::ccdb::CcdbObjectInfo oi(path, "", "", meta, starttimestamp, endtimestamp);
Expand Down