Page MenuHomePhabricator

D4077.diff
No OneTemporary

D4077.diff

diff --git a/services/backup/src/DatabaseEntities/BackupItem.h b/services/backup/src/DatabaseEntities/BackupItem.h
--- a/services/backup/src/DatabaseEntities/BackupItem.h
+++ b/services/backup/src/DatabaseEntities/BackupItem.h
@@ -3,7 +3,6 @@
#include "Item.h"
#include <string>
-#include <vector>
namespace comm {
namespace network {
@@ -37,7 +36,7 @@
uint64_t created;
std::string recoveryData;
std::string compactionHolder;
- std::vector<std::string> attachmentHolders;
+ std::string attachmentHolders;
void validate() const override;
@@ -58,7 +57,7 @@
uint64_t created,
std::string recoveryData,
std::string compactionHolder,
- std::vector<std::string> attachmentHolders);
+ std::string attachmentHolders);
BackupItem(const AttributeValues &itemFromDB);
void assignItemFromDatabase(const AttributeValues &itemFromDB) override;
@@ -72,7 +71,9 @@
uint64_t getCreated() const;
std::string getRecoveryData() const;
std::string getCompactionHolder() const;
- std::vector<std::string> getAttachmentHolders() const;
+ std::string getAttachmentHolders() const;
+
+ void appendAttachmentHolder(const std::string &attachmentHolder);
};
} // namespace database
diff --git a/services/backup/src/DatabaseEntities/BackupItem.cpp b/services/backup/src/DatabaseEntities/BackupItem.cpp
--- a/services/backup/src/DatabaseEntities/BackupItem.cpp
+++ b/services/backup/src/DatabaseEntities/BackupItem.cpp
@@ -1,6 +1,7 @@
#include "BackupItem.h"
#include "Constants.h"
+#include "GlobalConstants.h"
namespace comm {
namespace network {
@@ -21,7 +22,7 @@
uint64_t created,
std::string recoveryData,
std::string compactionHolder,
- std::vector<std::string> attachmentHolders)
+ std::string attachmentHolders)
: userID(userID),
backupID(backupID),
created(created),
@@ -65,7 +66,7 @@
auto attachmentsHolders =
itemFromDB.find(BackupItem::FIELD_ATTACHMENT_HOLDERS);
if (attachmentsHolders != itemFromDB.end()) {
- this->attachmentHolders = attachmentsHolders->second.GetSS();
+ this->attachmentHolders = attachmentsHolders->second.GetS();
}
} catch (std::logic_error &e) {
throw std::runtime_error(
@@ -107,10 +108,15 @@
return this->compactionHolder;
}
-std::vector<std::string> BackupItem::getAttachmentHolders() const {
+std::string BackupItem::getAttachmentHolders() const {
return this->attachmentHolders;
}
+void BackupItem::appendAttachmentHolder(const std::string &attachmentHolder) {
+ this->attachmentHolders += attachmentHolder;
+ this->attachmentHolders += ATTACHMENT_DELIMITER;
+}
+
} // namespace database
} // namespace network
} // namespace comm
diff --git a/services/backup/src/DatabaseEntities/LogItem.h b/services/backup/src/DatabaseEntities/LogItem.h
--- a/services/backup/src/DatabaseEntities/LogItem.h
+++ b/services/backup/src/DatabaseEntities/LogItem.h
@@ -3,7 +3,6 @@
#include "Item.h"
#include <string>
-#include <vector>
namespace comm {
namespace network {
@@ -23,7 +22,7 @@
std::string logID;
bool persistedInBlob;
std::string value;
- std::vector<std::string> attachmentHolders;
+ std::string attachmentHolders;
void validate() const override;
@@ -42,7 +41,7 @@
const std::string logID,
const bool persistedInBlob,
const std::string value,
- std::vector<std::string> attachmentHolders);
+ std::string attachmentHolders);
LogItem(const AttributeValues &itemFromDB);
void assignItemFromDatabase(const AttributeValues &itemFromDB) override;
@@ -55,7 +54,9 @@
std::string getLogID() const;
bool getPersistedInBlob() const;
std::string getValue() const;
- std::vector<std::string> getAttachmentHolders() const;
+ std::string getAttachmentHolders() const;
+
+ void appendAttachmentHolder(const std::string &attachmentHolder);
};
} // namespace database
diff --git a/services/backup/src/DatabaseEntities/LogItem.cpp b/services/backup/src/DatabaseEntities/LogItem.cpp
--- a/services/backup/src/DatabaseEntities/LogItem.cpp
+++ b/services/backup/src/DatabaseEntities/LogItem.cpp
@@ -1,6 +1,7 @@
#include "LogItem.h"
#include "Constants.h"
+#include "GlobalConstants.h"
#include <stdexcept>
@@ -21,7 +22,7 @@
const std::string logID,
const bool persistedInBlob,
const std::string value,
- std::vector<std::string> attachmentHolders)
+ std::string attachmentHolders)
: backupID(backupID),
logID(logID),
persistedInBlob(persistedInBlob),
@@ -63,7 +64,7 @@
auto attachmentsHolders =
itemFromDB.find(LogItem::FIELD_ATTACHMENT_HOLDERS);
if (attachmentsHolders != itemFromDB.end()) {
- this->attachmentHolders = attachmentsHolders->second.GetSS();
+ this->attachmentHolders = attachmentsHolders->second.GetS();
}
} catch (std::logic_error &e) {
throw std::runtime_error(
@@ -100,10 +101,15 @@
return this->value;
}
-std::vector<std::string> LogItem::getAttachmentHolders() const {
+std::string LogItem::getAttachmentHolders() const {
return this->attachmentHolders;
}
+void LogItem::appendAttachmentHolder(const std::string &attachmentHolder) {
+ this->attachmentHolders += attachmentHolder;
+ this->attachmentHolders += ATTACHMENT_DELIMITER;
+}
+
} // namespace database
} // namespace network
} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 7:06 AM (21 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2517356
Default Alt Text
D4077.diff (5 KB)

Event Timeline