Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3267928
D4028.id13106.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4028.id13106.diff
View Options
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
@@ -9,8 +9,11 @@
namespace reactor {
std::string CreateNewBackupReactor::generateBackupID() {
- // mock
- return generateRandomString();
+ if (this->deviceID.empty()) {
+ throw std::runtime_error(
+ "trying to generate a backup ID with an empty device ID");
+ }
+ return this->deviceID + std::to_string(getCurrentTimestamp());
}
std::unique_ptr<ServerBidiReactorStatus> CreateNewBackupReactor::handleRequest(
@@ -52,8 +55,13 @@
this->dataHash = request.newcompactionhash();
this->state = State::DATA_CHUNKS;
- // 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>(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 3:05 AM (17 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2509211
Default Alt Text
D4028.id13106.diff (1 KB)
Attached To
Mode
D4028: [services] Backup - generate backup id
Attached
Detach File
Event Timeline
Log In to Comment