diff --git a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp --- a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp +++ b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp @@ -67,36 +67,30 @@ response->set_backupid(this->backupID); this->holder = tools::generateHolder(this->dataHash, this->backupID); bool dataExists = false; - try { - put_client_initialize_cxx(); - put_client_write_cxx( - tools::getBlobPutField(tools::BlobPutField::HOLDER), - this->holder.c_str()); - put_client_blocking_read_cxx(); // todo this should be avoided - // (blocking); we should be able to - // ignore responses; we probably want to - // delegate performing ops to separate - // threads in the base reactors - put_client_write_cxx( - tools::getBlobPutField(tools::BlobPutField::HASH), - this->dataHash.c_str()); + put_client_initialize_cxx(); + put_client_write_cxx( + tools::getBlobPutField(tools::BlobPutField::HOLDER), + this->holder.c_str()); + put_client_blocking_read_cxx(); // todo this should be avoided + // (blocking); we should be able to + // ignore responses; we probably want to + // delegate performing ops to separate + // threads in the base reactors + put_client_write_cxx( + tools::getBlobPutField(tools::BlobPutField::HASH), + this->dataHash.c_str()); - rust::String responseStr = - put_client_blocking_read_cxx(); // todo this should be avoided - // (blocking); we should be able to - // ignore responses; we probably - // want to delegate performing ops - // to separate threads in the base - // reactors - // data exists? - if ((bool)tools::charPtrToInt(responseStr.c_str())) { - return std::make_unique( - grpc::Status::OK, true); - } - } catch (std::exception &e) { - throw std::runtime_error( - e.what()); // todo in base reactors we can just handle std exception - // instead of keep rethrowing here + rust::String responseStr = + put_client_blocking_read_cxx(); // todo this should be avoided + // (blocking); we should be able to + // ignore responses; we probably + // want to delegate performing ops + // to separate threads in the base + // reactors + // data exists? + if ((bool)tools::charPtrToInt(responseStr.c_str())) { + return std::make_unique( + grpc::Status::OK, true); } return nullptr; } @@ -104,21 +98,16 @@ if (request.mutable_newcompactionchunk()->empty()) { return std::make_unique(grpc::Status::OK); } - try { - put_client_write_cxx( - tools::getBlobPutField(tools::BlobPutField::DATA_CHUNK), - std::string(std::move(*request.mutable_newcompactionchunk())) - .c_str()); - put_client_blocking_read_cxx(); // todo this should be avoided - // (blocking); we should be able to - // ignore responses; we probably want to - // delegate performing ops to separate - // threads in the base reactors - } catch (std::exception &e) { - throw std::runtime_error( - e.what()); // todo in base reactors we can just handle std exception - // instead of keep rethrowing here - } + put_client_write_cxx( + tools::getBlobPutField(tools::BlobPutField::DATA_CHUNK), + std::string(std::move(*request.mutable_newcompactionchunk())) + .c_str()); + put_client_blocking_read_cxx(); // todo this should be avoided + // (blocking); we should be able to + // ignore responses; we probably want to + // delegate performing ops to separate + // threads in the base reactors + return nullptr; } } @@ -127,13 +116,7 @@ void CreateNewBackupReactor::terminateCallback() { const std::lock_guard lock(this->reactorStateMutex); - try { - put_client_terminate_cxx(); - } catch (std::exception &e) { - throw std::runtime_error( - e.what()); // todo in base reactors we can just handle std exception - // instead of keep rethrowing here - } + put_client_terminate_cxx(); // TODO add recovery data // TODO handle attachments holders