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 ServerInterface;
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;
namespace internal {
@ -122,7 +113,7 @@ class ServerContextTestSpouse;
class DefaultReactorTestPeer;
} // namespace testing
/// Base class of ServerContext. Experimental until callback API is final.
/// Base class of ServerContext.
class ServerContextBase {
public:
virtual ~ServerContextBase();
@ -310,8 +301,6 @@ class ServerContextBase {
///
/// This method should not be called more than once or called after return
/// from the method handler.
///
/// WARNING: This is experimental API and could be changed or removed.
::grpc::ServerUnaryReactor* DefaultReactor() {
// Short-circuit the case where a default reactor was already set up by
// the TestPeer.

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

Loading…
Cancel
Save