De-experimentalize default_reactor_test_peer.h and last uses of CallbackServerContext (plus namespace cleanup) (#26569)

* De-experimentalize default_reactor_test_peer.h (plus namespace cleanup)

* Remove experimental refs to callback API in server_context.h
pull/26574/head
Vijay Pai 3 years ago committed by GitHub
parent 36265647a0
commit 0b65c34ae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      include/grpcpp/impl/codegen/server_context.h
  2. 15
      include/grpcpp/test/default_reactor_test_peer.h

@ -101,15 +101,6 @@ class GenericServerContext;
class Server; class Server;
class ServerInterface; class ServerInterface;
class ContextAllocator; class ContextAllocator;
// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
namespace experimental {
typedef ::grpc::ServerContextBase ServerContextBase;
typedef ::grpc::CallbackServerContext CallbackServerContext;
} // namespace experimental
class GenericCallbackServerContext; class GenericCallbackServerContext;
namespace internal { namespace internal {
@ -122,7 +113,7 @@ class ServerContextTestSpouse;
class DefaultReactorTestPeer; class DefaultReactorTestPeer;
} // namespace testing } // namespace testing
/// Base class of ServerContext. Experimental until callback API is final. /// Base class of ServerContext.
class ServerContextBase { class ServerContextBase {
public: public:
virtual ~ServerContextBase(); virtual ~ServerContextBase();
@ -310,8 +301,6 @@ class ServerContextBase {
/// ///
/// This method should not be called more than once or called after return /// This method should not be called more than once or called after return
/// from the method handler. /// from the method handler.
///
/// WARNING: This is experimental API and could be changed or removed.
::grpc::ServerUnaryReactor* DefaultReactor() { ::grpc::ServerUnaryReactor* DefaultReactor() {
// Short-circuit the case where a default reactor was already set up by // Short-circuit the case where a default reactor was already set up by
// the TestPeer. // the TestPeer.

@ -34,22 +34,21 @@ namespace testing {
/// test mode rather than letting it follow the normal paths. /// test mode rather than letting it follow the normal paths.
class DefaultReactorTestPeer { class DefaultReactorTestPeer {
public: public:
explicit DefaultReactorTestPeer(experimental::CallbackServerContext* ctx) explicit DefaultReactorTestPeer(CallbackServerContext* ctx)
: DefaultReactorTestPeer(ctx, [](::grpc::Status) {}) {} : DefaultReactorTestPeer(ctx, [](Status) {}) {}
DefaultReactorTestPeer(experimental::CallbackServerContext* ctx, DefaultReactorTestPeer(CallbackServerContext* ctx,
std::function<void(::grpc::Status)> finish_func) std::function<void(Status)> finish_func)
: ctx_(ctx) { : ctx_(ctx) {
ctx->SetupTestDefaultReactor(std::move(finish_func)); ctx->SetupTestDefaultReactor(std::move(finish_func));
} }
::grpc::experimental::ServerUnaryReactor* reactor() const { ServerUnaryReactor* reactor() const {
return reinterpret_cast<experimental::ServerUnaryReactor*>( return reinterpret_cast<ServerUnaryReactor*>(&ctx_->default_reactor_);
&ctx_->default_reactor_);
} }
bool test_status_set() const { return ctx_->test_status_set(); } bool test_status_set() const { return ctx_->test_status_set(); }
Status test_status() const { return ctx_->test_status(); } Status test_status() const { return ctx_->test_status(); }
private: private:
experimental::CallbackServerContext* const ctx_; // not owned CallbackServerContext* const ctx_; // not owned
}; };
} // namespace testing } // namespace testing

Loading…
Cancel
Save