Page Speed Optimization Libraries
1.13.35.1
|
#include "expensive_operation_rpc_handler.h"
Protected Member Functions | |
ExpensiveOperationRpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq, ExpensiveOperationController *controller) | |
void | HandleClientRequest (const ScheduleExpensiveOperationRequest &req, Function *cb) override |
RequestResultRpcHandler implementation. | |
void | HandleClientResult (const ScheduleExpensiveOperationRequest &req) override |
void | HandleOperationFailed () override |
void | InitResponder (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerContext *ctx, ReaderWriterT *responder,::grpc::ServerCompletionQueue *cq, void *callback) override |
Protected Member Functions inherited from net_instaweb::RequestResultRpcHandler< ExpensiveOperationRpcHandler, ExpensiveOperationController, grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse > | |
RequestResultRpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq, ExpensiveOperationController *controller) | |
void | Finish (const ::grpc::Status &status) |
Hide the parent implementation so we can frob our own state machine. | |
ExpensiveOperationController * | controller () |
Protected Member Functions inherited from net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse > | |
RpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq) | |
bool | Write (const ScheduleExpensiveOperationResponse &resp) |
bool | Finish (const ::grpc::Status &status) |
void | Start () |
Friends | |
class | RequestResultRpcHandler |
Allow access to protected constructor. | |
class | ExpensiveOperationRpcHandlerTest |
RpcHandler for ExpensiveOperationController.
The request message on the RPC contains no payload, it's just the client saying "I have something expensive to do now, let me know when". This will trigger a call to HandleClientRequest() which we use to call ScheduleExpensiveOperation(). When the controller decides if it will allow the rewrite to proceed, RequestResultRpcHandler returns that decision to the client. Once the client completes, it sends another Request message, which will trigger a call to HandleClientResult() and we in-turn call NotifyExpensiveOperationComplete().
If the client disconnects after requesting an operation but before sending a second "completed" message, we receive a call to HandleOperationFailed() and will call NotifyExpensiveOperationComplete() on the controller, so it can release "locks".
|
overrideprotectedvirtual |
Called if anything goes wrong in WAITING_FOR_CONTROLLER or OPERATION_RUNNING states. After such a call, the state will be DONE and no other calls will be made.
|
overrideprotectedvirtual |
Attempt to initiate a gRPC client session by calling the appropriate RequestXXXRpcMethodName on the AsyncService object. In the SampleService example above, this would call service->RequestSaveConfiguration(...). "tag" should be passed directly to the gRPC API and will be initialised to a callback that will invoke the success/failure handlers in this class.