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::ExpensiveOperationRpcHandler Class Reference

#include "expensive_operation_rpc_handler.h"

Inheritance diagram for net_instaweb::ExpensiveOperationRpcHandler:
net_instaweb::RequestResultRpcHandler< ExpensiveOperationRpcHandler, ExpensiveOperationController, grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse > net_instaweb::RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse > net_instaweb::RefCounted< RpcHandler< grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse > >

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

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

void net_instaweb::ExpensiveOperationRpcHandler::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< ExpensiveOperationRpcHandler, ExpensiveOperationController, grpc::CentralControllerRpcService::AsyncService, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse >.

void net_instaweb::ExpensiveOperationRpcHandler::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, ScheduleExpensiveOperationRequest, ScheduleExpensiveOperationResponse >.


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