change last_message bit to be in C++ layer only

pull/9964/head
Yuxuan Li 8 years ago
parent 8124f66993
commit 0aac9d06e2
  1. 16
      include/grpc++/impl/codegen/call.h
  2. 6
      include/grpc/impl/codegen/grpc_types.h
  3. 2
      test/cpp/microbenchmarks/bm_fullstack.cc

@ -84,8 +84,9 @@ inline grpc_metadata* FillMetadataArray(
/// Per-message write options.
class WriteOptions {
public:
WriteOptions() : flags_(0) {}
WriteOptions(const WriteOptions& other) : flags_(other.flags_) {}
WriteOptions() : flags_(0), last_message_(false) {}
WriteOptions(const WriteOptions& other)
: flags_(other.flags_), last_message_(other.last_message_) {}
/// Clear all flags.
inline void Clear() { flags_ = 0; }
@ -160,19 +161,15 @@ class WriteOptions {
/// in a single step
/// server-side: hold the Write until the service handler returns (sync api)
/// or until Finish is called (async api)
///
/// \sa GRPC_WRITE_LAST_MESSAGE
inline WriteOptions& set_last_message() {
SetBit(GRPC_WRITE_LAST_MESSAGE);
last_message_ = true;
return *this;
}
/// Clears flag indicating that this is the last message in a stream,
/// disabling coalescing.
///
/// \sa GRPC_WRITE_LAST_MESSAGE
inline WriteOptions& clear_last_messsage() {
ClearBit(GRPC_WRITE_LAST_MESSAGE);
last_message_ = false;
return *this;
}
@ -180,7 +177,7 @@ class WriteOptions {
/// should be coalesced with trailing metadata.
///
/// \sa GRPC_WRITE_LAST_MESSAGE
bool is_last_message() const { return GetBit(GRPC_WRITE_LAST_MESSAGE); }
bool is_last_message() const { return last_message_; }
WriteOptions& operator=(const WriteOptions& rhs) {
flags_ = rhs.flags_;
@ -195,6 +192,7 @@ class WriteOptions {
bool GetBit(const uint32_t mask) const { return (flags_ & mask) != 0; }
uint32_t flags_;
bool last_message_;
};
/// Default argument for CallOpSet. I is unused by the class, but can be

@ -298,12 +298,8 @@ typedef enum grpc_call_error {
/** Force compression to be disabled for a particular write
(start_write/add_metadata). Illegal on invoke/accept. */
#define GRPC_WRITE_NO_COMPRESS (0x00000002u)
/** Force coalescing of last streaming message and trailing metadata into the
same core batch */
#define GRPC_WRITE_LAST_MESSAGE (0x00000004u)
/** Mask of all valid flags. */
#define GRPC_WRITE_USED_MASK \
(GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_LAST_MESSAGE)
#define GRPC_WRITE_USED_MASK (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS)
/* Initial metadata flags */
/** Signal that the call is idempotent */

@ -766,7 +766,7 @@ static void BM_StreamingPingPongMsgs(benchmark::State& state) {
// Second parameter (i.e state.range(1)): Number of ping pong messages.
// Note: One ping-pong means two messages (one from client to server and
// the other from server to client):
// Third parameter (i.e state.range(2)): Swtich between using WriteAndFinish
// Third parameter (i.e state.range(2)): Switch between using WriteAndFinish
// API and WriteLast API for server.
template <class Fixture, class ClientContextMutator, class ServerContextMutator>
static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) {

Loading…
Cancel
Save