Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3536085
D3586.id11392.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
D3586.id11392.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 5:28 PM (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704081
Default Alt Text
D3586.id11392.diff (1 KB)
Attached To
Mode
D3586: [services] Backup - Send log - add store in database
Attached
Detach File
Event Timeline
Log In to Comment