Page Speed Optimization Libraries
1.13.35.1
|
#include "schedule_rewrite_rpc_handler.h"
Protected Member Functions | |
ScheduleRewriteRpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq, ScheduleRewriteController *controller) | |
void | HandleClientRequest (const ScheduleRewriteRequest &req, Function *cb) override |
RequestResultRpcHandler implementation. | |
void | HandleClientResult (const ScheduleRewriteRequest &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< ScheduleRewriteRpcHandler, ScheduleRewriteController, grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > | |
RequestResultRpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq, ScheduleRewriteController *controller) | |
void | Finish (const ::grpc::Status &status) |
Hide the parent implementation so we can frob our own state machine. | |
ScheduleRewriteController * | controller () |
Protected Member Functions inherited from net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > | |
RpcHandler (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq) | |
bool | Write (const ScheduleRewriteResponse &resp) |
bool | Finish (const ::grpc::Status &status) |
void | Start () |
Friends | |
class | RequestResultRpcHandler |
Allow access to protected constructor. | |
class | ScheduleRewriteRpcHandlerTest |
RpcHandler for ExpensiveOperationController.
The request message on the RPC contains the key that the client wants to rewrite. This will trigger a call to HandleClientRequest() which we use to call ScheduleRewrite(). 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 indicating success or failure, which will trigger a call to HandleClientResult() which we then dispatch to NotifyRewriteComplete() or NotifyRewriteFailed().
If the client disconnects after requesting an rewrite but before sending a second "completed" message, we receive a call to HandleOperationFailed() and will call NotifyRewriteFailed() 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.