Page MenuHomePhabricator

D3586.diff
No OneTemporary

D3586.diff

diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h
@@ -31,9 +31,14 @@
State state = State::USER_ID;
PersistenceMethod persistenceMethod = PersistenceMethod::UNKNOWN;
std::string userID;
+ std::string backupID;
+ // either the value itself which is a dump of a single operation (if
+ // `persistedInBlob` is false) or the holder to blob (if `persistedInBlob` is
+ // true)
+ std::string value;
- void storeInDatabase(const std::string &data) {
- }
+ void storeInDatabase();
+ std::string generateLogID();
void storeInBlob(const std::string &data) {
}
@@ -47,6 +52,22 @@
void doneCallback() override;
};
+void SendLogReactor::storeInDatabase() {
+ // TODO handle attachment holders
+ database::LogItem logItem(
+ this->backupID,
+ this->generateLogID(),
+ (this->persistenceMethod == PersistenceMethod::BLOB),
+ this->value,
+ {});
+ database::DatabaseManager::getInstance().putLogItem(logItem);
+}
+
+std::string SendLogReactor::generateLogID() {
+ // TODO replace mock
+ return generateRandomString();
+}
+
std::unique_ptr<grpc::Status>
SendLogReactor::readRequest(backup::SendLogRequest request) {
switch (this->state) {
@@ -71,7 +92,8 @@
if (chunk->size() <= LOG_DATA_SIZE_DATABASE_LIMIT) {
if (this->persistenceMethod == PersistenceMethod::UNKNOWN) {
this->persistenceMethod = PersistenceMethod::DB;
- this->storeInDatabase(*chunk);
+ this->value = std::move(*chunk);
+ this->storeInDatabase();
} else if (this->persistenceMethod == PersistenceMethod::BLOB) {
this->storeInBlob(*chunk);
} else {

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 6:36 AM (47 m, 21 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704081
Default Alt Text
D3586.diff (1 KB)

Event Timeline