aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2017-08-11 11:55:19 -0700
committerGravatar Vijay Pai <vpai@google.com>2017-08-11 11:56:34 -0700
commitb18ab3f7c823b4946b1c8c2c5aa2c5ac10171d23 (patch)
treed47516a818a8c61f288ce3889d8d47b5a2815516 /include/grpc++
parentb378b791e831bffc72567e5c488cece25b5d1d7a (diff)
Delete deprecated constructor and CallOpSetCollectionInterface
Diffstat (limited to 'include/grpc++')
-rw-r--r--include/grpc++/impl/codegen/async_unary_call.h92
-rw-r--r--include/grpc++/impl/codegen/call.h28
2 files changed, 23 insertions, 97 deletions
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index 6da64f0da1..f0f909686b 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -87,28 +87,6 @@ class ClientAsyncResponseReader final
ClientAsyncResponseReader(call, context, request);
}
- /// TODO(vjpai): Delete the below constructor
- /// PLEASE DO NOT USE THIS CONSTRUCTOR IN NEW CODE
- /// This code is only present as a short-term workaround
- /// for users that bypassed the code-generator and directly
- /// created this struct rather than properly using a stub.
- /// This code will not remain a valid public constructor for long.
- template <class W>
- ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
- const RpcMethod& method, ClientContext* context,
- const W& request)
- : context_(context),
- call_(channel->CreateCall(method, context, cq)),
- collection_(std::make_shared<Ops>()) {
- collection_->init_buf.SetCollection(collection_);
- collection_->init_buf.SendInitialMetadata(
- context->send_initial_metadata_, context->initial_metadata_flags());
- // TODO(ctiller): don't assert
- GPR_CODEGEN_ASSERT(collection_->init_buf.SendMessage(request).ok());
- collection_->init_buf.ClientSendClose();
- call_.PerformOps(&collection_->init_buf);
- }
-
// always allocated against a call arena, no memory free required
static void operator delete(void* ptr, std::size_t size) {
assert(size == sizeof(ClientAsyncResponseReader));
@@ -119,22 +97,13 @@ class ClientAsyncResponseReader final
///
/// Side effect:
/// - the \a ClientContext associated with this call is updated with
- /// possible initial and trailing metadata sent from the serve.
+ /// possible initial and trailing metadata sent from the server.
void ReadInitialMetadata(void* tag) {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
- Ops* o = &ops_;
-
- // TODO(vjpai): Remove the collection_ specialization as soon
- // as the public constructor is deleted
- if (collection_) {
- o = collection_.get();
- collection_->meta_buf.SetCollection(collection_);
- }
-
- o->meta_buf.set_output_tag(tag);
- o->meta_buf.RecvInitialMetadata(context_);
- call_.PerformOps(&o->meta_buf);
+ meta_buf.set_output_tag(tag);
+ meta_buf.RecvInitialMetadata(context_);
+ call_.PerformOps(&meta_buf);
}
/// See \a ClientAysncResponseReaderInterface::Finish for semantics.
@@ -143,23 +112,14 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(R* msg, Status* status, void* tag) {
- Ops* o = &ops_;
-
- // TODO(vjpai): Remove the collection_ specialization as soon
- // as the public constructor is deleted
- if (collection_) {
- o = collection_.get();
- collection_->finish_buf.SetCollection(collection_);
- }
-
- o->finish_buf.set_output_tag(tag);
+ finish_buf.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
- o->finish_buf.RecvInitialMetadata(context_);
+ finish_buf.RecvInitialMetadata(context_);
}
- o->finish_buf.RecvMessage(msg);
- o->finish_buf.AllowNoMessage();
- o->finish_buf.ClientRecvStatus(context_, status);
- call_.PerformOps(&o->finish_buf);
+ finish_buf.RecvMessage(msg);
+ finish_buf.AllowNoMessage();
+ finish_buf.ClientRecvStatus(context_, status);
+ call_.PerformOps(&finish_buf);
}
private:
@@ -169,33 +129,25 @@ class ClientAsyncResponseReader final
template <class W>
ClientAsyncResponseReader(Call call, ClientContext* context, const W& request)
: context_(context), call_(call) {
- ops_.init_buf.SendInitialMetadata(context->send_initial_metadata_,
- context->initial_metadata_flags());
+ init_buf.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
// TODO(ctiller): don't assert
- GPR_CODEGEN_ASSERT(ops_.init_buf.SendMessage(request).ok());
- ops_.init_buf.ClientSendClose();
- call_.PerformOps(&ops_.init_buf);
+ GPR_CODEGEN_ASSERT(init_buf.SendMessage(request).ok());
+ init_buf.ClientSendClose();
+ call_.PerformOps(&init_buf);
}
// disable operator new
static void* operator new(std::size_t size);
static void* operator new(std::size_t size, void* p) { return p; }
- // TODO(vjpai): Remove the reference to CallOpSetCollectionInterface
- // as soon as the related workaround (public constructor) is deleted
- struct Ops : public CallOpSetCollectionInterface {
- SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
- CallOpClientSendClose>
- init_buf;
- CallOpSet<CallOpRecvInitialMetadata> meta_buf;
- CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
- CallOpClientRecvStatus>
- finish_buf;
- } ops_;
-
- // TODO(vjpai): Remove the collection_ as soon as the related workaround
- // (public constructor) is deleted
- std::shared_ptr<Ops> collection_;
+ SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpClientSendClose>
+ init_buf;
+ CallOpSet<CallOpRecvInitialMetadata> meta_buf;
+ CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
+ CallOpClientRecvStatus>
+ finish_buf;
};
/// Async server-side API for handling unary calls, where the single
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index 33d8f4ce65..f45ab239fc 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -567,14 +567,6 @@ class CallOpClientRecvStatus {
grpc_slice error_message_;
};
-/// TODO(vjpai): Remove the existence of CallOpSetCollectionInterface
-/// and references to it. This code is deprecated-on-arrival and is
-/// only added for users that bypassed the code-generator.
-class CallOpSetCollectionInterface {
- public:
- virtual ~CallOpSetCollectionInterface() {}
-};
-
/// An abstract collection of call ops, used to generate the
/// grpc_call_op structure to pass down to the lower layers,
/// and as it is-a CompletionQueueTag, also massages the final
@@ -585,18 +577,6 @@ class CallOpSetInterface : public CompletionQueueTag {
/// Fills in grpc_op, starting from ops[*nops] and moving
/// upwards.
virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0;
-
- /// TODO(vjpai): Remove the SetCollection method and comment. This is only
- /// a short-term workaround for users that bypassed the code generator
- /// Mark this as belonging to a collection if needed
- void SetCollection(std::shared_ptr<CallOpSetCollectionInterface> collection) {
- collection_ = collection;
- }
-
- protected:
- /// TODO(vjpai): Remove the collection_ field once the idea of bypassing the
- /// code generator is forbidden. This is already deprecated
- std::shared_ptr<CallOpSetCollectionInterface> collection_;
};
/// Primary implementaiton of CallOpSetInterface.
@@ -637,13 +617,7 @@ class CallOpSet : public CallOpSetInterface,
this->Op6::FinishOp(status);
*tag = return_tag_;
- // TODO(vjpai): Remove the reference to collection_ once the idea of
- // bypassing the code generator is forbidden. It is already deprecated
- grpc_call* call = call_;
- collection_.reset();
-
- g_core_codegen_interface->grpc_call_unref(call);
-
+ g_core_codegen_interface->grpc_call_unref(call_);
return true;
}