diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h @@ -88,7 +88,28 @@ std::unique_ptr PullBackupReactor::writeResponse(backup::PullBackupResponse *response) { - throw std::runtime_error("unimplemented"); + // we make sure that the blob client's state is flushed to the main memory + // as there may be multiple threads from the pool taking over here + const std::lock_guard lock(this->reactorStateMutex); + switch (this->state) { + case State::COMPACTION: { + this->initializeGetReactor(this->backupItem->getCompactionHolder()); + std::string dataChunk; + this->dataChunks->blockingRead(dataChunk); + if (dataChunk.empty()) { + // TODO try to immediately start writing logs instead of wasting a cycle + // sending nothing + this->state = State::LOGS; + return nullptr; + } + response->set_compactionchunk(dataChunk); + return nullptr; + } + case State::LOGS: { + throw std::runtime_error("unimplemented"); + } + } + throw std::runtime_error("unhandled state"); } } // namespace reactor