Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Member Functions | Friends | List of all members
net_instaweb::ScheduleRewriteRpcHandler Class Reference

#include "schedule_rewrite_rpc_handler.h"

Inheritance diagram for net_instaweb::ScheduleRewriteRpcHandler:
net_instaweb::RequestResultRpcHandler< ScheduleRewriteRpcHandler, ScheduleRewriteController, grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > net_instaweb::RefCounted< RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > >

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.
 
ScheduleRewriteControllercontroller ()
 
- 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
 

Additional Inherited Members

- Public Types inherited from net_instaweb::RequestResultRpcHandler< ScheduleRewriteRpcHandler, ScheduleRewriteController, grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse >
typedef RefCountedPtr
< RequestResultRpcHandler
RefPtr
 
- Public Member Functions inherited from net_instaweb::RefCounted< RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse > >
void Release ()
 
void AddRef ()
 
bool HasOneRef ()
 
- Static Public Member Functions inherited from net_instaweb::RequestResultRpcHandler< ScheduleRewriteRpcHandler, ScheduleRewriteController, grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse >
static void CreateAndStart (grpc::CentralControllerRpcService::AsyncService *service,::grpc::ServerCompletionQueue *cq, ScheduleRewriteController *controller)
 
- Protected Types inherited from net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse >
typedef
::grpc::ServerAsyncReaderWriter
< ScheduleRewriteResponse,
ScheduleRewriteRequest > 
ReaderWriterT
 

Detailed Description

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".

Member Function Documentation

void net_instaweb::ScheduleRewriteRpcHandler::HandleOperationFailed ( )
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.

Implements net_instaweb::RequestResultRpcHandler< ScheduleRewriteRpcHandler, ScheduleRewriteController, grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse >.

void net_instaweb::ScheduleRewriteRpcHandler::InitResponder ( grpc::CentralControllerRpcService::AsyncService *  service,
::grpc::ServerContext *  ctx,
ReaderWriterT *  responder,
::grpc::ServerCompletionQueue *  cq,
void *  tag 
)
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.

Implements net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleRewriteRequest, ScheduleRewriteResponse >.


The documentation for this class was generated from the following file: