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 #include #include @@ -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);