修改pods

This commit is contained in:
2025-09-20 17:13:38 +08:00
parent 7787b3ee30
commit 28ff2b0264
5251 changed files with 345029 additions and 285168 deletions

View File

@@ -20,13 +20,14 @@
#define GRPCPP_SUPPORT_ASYNC_STREAM_H
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/service_type.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@@ -37,7 +38,11 @@ class ClientAsyncStreamingInterface {
/// Start the call that was set up by the constructor, but only if the
/// constructor was invoked through the "Prepare" API which doesn't actually
/// start the call
/// start the call.
///
/// It is illegal to start a write-type operation (eg. Write(), WriteLast(),
/// WritesDone()) while the `StartCall()` operation has not finished
/// (determined by the returning of \a tag).
virtual void StartCall(void* tag) = 0;
/// Request notification of the reading of the initial metadata. Completion
@@ -200,7 +205,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientAsyncReader));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncReader));
}
// This operator should never be called as the memory should be freed as part
@@ -208,10 +213,10 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
GPR_ASSERT(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@@ -225,8 +230,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
/// calling code can access the received metadata through the
/// \a ClientContext.
void ReadInitialMetadata(void* tag) override {
GPR_ASSERT(started_);
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@@ -234,7 +239,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
}
void Read(R* msg, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@@ -249,7 +254,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata received from the server.
void Finish(grpc::Status* status, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -265,12 +270,12 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
const W& request, bool start, void* tag)
: context_(context), call_(call), started_(start) {
// TODO(ctiller): don't assert
GPR_ASSERT(init_ops_.SendMessage(request).ok());
ABSL_CHECK(init_ops_.SendMessage(request).ok());
init_ops_.ClientSendClose();
if (start) {
StartCallInternal(tag);
} else {
GPR_ASSERT(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@@ -348,7 +353,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientAsyncWriter));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncWriter));
}
// This operator should never be called as the memory should be freed as part
@@ -356,10 +361,10 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
GPR_ASSERT(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@@ -372,8 +377,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
/// associated with this call is updated, and the calling code can access
/// the received metadata through the \a ClientContext.
void ReadInitialMetadata(void* tag) override {
GPR_ASSERT(started_);
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@@ -381,27 +386,27 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
}
void Write(const W& msg, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
if (options.is_last_message()) {
options.set_buffer_hint();
write_ops_.ClientSendClose();
}
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
write_ops_.ClientSendClose();
call_.PerformOps(&write_ops_);
@@ -415,7 +420,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
/// - attempts to fill in the \a response parameter passed to this class's
/// constructor with the server's response message.
void Finish(grpc::Status* status, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -435,7 +440,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
if (start) {
StartCallInternal(tag);
} else {
GPR_ASSERT(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@@ -515,7 +520,7 @@ class ClientAsyncReaderWriter final
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientAsyncReaderWriter));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncReaderWriter));
}
// This operator should never be called as the memory should be freed as part
@@ -523,10 +528,10 @@ class ClientAsyncReaderWriter final
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
GPR_ASSERT(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@@ -539,8 +544,8 @@ class ClientAsyncReaderWriter final
/// is updated with it, and then the receiving initial metadata can
/// be accessed through this \a ClientContext.
void ReadInitialMetadata(void* tag) override {
GPR_ASSERT(started_);
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@@ -548,7 +553,7 @@ class ClientAsyncReaderWriter final
}
void Read(R* msg, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@@ -558,27 +563,27 @@ class ClientAsyncReaderWriter final
}
void Write(const W& msg, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
if (options.is_last_message()) {
options.set_buffer_hint();
write_ops_.ClientSendClose();
}
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
write_ops_.ClientSendClose();
call_.PerformOps(&write_ops_);
@@ -589,7 +594,7 @@ class ClientAsyncReaderWriter final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(grpc::Status* status, void* tag) override {
GPR_ASSERT(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -606,7 +611,7 @@ class ClientAsyncReaderWriter final
if (start) {
StartCallInternal(tag);
} else {
GPR_ASSERT(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@@ -706,7 +711,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// - The initial metadata that will be sent to the client from this op will
/// be taken from the \a ServerContext associated with the call.
void SendInitialMetadata(void* tag) override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -765,7 +770,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// gRPC doesn't take ownership or a reference to \a status, so it is safe to
/// to deallocate once FinishWithError returns.
void FinishWithError(const grpc::Status& status, void* tag) override {
GPR_ASSERT(!status.ok());
ABSL_CHECK(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -855,7 +860,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -871,7 +876,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@@ -883,7 +888,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
@@ -902,7 +907,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint();
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
call_.PerformOps(&write_ops_);
}
@@ -1021,7 +1026,7 @@ class ServerAsyncReaderWriter final
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -1043,7 +1048,7 @@ class ServerAsyncReaderWriter final
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
GPR_ASSERT(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@@ -1053,7 +1058,7 @@ class ServerAsyncReaderWriter final
options.set_buffer_hint();
}
EnsureInitialMetadataSent(&write_ops_);
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
@@ -1073,7 +1078,7 @@ class ServerAsyncReaderWriter final
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint();
GPR_ASSERT(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
call_.PerformOps(&write_ops_);
}

View File

@@ -20,7 +20,6 @@
#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
@@ -30,6 +29,8 @@
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
// Forward declaration for use in Helper class
@@ -130,7 +131,7 @@ class ClientAsyncResponseReaderHelper {
new (grpc_call_arena_alloc(call, sizeof(SingleBufType))) SingleBufType;
*single_buf_ptr = single_buf;
// TODO(ctiller): don't assert
GPR_ASSERT(single_buf->SendMessage(request).ok());
ABSL_CHECK(single_buf->SendMessage(request).ok());
single_buf->ClientSendClose();
// The purpose of the following functions is to type-erase the actual
@@ -220,7 +221,7 @@ class ClientAsyncResponseReader final
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientAsyncResponseReader));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncResponseReader));
}
// This operator should never be called as the memory should be freed as part
@@ -228,10 +229,10 @@ class ClientAsyncResponseReader final
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
GPR_DEBUG_ASSERT(!started_);
ABSL_DCHECK(!started_);
started_ = true;
internal::ClientAsyncResponseReaderHelper::StartCall(context_, single_buf_);
}
@@ -243,8 +244,8 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void ReadInitialMetadata(void* tag) override {
GPR_DEBUG_ASSERT(started_);
GPR_DEBUG_ASSERT(!context_->initial_metadata_received_);
ABSL_DCHECK(started_);
ABSL_DCHECK(!context_->initial_metadata_received_);
read_initial_metadata_(context_, &call_, single_buf_, tag);
initial_metadata_read_ = true;
}
@@ -255,7 +256,7 @@ 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, grpc::Status* status, void* tag) override {
GPR_DEBUG_ASSERT(started_);
ABSL_DCHECK(started_);
finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_,
static_cast<void*>(msg), status, tag);
}
@@ -304,7 +305,7 @@ class ServerAsyncResponseWriter final
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag);
meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -373,7 +374,7 @@ class ServerAsyncResponseWriter final
/// deallocate them once the Finish operation is complete (i.e. a result
/// arrives in the completion queue).
void FinishWithError(const grpc::Status& status, void* tag) {
GPR_ASSERT(!status.ok());
ABSL_CHECK(!status.ok());
finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_,

View File

@@ -19,16 +19,15 @@
#ifndef GRPCPP_SUPPORT_BYTE_BUFFER_H
#define GRPCPP_SUPPORT_BYTE_BUFFER_H
#include <vector>
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
#include <vector>
namespace grpc {
class ServerInterface;
@@ -59,7 +58,7 @@ class GrpcByteBufferPeer;
/// A sequence of bytes.
class ByteBuffer final {
public:
/// Constuct an empty buffer.
/// Construct an empty buffer.
ByteBuffer() : buffer_(nullptr) {}
/// Construct buffer from \a slices, of which there are \a nslices.

View File

@@ -19,17 +19,19 @@
#ifndef GRPCPP_SUPPORT_CALLBACK_COMMON_H
#define GRPCPP_SUPPORT_CALLBACK_COMMON_H
#include <functional>
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/global_callback_hook.h>
#include <grpcpp/support/status.h>
#include <functional>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@@ -71,7 +73,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(CallbackWithStatusTag));
ABSL_CHECK_EQ(size, sizeof(CallbackWithStatusTag));
}
// This operator should never be called as the memory should be freed as part
@@ -79,7 +81,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
CallbackWithStatusTag(grpc_call* call, std::function<void(Status)> f,
CompletionQueueTag* ops)
@@ -118,14 +120,25 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
// The tag was swallowed
return;
}
GPR_ASSERT(ignored == ops_);
ABSL_CHECK(ignored == ops_);
// Last use of func_ or status_, so ok to move them out
auto func = std::move(func_);
auto status = std::move(status_);
func_ = nullptr; // reset to clear this out for sure
status_ = Status(); // reset to clear this out for sure
CatchingCallback(std::move(func), std::move(status));
GetGlobalCallbackHook()->RunCallback(
call_, [func = std::move(func), status = std::move(status)]() {
#if GRPC_ALLOW_EXCEPTIONS
try {
func(status);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func(status);
#endif // GRPC_ALLOW_EXCEPTIONS
});
grpc_call_unref(call_);
}
};
@@ -137,7 +150,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(CallbackWithSuccessTag));
ABSL_CHECK_EQ(size, sizeof(CallbackWithSuccessTag));
}
// This operator should never be called as the memory should be freed as part
@@ -145,7 +158,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
CallbackWithSuccessTag() : call_(nullptr) {}
@@ -162,7 +175,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
// callbacks.
void Set(grpc_call* call, std::function<void(bool)> f,
CompletionQueueTag* ops, bool can_inline) {
GPR_ASSERT(call_ == nullptr);
ABSL_CHECK_EQ(call_, nullptr);
grpc_call_ref(call);
call_ = call;
func_ = std::move(f);
@@ -207,10 +220,22 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
auto* ops = ops_;
#endif
bool do_callback = ops_->FinalizeResult(&ignored, &ok);
GPR_DEBUG_ASSERT(ignored == ops);
#ifndef NDEBUG
ABSL_DCHECK(ignored == ops);
#endif
if (do_callback) {
CatchingCallback(func_, ok);
GetGlobalCallbackHook()->RunCallback(call_, [this, ok]() {
#if GRPC_ALLOW_EXCEPTIONS
try {
func_(ok);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func_(ok);
#endif // GRPC_ALLOW_EXCEPTIONS
});
}
}
};

View File

@@ -19,16 +19,16 @@
#ifndef GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H
#define GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H
#include <list>
#include <vector>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpcpp/resource_quota.h>
#include <grpcpp/support/config.h>
#include <list>
#include <vector>
namespace grpc {
class SecureChannelCredentials;
class ChannelCredentials;
namespace testing {
class ChannelArgumentsTest;
} // namespace testing
@@ -120,7 +120,7 @@ class ChannelArguments {
}
private:
friend class grpc::SecureChannelCredentials;
friend class grpc::ChannelCredentials;
friend class grpc::testing::ChannelArgumentsTest;
/// Default pointer argument operations.

View File

@@ -19,12 +19,8 @@
#ifndef GRPCPP_SUPPORT_CLIENT_CALLBACK_H
#define GRPCPP_SUPPORT_CLIENT_CALLBACK_H
#include <atomic>
#include <functional>
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/sync.h>
@@ -32,6 +28,11 @@
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <atomic>
#include <functional>
#include "absl/log/absl_check.h"
namespace grpc {
class Channel;
class ClientContext;
@@ -70,7 +71,7 @@ class CallbackUnaryCallImpl {
const InputMessage* request, OutputMessage* result,
std::function<void(grpc::Status)> on_completion) {
grpc::CompletionQueue* cq = channel->CallbackCQ();
GPR_ASSERT(cq != nullptr);
ABSL_CHECK_NE(cq, nullptr);
grpc::internal::Call call(channel->CreateCall(method, context, cq));
using FullCallOpSet = grpc::internal::CallOpSet<
@@ -304,7 +305,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// The argument to AddMultipleHolds must be positive.
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
GPR_DEBUG_ASSERT(holds > 0);
ABSL_DCHECK_GT(holds, 0);
stream_->AddHold(holds);
}
void RemoveHold() { stream_->RemoveHold(); }
@@ -324,21 +325,20 @@ class ClientBidiReactor : public internal::ClientReactor {
/// call of OnReadDone or OnDone.
///
/// \param[in] ok Was the initial metadata read successfully? If false, no
/// new read/write operation will succeed, and any further
/// Start* operations should not be called.
/// new read/write operation will succeed.
virtual void OnReadInitialMetadataDone(bool /*ok*/) {}
/// Notifies the application that a StartRead operation completed.
///
/// \param[in] ok Was it successful? If false, no new read/write operation
/// will succeed, and any further Start* should not be called.
/// will succeed.
virtual void OnReadDone(bool /*ok*/) {}
/// Notifies the application that a StartWrite or StartWriteLast operation
/// completed.
///
/// \param[in] ok Was it successful? If false, no new read/write operation
/// will succeed, and any further Start* should not be called.
/// will succeed.
virtual void OnWriteDone(bool /*ok*/) {}
/// Notifies the application that a StartWritesDone operation completed. Note
@@ -368,7 +368,7 @@ class ClientReadReactor : public internal::ClientReactor {
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
GPR_DEBUG_ASSERT(holds > 0);
ABSL_DCHECK_GT(holds, 0);
reader_->AddHold(holds);
}
void RemoveHold() { reader_->RemoveHold(); }
@@ -400,7 +400,7 @@ class ClientWriteReactor : public internal::ClientReactor {
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
GPR_DEBUG_ASSERT(holds > 0);
ABSL_DCHECK_GT(holds, 0);
writer_->AddHold(holds);
}
void RemoveHold() { writer_->RemoveHold(); }
@@ -461,7 +461,7 @@ class ClientCallbackReaderWriterImpl
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientCallbackReaderWriterImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl));
}
// This operator should never be called as the memory should be freed as part
@@ -469,7 +469,7 @@ class ClientCallbackReaderWriterImpl
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override {
// This call initiates two batches, plus any backlog, each with a callback
@@ -527,7 +527,7 @@ class ClientCallbackReaderWriterImpl
write_ops_.ClientSendClose();
}
// TODO(vjpai): don't assert
GPR_ASSERT(write_ops_.SendMessagePtr(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok());
callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed);
if (GPR_UNLIKELY(corked_write_needed_)) {
write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
@@ -719,7 +719,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientCallbackReaderImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderImpl));
}
// This operator should never be called as the memory should be freed as part
@@ -727,7 +727,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
// This call initiates two batches, plus any backlog, each with a callback
@@ -804,7 +804,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
// TODO(vjpai): don't assert
GPR_ASSERT(start_ops_.SendMessagePtr(request).ok());
ABSL_CHECK(start_ops_.SendMessagePtr(request).ok());
start_ops_.ClientSendClose();
}
@@ -880,7 +880,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientCallbackWriterImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackWriterImpl));
}
// This operator should never be called as the memory should be freed as part
@@ -888,7 +888,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override {
// This call initiates two batches, plus any backlog, each with a callback
@@ -929,7 +929,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
write_ops_.ClientSendClose();
}
// TODO(vjpai): don't assert
GPR_ASSERT(write_ops_.SendMessagePtr(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok());
callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed);
if (GPR_UNLIKELY(corked_write_needed_)) {
@@ -1110,7 +1110,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
GPR_ASSERT(size == sizeof(ClientCallbackUnaryImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl));
}
// This operator should never be called as the memory should be freed as part
@@ -1118,7 +1118,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { GPR_ASSERT(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
// This call initiates two batches, each with a callback
@@ -1157,7 +1157,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
// TODO(vjpai): don't assert
GPR_ASSERT(start_ops_.SendMessagePtr(request).ok());
ABSL_CHECK(start_ops_.SendMessagePtr(request).ok());
start_ops_.ClientSendClose();
finish_ops_.RecvMessage(response);
finish_ops_.AllowNoMessage();

View File

@@ -19,14 +19,15 @@
#ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
#include <memory>
#include <vector>
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/string_ref.h>
#include <memory>
#include <vector>
#include "absl/log/absl_check.h"
namespace grpc {
class Channel;
@@ -139,7 +140,7 @@ class ClientRpcInfo {
// Runs interceptor at pos \a pos.
void RunInterceptor(
experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) {
GPR_ASSERT(pos < interceptors_.size());
ABSL_CHECK_LT(pos, interceptors_.size());
interceptors_[pos]->Intercept(interceptor_methods);
}

View File

@@ -35,7 +35,7 @@ namespace grpc {
// Using grpc::string and grpc::to_string is discouraged in favor of
// std::string and std::to_string. This is only for legacy code using
// them explictly.
// them explicitly.
using std::string; // deprecated // NOLINT(misc-unused-using-decls)
using std::to_string; // deprecated // NOLINT(misc-unused-using-decls)

View File

@@ -0,0 +1,58 @@
// Copyright 2024 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H
#define GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H
#include "absl/functional/function_ref.h"
struct grpc_call;
namespace grpc {
class GlobalCallbackHook {
public:
virtual ~GlobalCallbackHook() = default;
virtual void RunCallback(grpc_call* call,
absl::FunctionRef<void()> callback) = 0;
protected:
// An exception-safe way of invoking a user-specified callback function.
template <class Func, class... Args>
void CatchingCallback(Func&& func, Args&&... args) {
#if GRPC_ALLOW_EXCEPTIONS
try {
func(std::forward<Args>(args)...);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func(std::forward<Args>(args)...);
#endif // GRPC_ALLOW_EXCEPTIONS
}
};
class DefaultGlobalCallbackHook final : public GlobalCallbackHook {
public:
void RunCallback(grpc_call* call,
absl::FunctionRef<void()> callback) override {
CatchingCallback(callback);
}
};
std::shared_ptr<GlobalCallbackHook> GetGlobalCallbackHook();
void SetGlobalCallbackHook(GlobalCallbackHook* hook);
} // namespace grpc
#endif // GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H

View File

@@ -19,16 +19,16 @@
#ifndef GRPCPP_SUPPORT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_INTERCEPTOR_H
#include <map>
#include <memory>
#include <string>
#include <grpc/impl/grpc_types.h>
#include <grpcpp/impl/metadata_map.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/string_ref.h>
#include <map>
#include <memory>
#include <string>
namespace grpc {
class ChannelInterface;
@@ -133,7 +133,7 @@ class InterceptorBatchMethods {
/// means that the payload would be available in the serialized form only
/// unless an interceptor replaces the payload with ModifySendMessage.
/// Returns a modifable ByteBuffer holding the serialized form of the message
/// Returns a modifiable ByteBuffer holding the serialized form of the message
/// that is going to be sent. Valid for PRE_SEND_MESSAGE interceptions.
/// A return value of nullptr indicates that this ByteBuffer is not valid.
virtual ByteBuffer* GetSerializedSendMessage() = 0;

View File

@@ -20,11 +20,12 @@
#define GRPCPP_SUPPORT_METHOD_HANDLER_H
#include <grpc/byte_buffer.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_service_method.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/sync_stream.h>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@@ -57,7 +58,7 @@ template <class Callable>
template <class ResponseType>
void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param,
ResponseType* rsp, grpc::Status& status) {
GPR_ASSERT(!param.server_context->sent_initial_metadata_);
ABSL_CHECK(!param.server_context->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus>

View File

@@ -19,20 +19,20 @@
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
#include <type_traits>
#include "absl/strings/cord.h"
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/status.h>
#include <type_traits>
#include "absl/log/absl_check.h"
#include "absl/strings/cord.h"
/// This header provides an object that reads bytes directly from a
/// grpc::ByteBuffer, via the ZeroCopyInputStream interface
@@ -75,7 +75,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
if (backup_count_ > 0) {
*data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) -
backup_count_;
GPR_ASSERT(backup_count_ <= INT_MAX);
ABSL_CHECK_LE(backup_count_, INT_MAX);
*size = static_cast<int>(backup_count_);
backup_count_ = 0;
return true;
@@ -86,7 +86,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
}
*data = GRPC_SLICE_START_PTR(*slice_);
// On win x64, int is only 32bit
GPR_ASSERT(GRPC_SLICE_LENGTH(*slice_) <= INT_MAX);
ABSL_CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast<size_t>(INT_MAX));
byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(*slice_));
return true;
}
@@ -98,7 +98,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
/// bytes that have already been returned by the last call of Next.
/// So do the backup and have that ready for a later Next.
void BackUp(int count) override {
GPR_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(*slice_)));
ABSL_CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(*slice_)));
backup_count_ = count;
}
@@ -174,7 +174,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
return true;
}
}
GPR_ASSERT(count == 0);
ABSL_CHECK_EQ(count, 0);
return true;
}
#endif // GRPC_PROTOBUF_CORD_SUPPORT_ENABLED

View File

@@ -19,20 +19,20 @@
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
#include <type_traits>
#include "absl/strings/cord.h"
#include <grpc/byte_buffer.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/status.h>
#include <type_traits>
#include "absl/log/absl_check.h"
#include "absl/strings/cord.h"
/// This header provides an object that writes bytes directly into a
/// grpc::ByteBuffer, via the ZeroCopyOutputStream interface
@@ -64,7 +64,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
total_size_(total_size),
byte_count_(0),
have_backup_(false) {
GPR_ASSERT(!byte_buffer->Valid());
ABSL_CHECK(!byte_buffer->Valid());
/// Create an empty raw byte buffer and look at its underlying slice buffer
grpc_byte_buffer* bp = grpc_raw_byte_buffer_create(nullptr, 0);
byte_buffer->set_buffer(bp);
@@ -81,7 +81,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
/// safe for the caller to write from data[0, size - 1].
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
GPR_ASSERT(byte_count_ < total_size_);
ABSL_CHECK_LT(byte_count_, total_size_);
// 1. Use the remaining backup slice if we have one
// 2. Otherwise allocate a slice, up to the remaining length needed
// or our maximum allocation size
@@ -106,7 +106,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
GPR_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
ABSL_CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast<size_t>(INT_MAX));
byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(slice_));
// Using grpc_slice_buffer_add could modify slice_ and merge it with the
// previous slice. Therefore, use grpc_slice_buffer_add_indexed method to
@@ -131,7 +131,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
/// 2. Split it into the needed (if any) and unneeded part
/// 3. Add the needed part back to the slice buffer
/// 4. Mark that we still have the remaining part (for later use/unref)
GPR_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
ABSL_CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
grpc_slice_buffer_pop(slice_buffer_);
if (static_cast<size_t>(count) == GRPC_SLICE_LENGTH(slice_)) {
backup_slice_ = slice_;

View File

@@ -19,10 +19,7 @@
#ifndef GRPCPP_SUPPORT_SERVER_CALLBACK_H
#define GRPCPP_SUPPORT_SERVER_CALLBACK_H
#include <atomic>
#include <functional>
#include <type_traits>
#include <grpc/impl/call.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/sync.h>
@@ -31,6 +28,12 @@
#include <grpcpp/support/message_allocator.h>
#include <grpcpp/support/status.h>
#include <atomic>
#include <functional>
#include <type_traits>
#include "absl/functional/any_invocable.h"
namespace grpc {
// Declare base class of all reactors as internal
@@ -127,6 +130,12 @@ class ServerCallbackCall {
private:
virtual ServerReactor* reactor() = 0;
virtual grpc_call* call() = 0;
virtual void RunAsync(absl::AnyInvocable<void()> cb) {
grpc_call_run_in_event_engine(call(), std::move(cb));
}
// CallOnDone performs the work required at completion of the RPC: invoking
// the OnDone function and doing all necessary cleanup. This function is only
// ever invoked on a fully-Unref'fed ServerCallbackCall.

View File

@@ -19,14 +19,15 @@
#ifndef GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
#define GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
#include <atomic>
#include <vector>
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/string_ref.h>
#include <atomic>
#include <vector>
#include "absl/log/absl_check.h"
namespace grpc {
class ServerContextBase;
namespace internal {
@@ -100,7 +101,7 @@ class ServerRpcInfo {
// Runs interceptor at pos \a pos.
void RunInterceptor(
experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) {
GPR_ASSERT(pos < interceptors_.size());
ABSL_CHECK_LT(pos, interceptors_.size());
interceptors_[pos]->Intercept(interceptor_methods);
}

View File

@@ -19,6 +19,7 @@
#ifndef GRPCPP_SUPPORT_STRING_REF_H
#define GRPCPP_SUPPORT_STRING_REF_H
#include <grpcpp/support/config.h>
#include <string.h>
#include <algorithm>
@@ -26,8 +27,6 @@
#include <iostream>
#include <iterator>
#include <grpcpp/support/config.h>
namespace grpc {
/// This class is a non owning reference to a string.

View File

@@ -19,7 +19,6 @@
#ifndef GRPCPP_SUPPORT_SYNC_STREAM_H
#define GRPCPP_SUPPORT_SYNC_STREAM_H
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
@@ -28,6 +27,8 @@
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@@ -184,7 +185,7 @@ class ClientReader final : public ClientReaderInterface<R> {
/// the server will be accessible through the \a ClientContext used to
/// construct this object.
void WaitForInitialMetadata() override {
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@@ -230,7 +231,7 @@ class ClientReader final : public ClientReaderInterface<R> {
grpc::Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
GPR_ASSERT(cq_.Pluck(&ops));
ABSL_CHECK(cq_.Pluck(&ops));
return status;
}
@@ -259,7 +260,7 @@ class ClientReader final : public ClientReaderInterface<R> {
ops.SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_ASSERT(ops.SendMessagePtr(&request).ok());
ABSL_CHECK(ops.SendMessagePtr(&request).ok());
ops.ClientSendClose();
call_.PerformOps(&ops);
cq_.Pluck(&ops);
@@ -306,7 +307,7 @@ class ClientWriter : public ClientWriterInterface<W> {
/// Once complete, the initial metadata read from the server will be
/// accessible through the \a ClientContext used to construct this object.
void WaitForInitialMetadata() {
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@@ -364,7 +365,7 @@ class ClientWriter : public ClientWriterInterface<W> {
}
finish_ops_.ClientRecvStatus(context_, &status);
call_.PerformOps(&finish_ops_);
GPR_ASSERT(cq_.Pluck(&finish_ops_));
ABSL_CHECK(cq_.Pluck(&finish_ops_));
return status;
}
@@ -455,7 +456,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// Once complete, the initial metadata read from the server will be
/// accessible through the \a ClientContext used to construct this object.
void WaitForInitialMetadata() override {
GPR_ASSERT(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@@ -536,7 +537,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
grpc::Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
GPR_ASSERT(cq_.Pluck(&ops));
ABSL_CHECK(cq_.Pluck(&ops));
return status;
}
@@ -583,7 +584,7 @@ class ServerReader final : public ServerReaderInterface<R> {
/// for semantics. Note that initial metadata will be affected by the
/// \a ServerContext associated with this call.
void SendInitialMetadata() override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -640,7 +641,7 @@ class ServerWriter final : public ServerWriterInterface<W> {
/// Note that initial metadata will be affected by the
/// \a ServerContext associated with this call.
void SendInitialMetadata() override {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,
@@ -713,7 +714,7 @@ class ServerReaderWriterBody final {
: call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,

View File

@@ -19,11 +19,11 @@
#ifndef GRPCPP_SUPPORT_TIME_H
#define GRPCPP_SUPPORT_TIME_H
#include <chrono>
#include <grpc/impl/grpc_types.h>
#include <grpcpp/support/config.h>
#include <chrono>
namespace grpc {
/// If you are trying to use CompletionQueue::AsyncNext with a time class that