17 #ifndef PAGESPEED_CONTROLLER_CENTRAL_CONTROLLER_RPC_CLIENT_H_
18 #define PAGESPEED_CONTROLLER_CENTRAL_CONTROLLER_RPC_CLIENT_H_
21 #include <unordered_set>
23 #include "base/macros.h"
24 #include "pagespeed/controller/controller.grpc.pb.h"
35 #include "pagespeed/kernel/base/thread_annotations.h"
38 namespace net_instaweb {
52 static const char kControllerReconnectTimeStatistic[];
53 static const int kControllerReconnectDelayMs;
66 void ShutDown()
override LOCKS_EXCLUDED(mutex_);
77 class GrpcClientThread;
81 template <
typename ContextT,
typename CallbackT>
82 void StartContext(CallbackT* callback) LOCKS_EXCLUDED(mutex_);
86 void ConsiderConnecting(int64 now_ms) EXCLUSIVE_LOCKS_REQUIRED(mutex_);
89 bool TimestampsAllowConnection(int64 now) EXCLUSIVE_LOCKS_REQUIRED(mutex_);
93 std::unique_ptr<AbstractMutex> mutex_;
98 std::unique_ptr<ClientRegistry> clients_;
101 State state_ GUARDED_BY(mutex_);
102 const int controller_panic_threshold_;
103 int64 reconnect_time_ms_ GUARDED_BY(mutex_);
106 std::unique_ptr<::grpc::CompletionQueue> queue_;
107 std::shared_ptr<::grpc::ChannelInterface> channel_;
108 std::unique_ptr<grpc::CentralControllerRpcService::Stub> stub_;
111 std::unique_ptr<GrpcClientThread> client_thread_ GUARDED_BY(mutex_);
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Implementor interface to rewrite scheduling features in CentralController.
Definition: schedule_rewrite_callback.h:48
void ScheduleExpensiveOperation(ExpensiveOperationCallback *callback) override
CentralController implementation.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
void ScheduleRewrite(ScheduleRewriteCallback *callback) override
Definition: central_controller.h:29
Definition: central_controller_rpc_client.h:50
Implementor interface to ExpensiveOperation features in CentralController.
Definition: expensive_operation_callback.h:46
void ShutDown() override LOCKS_EXCLUDED(mutex_)
Definition: thread_system.h:40
Definition: statistics.h:73
Definition: message_handler.h:39
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27