Page MenuHomePhabricator

D4030.id12943.diff
No OneTemporary

D4030.id12943.diff

diff --git a/services/backup/src/Tools.h b/services/backup/src/Tools.h
--- a/services/backup/src/Tools.h
+++ b/services/backup/src/Tools.h
@@ -7,5 +7,10 @@
std::string generateRandomString(std::size_t length = 20);
+std::string generateHolder(
+ const std::string &blobHash,
+ const std::string &backupID,
+ const std::string &resourceID = "");
+
} // namespace network
} // namespace comm
diff --git a/services/backup/src/Tools.cpp b/services/backup/src/Tools.cpp
--- a/services/backup/src/Tools.cpp
+++ b/services/backup/src/Tools.cpp
@@ -1,5 +1,7 @@
#include "Tools.h"
+#include "GlobalTools.h"
+
#include <chrono>
#include <cstdlib>
#include <random>
@@ -19,5 +21,13 @@
return random_string;
}
+std::string generateHolder(
+ const std::string &blobHash,
+ const std::string &backupID,
+ const std::string &resourceID) {
+ return backupID + ID_SEPARATOR + resourceID + ID_SEPARATOR + blobHash +
+ ID_SEPARATOR + generateUUID();
+}
+
} // namespace network
} // namespace comm
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
Sun, Nov 17, 1:39 AM (21 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2506774
Default Alt Text
D4030.id12943.diff (1 KB)

Event Timeline