diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-11-24 06:59:33 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-11-24 06:59:33 -0800 |
commit | 7221d999bb503acd733e75e374cbf7f6ac28e482 (patch) | |
tree | d97f19942011217c115d8443fa93a6daa36ec896 /include/grpc++/server.h | |
parent | 447c795bb8d82ec328573c6517d82dc6d0dcc0f8 (diff) |
Global hook for doing something in response to a synchronous server call
Diffstat (limited to 'include/grpc++/server.h')
-rw-r--r-- | include/grpc++/server.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 1a62df5698..f5fc51ed1f 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -56,6 +56,7 @@ class AsyncGenericService; class RpcService; class RpcServiceMethod; class ServerAsyncStreamingInterface; +class ServerContext; class ThreadPoolInterface; /// Models a gRPC server. @@ -84,6 +85,17 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook { /// call \a Shutdown for this function to ever return. void Wait(); + /// Global Callbacks + /// + /// Can be set exactly once per application to install hooks whenever + /// a server event occurs + class GlobalCallbacks { + public: + virtual void PreSynchronousRequest(ServerContext* context) = 0; + virtual void PostSynchronousRequest(ServerContext* context) = 0; + }; + static void SetGlobalCallbacks(GlobalCallbacks* callbacks); + private: friend class AsyncGenericService; friend class AsynchronousService; |