C++ API for write-through

reviewable/pr11758/r1
Craig Tiller 8 years ago
parent 6ba448fb55
commit 9bebf8b22a
  1. 9
      include/grpc++/impl/codegen/call.h
  2. 16
      test/cpp/end2end/end2end_test.cc

@ -169,6 +169,15 @@ class WriteOptions {
return *this;
}
/// Guarantee that all bytes have been written to the wire before completing
/// this write (usually writes are completed when they pass flow control)
inline WriteOptions& set_write_through() {
SetBit(GRPC_WRITE_THROUGH);
return *this;
}
inline bool is_write_through() const { return GetBit(GRPC_WRITE_THROUGH); }
/// Get value for the flag indicating that this is the last message, and
/// should be coalesced with trailing metadata.
///

@ -731,6 +731,22 @@ TEST_P(End2endTest, RequestStreamTwoRequests) {
EXPECT_TRUE(s.ok());
}
TEST_P(End2endTest, RequestStreamTwoRequestsWithWriteThrough) {
ResetStub();
EchoRequest request;
EchoResponse response;
ClientContext context;
auto stream = stub_->RequestStream(&context, &response);
request.set_message("hello");
EXPECT_TRUE(stream->Write(request, WriteOptions().set_write_through()));
EXPECT_TRUE(stream->Write(request, WriteOptions().set_write_through()));
stream->WritesDone();
Status s = stream->Finish();
EXPECT_EQ(response.message(), "hellohello");
EXPECT_TRUE(s.ok());
}
TEST_P(End2endTest, RequestStreamTwoRequestsWithCoalescingApi) {
ResetStub();
EchoRequest request;

Loading…
Cancel
Save