Page MenuHomePhabricator

D4032.diff
No OneTemporary

D4032.diff

diff --git a/services/backup/src/Reactors/server/SendLogReactor.h b/services/backup/src/Reactors/server/SendLogReactor.h
--- a/services/backup/src/Reactors/server/SendLogReactor.h
+++ b/services/backup/src/Reactors/server/SendLogReactor.h
@@ -32,6 +32,7 @@
State state = State::USER_ID;
PersistenceMethod persistenceMethod = PersistenceMethod::UNKNOWN;
std::string userID;
+ std::string logID;
std::string backupID;
std::string hash;
// either the value itself which is a dump of a single operation (if
@@ -47,8 +48,7 @@
ServiceBlobClient blobClient;
void storeInDatabase();
- std::string generateHolder();
- std::string generateLogID();
+ std::string generateLogID(const std::string &backupID);
void initializePutReactor();
public:
diff --git a/services/backup/src/Reactors/server/SendLogReactor.cpp b/services/backup/src/Reactors/server/SendLogReactor.cpp
--- a/services/backup/src/Reactors/server/SendLogReactor.cpp
+++ b/services/backup/src/Reactors/server/SendLogReactor.cpp
@@ -2,6 +2,7 @@
#include "Constants.h"
#include "DatabaseManager.h"
+#include "GlobalTools.h"
#include "Tools.h"
#include <iostream>
@@ -14,21 +15,15 @@
// TODO handle attachment holders
database::LogItem logItem(
this->backupID,
- this->generateLogID(),
+ this->logID,
(this->persistenceMethod == PersistenceMethod::BLOB),
this->value,
{});
database::DatabaseManager::getInstance().putLogItem(logItem);
}
-std::string SendLogReactor::generateHolder() {
- // TODO replace mock
- return generateRandomString();
-}
-
-std::string SendLogReactor::generateLogID() {
- // TODO replace mock
- return generateRandomString();
+std::string SendLogReactor::generateLogID(const std::string &backupID) {
+ return backupID + ID_SEPARATOR + std::to_string(getCurrentTimestamp());
}
void SendLogReactor::initializePutReactor() {
@@ -66,6 +61,7 @@
throw std::runtime_error("backup id expected but not received");
}
this->backupID = request.backupid();
+ this->logID = this->generateLogID(this->backupID);
this->state = State::LOG_HASH;
return nullptr;
};
@@ -112,7 +108,7 @@
this->persistenceMethod = PersistenceMethod::BLOB;
}
if (this->value.empty()) {
- this->value = this->generateHolder();
+ this->value = generateHolder(this->hash, this->backupID, this->logID);
}
this->initializePutReactor();
this->putReactor->scheduleSendingDataChunk(std::move(chunk));

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 6:26 AM (1 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704067
Default Alt Text
D4032.diff (2 KB)

Event Timeline