Page MenuHomePhabricator

D4028.id12836.diff
No OneTemporary

D4028.id12836.diff

diff --git a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp
--- a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp
+++ b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp
@@ -8,9 +8,9 @@
namespace network {
namespace reactor {
-std::string CreateNewBackupReactor::generateBackupID() {
- // mock
- return generateRandomString();
+std::string
+CreateNewBackupReactor::generateBackupID() {
+ return generateUUID();
}
std::unique_ptr<ServerBidiReactorStatus> CreateNewBackupReactor::handleRequest(
@@ -46,6 +46,12 @@
// TODO confirm - holder may be a backup id
this->backupID = this->generateBackupID();
+ if (database::DatabaseManager::getInstance().findBackupItem(
+ this->userID, this->backupID) != nullptr) {
+ throw std::runtime_error(
+ "Backup with id [" + this->backupID + "] for user [" +
+ this->userID + "] already exists, creation aborted");
+ }
response->set_backupid(this->backupID);
this->holder = this->backupID;
this->putReactor = std::make_shared<reactor::BlobPutClientReactor>(
diff --git a/services/lib/src/GlobalTools.h b/services/lib/src/GlobalTools.h
--- a/services/lib/src/GlobalTools.h
+++ b/services/lib/src/GlobalTools.h
@@ -6,6 +6,8 @@
namespace comm {
namespace network {
+const std::string ID_SEPARATOR = ":";
+
uint64_t getCurrentTimestamp();
bool hasEnvFlag(const std::string &flag);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 5:30 PM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2707748
Default Alt Text
D4028.id12836.diff (1 KB)

Event Timeline