Page MenuHomePhabricator

D3560.diff
No OneTemporary

D3560.diff

diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h
@@ -28,8 +28,8 @@
virtual std::unique_ptr<grpc::Status> prepareRequest(
Request &request,
std::shared_ptr<Response> previousResponse) = 0;
- virtual void doneCallback() {
- }
+ virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
@@ -51,6 +51,7 @@
template <class Request, class Response>
void ClientBidiReactorBase<Request, Response>::terminate(
const grpc::Status &status) {
+ this->terminateCallback();
if (this->done) {
return;
}
diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h
@@ -24,13 +24,14 @@
virtual std::unique_ptr<grpc::Status>
readResponse(const Response &response) = 0;
- virtual void doneCallback() {
- }
+ virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
void ClientReadReactorBase<Request, Response>::terminate(
const grpc::Status &status) {
+ this->terminateCallback();
if (this->done) {
return;
}
diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h
@@ -22,8 +22,8 @@
void OnDone(const grpc::Status &status) override;
virtual std::unique_ptr<grpc::Status> prepareRequest(Request &request) = 0;
- virtual void doneCallback() {
- }
+ virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
@@ -53,6 +53,7 @@
template <class Request, class Response>
void ClientWriteReactorBase<Request, Response>::terminate(
const grpc::Status &status) {
+ this->terminateCallback();
if (this->done) {
return;
}
diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
@@ -43,6 +43,7 @@
handleRequest(Request request, Response *response) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
@@ -60,6 +61,7 @@
template <class Request, class Response>
void ServerBidiReactorBase<Request, Response>::terminate(
ServerBidiReactorStatus status) {
+ this->terminateCallback();
this->status = status;
if (!this->status.status.ok()) {
std::cout << "error: " << this->status.status.error_message() << std::endl;
diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h
@@ -29,10 +29,12 @@
virtual std::unique_ptr<grpc::Status> readRequest(Request request) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
void ServerReadReactorBase<Request, Response>::terminate(grpc::Status status) {
+ this->terminateCallback();
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
--- a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
+++ b/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
@@ -32,10 +32,12 @@
virtual std::unique_ptr<grpc::Status> writeResponse(Response *response) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
void ServerWriteReactorBase<Request, Response>::terminate(grpc::Status status) {
+ this->terminateCallback();
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
diff --git a/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
--- a/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
+++ b/services/blob/src/Reactors/server/base-reactors/ServerBidiReactorBase.h
@@ -43,6 +43,7 @@
handleRequest(Request request, Response *response) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
@@ -60,6 +61,7 @@
template <class Request, class Response>
void ServerBidiReactorBase<Request, Response>::terminate(
ServerBidiReactorStatus status) {
+ this->terminateCallback();
this->status = status;
if (!this->status.status.ok()) {
std::cout << "error: " << this->status.status.error_message() << std::endl;
diff --git a/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h
--- a/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h
+++ b/services/blob/src/Reactors/server/base-reactors/ServerReadReactorBase.h
@@ -29,10 +29,12 @@
virtual std::unique_ptr<grpc::Status> readRequest(Request request) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
template <class Request, class Response>
void ServerReadReactorBase<Request, Response>::terminate(grpc::Status status) {
+ this->terminateCallback();
if (!this->status.ok()) {
std::cout << "error: " << this->status.error_message() << std::endl;
}
diff --git a/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h b/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
--- a/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
+++ b/services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
@@ -15,6 +15,8 @@
Response response;
bool initialized = false;
+ void terminate(grpc::Status status);
+
protected:
// this is a const ref since it's not meant to be modified
const Request &request;
@@ -30,8 +32,19 @@
virtual std::unique_ptr<grpc::Status> writeResponse(Response *response) = 0;
virtual void initialize(){};
virtual void doneCallback(){};
+ virtual void terminateCallback(){};
};
+template <class Request, class Response>
+void ServerWriteReactorBase<Request, Response>::terminate(grpc::Status status) {
+ this->terminateCallback();
+ if (!this->status.ok()) {
+ std::cout << "error: " << this->status.error_message() << std::endl;
+ }
+ this->status = status;
+ this->Finish(status);
+}
+
template <class Request, class Response>
ServerWriteReactorBase<Request, Response>::ServerWriteReactorBase(
const Request *request)
@@ -53,13 +66,13 @@
this->response = Response();
std::unique_ptr<grpc::Status> status = this->writeResponse(&this->response);
if (status != nullptr) {
- this->Finish(*status);
+ this->terminate(*status);
return;
}
this->StartWrite(&this->response);
} catch (std::runtime_error &e) {
std::cout << "error: " << e.what() << std::endl;
- this->Finish(grpc::Status(grpc::StatusCode::INTERNAL, e.what()));
+ this->terminate(grpc::Status(grpc::StatusCode::INTERNAL, e.what()));
}
}
@@ -72,14 +85,10 @@
template <class Request, class Response>
void ServerWriteReactorBase<Request, Response>::OnWriteDone(bool ok) {
if (!ok) {
- this->Finish(grpc::Status(grpc::StatusCode::INTERNAL, "writing error"));
+ this->terminate(grpc::Status(grpc::StatusCode::INTERNAL, "writing error"));
return;
}
- try {
- this->NextWrite();
- } catch (std::runtime_error &e) {
- this->Finish(grpc::Status(grpc::StatusCode::INTERNAL, e.what()));
- }
+ this->NextWrite();
}
} // namespace reactor

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 11:35 AM (21 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575297
Default Alt Text
D3560.diff (9 KB)

Event Timeline