diff --git a/services/backup/src/DatabaseManager.h b/services/backup/src/DatabaseManager.h --- a/services/backup/src/DatabaseManager.h +++ b/services/backup/src/DatabaseManager.h @@ -28,6 +28,8 @@ void removeBackupItem(std::shared_ptr item); void putLogItem(const LogItem &item); + std::shared_ptr + findLogItem(const std::string &backupID, const std::string &logID); std::vector> findLogItemsForBackup(const std::string &backupID); void removeLogItem(std::shared_ptr item); diff --git a/services/backup/src/DatabaseManager.cpp b/services/backup/src/DatabaseManager.cpp --- a/services/backup/src/DatabaseManager.cpp +++ b/services/backup/src/DatabaseManager.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -121,6 +122,18 @@ this->innerPutItem(std::make_shared(item), request); } +std::shared_ptr DatabaseManager::findLogItem( + const std::string &backupID, + const std::string &logID) { + Aws::DynamoDB::Model::GetItemRequest request; + request.AddKey( + LogItem::FIELD_BACKUP_ID, Aws::DynamoDB::Model::AttributeValue(backupID)); + request.AddKey( + LogItem::FIELD_LOG_ID, Aws::DynamoDB::Model::AttributeValue(logID)); + + return std::move(this->innerFindItem(request)); +} + std::vector> DatabaseManager::findLogItemsForBackup(const std::string &backupID) { std::vector> result;