| 
					
				 | 
			
			
				@@ -58,11 +58,31 @@ class ClientAsyncStreamingInterface { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void ReadInitialMetadata(void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// Indicate that the stream is to be finished and request notification 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// Should not be used concurrently with other operations 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Indicate that the stream is to be finished and request notification for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// when the call has been ended. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Should not be used concurrently with other operations. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// It is appropriate to call this method when both: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * the client side has no more message to send (this can be declared implicitly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     by calling this method, or explicitly through an earlier call to \a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     WritesDone. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * there are no more messages to be received from the server (which can 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     be known implicitly by the calling code, or known explicitly from an 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     earlier call to \a Read that yielded a failed result 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     (e.g. cq->Next(&read_tag, &ok) filled in 'ok' with 'false'. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This function will return when either: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// - all incoming messages have been read and the server has returned 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   a status. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// - the server has returned a non-OK status. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// - the call failed for some reason and the library generated a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   status. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note that implementations of this method attempt to receive initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// from the server if initial metadata hasn't yet been received. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// \param[out] status To be updated with the operation status. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[out] status To be updated with the operation status. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void Finish(Status* status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -82,6 +102,9 @@ class AsyncReaderInterface { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[out] msg Where to eventually store the read message. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[in] tag The tag identifying the operation. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: note that this method attempt to receive initial metadata for a stream if it 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// hasn't yet been received. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void Read(R* msg, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -140,10 +163,16 @@ template <class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    public AsyncReaderInterface<R> {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async client-side API for doing server-streaming RPCs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the incoming message stream coming from the server has messages of type \a R. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncReader final : public ClientAsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// Create a stream and write the first request out. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a tag will be notified on \a cq when the call has been started and 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a request has been written out. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note that \a context will be used to fill in custom initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// used to send to the server when starting the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   template <class W> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static ClientAsyncReader* Create(ChannelInterface* channel, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    CompletionQueue* cq, const RpcMethod& method, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -155,11 +184,19 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClientAsyncReader(call, context, request, tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static void operator delete(void* ptr, std::size_t size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     assert(size == sizeof(ClientAsyncReader)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.ReadInitialMetadata method for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - upon receiving initial metadata from the server, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     the \a ClientContext 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_CODEGEN_ASSERT(!context_->initial_metadata_received_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,6 +205,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncReaderInterface.Read method for semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Read(R* msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!context_->initial_metadata_received_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -177,6 +215,11 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&read_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.Finish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ClientContext associated with this call is updated with 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     possible initial and trailing metadata received from the server. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(Status* status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!context_->initial_metadata_received_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -214,16 +257,26 @@ template <class W> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    public AsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// Signal the client is done with the writes. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Signal the client is done with the writes (half-close the client stream). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// Thread-safe with respect to \a Read 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[in] tag The tag identifying the operation. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void WritesDone(void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async API to on the client side for doing client-streaming RPCs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the outgoing message stream going to the server contains messages of type \a W. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Create a stream and write the first request out. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a tag will be notified on \a cq when the call has been started (i.e. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// intitial metadata sent) and \a request has been written out. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note that \a context will be used to fill in custom initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// used to send to the server when starting the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a response will be filled in with the single expected response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// message from the server upon a successful call to the \a Finish 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// method of this instance. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   template <class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static ClientAsyncWriter* Create(ChannelInterface* channel, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    CompletionQueue* cq, const RpcMethod& method, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -235,11 +288,19 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClientAsyncWriter(call, context, response, tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static void operator delete(void* ptr, std::size_t size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     assert(size == sizeof(ClientAsyncWriter)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.ReadInitialMetadata method for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - upon receiving initial metadata from the server, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     the \a ClientContext 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_CODEGEN_ASSERT(!context_->initial_metadata_received_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -248,6 +309,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncWriterInterface.Write(const W& msg, void* tag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// method for semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // TODO(ctiller): don't assert 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -255,6 +318,9 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a AsyncWriterInterface.Write(const W& msg, WriteOptions options, void* tag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// method for semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, WriteOptions options, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (options.is_last_message()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -266,12 +332,21 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncWriterInterface.WritesDone method for semantics of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void WritesDone(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.ClientSendClose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.Finish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ClientContext associated with this call is updated with 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     possible initial and trailing metadata received from the server. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - attempts to fill in the \a response parameter passed to this class's 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     constructor with the server's response message. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(Status* status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!context_->initial_metadata_received_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -310,23 +385,33 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       finish_ops_; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/// Client-side interface for asynchronous bi-directional streaming. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async client-side interface for bi-directional streaming, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the client-to-server message stream has messages of type \a W, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// abnd the server-to-client message stream has messages of type \a R. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W, class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          public AsyncWriterInterface<W>, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          public AsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// Signal the client is done with the writes. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Signal the client is done with the writes (half-close the client stream). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// Thread-safe with respect to \a Read 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// \param[in] tag The tag identifying the operation. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void WritesDone(void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async client-side interface for bi-directional streaming, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the outgoing message stream going to the server has messages of type \a W, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// and the incoming message stream coming from the server has messages of type \a R. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W, class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     : public ClientAsyncReaderWriterInterface<W, R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Create a stream and write the first request out. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a tag will be notified on \a cq when the call has been started (i.e. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// intitial metadata sent). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note that \a context will be used to fill in custom initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// used to send to the server when starting the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static ClientAsyncReaderWriter* Create(ChannelInterface* channel, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          CompletionQueue* cq, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          const RpcMethod& method, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -338,11 +423,18 @@ class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClientAsyncReaderWriter(call, context, tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /// always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // always allocated against a call arena, no memory free required 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   static void operator delete(void* ptr, std::size_t size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     assert(size == sizeof(ClientAsyncReaderWriter)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.ReadInitialMetadata method 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// for semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - upon receiving initial metadata from the server, the \a ClientContext 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     is updated with it, and then the receiving initial metadata can 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     be accessed through this \a ClientContext 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void ReadInitialMetadata(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -351,6 +443,8 @@ class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See \a AsyncReaderInterface.Read method for semantics 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Read(R* msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!context_->initial_metadata_received_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,6 +454,8 @@ class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&read_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See \a AsyncWriterInterface.Write(const W& msg, void* tag) method for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // TODO(ctiller): don't assert 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -367,6 +463,8 @@ class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See \a AsyncWriterInterface.Write(const W& msg, WriteOptions options, void* tag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// method for semantics of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, WriteOptions options, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (options.is_last_message()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -378,12 +476,18 @@ class ClientAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See \a ClientAsyncReaderWriterInterface.WritesDone method for semantics 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// of this method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void WritesDone(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.ClientSendClose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ClientAsyncStreamingInterface.Finish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ClientContext associated with this call is updated with 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     possible initial and trailing metadata sent from the server. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(Status* status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!context_->initial_metadata_received_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -422,17 +526,66 @@ template <class W, class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    public AsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Indicate that the stream is to be finished with a certain status code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// and also send out \a msg response to the client. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification for when the server has sent the response and the appropriate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// signals to the client to end the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Should not be used concurrently with other operations. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// It is appropriate to call this method when: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * all messages from the client have been received (either known 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     implictly, or explicitly because a previous \a Read operation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with a non-ok result (e.g., cq->Next(&read_tag, &ok) filled in 'ok' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with 'false'. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This operation will end when the server has finished sending out initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// (if not sent already), repsonse message, and status, or if some failure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// occurred when trying to do so. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] status To be sent to the client as the result of this call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] msg To be sent to the client as the response for this call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void Finish(const W& msg, const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Indicate that the stream is to be finished with a certain non-OK status code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification for when the server has sent the appropriate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// signals to the client to end the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Should not be used concurrently with other operations. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This call is meant to end the call with some error, and can be called at 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// any point that the server would like to "fail" the call (though note 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// this shouldn't be called concurrently with any other "sending" call, like 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \a Write. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This operation will end when the server has finished sending out initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// (if not sent already), and status, or if some failure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// occurred when trying to do so. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] status To be sent to the client as the result of this call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     - Note: \a status must have a non-OK code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void FinishWithError(const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async server-side API for doing client-streaming RPCs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the incoming message stream from the client has messages of type \a R, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// and the single response message sent from the server is type \a W. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W, class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   explicit ServerAsyncReader(ServerContext* ctx) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification of the sending of initial metadata to the client. Completion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// will be notified by \a tag on the associated completion queue. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This call is optional, but if it is used, it cannot be used concurrently 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// with or after the \a Finish method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - The initial metadata that will be sent to the client from this op will be 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     taken from the \a ServerContext associated with the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void SendInitialMetadata(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -446,12 +599,21 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncReaderInterface.Read method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Read(R* msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.RecvMessage(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&read_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncReaderInterface.Read method for semantics 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - also sends initial metadata if not alreay sent. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - uses the \a ServerContext associated with this call to send possible 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     initial and trailing metadata. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note: \a msg is not sent if \a status has a non-OK code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(const W& msg, const Status& status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!ctx_->sent_initial_metadata_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -472,6 +634,12 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&finish_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncReaderInterface.Read method for semantics 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Side effect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - also sends initial metadata if not alreay sent. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - uses the \a ServerContext associated with this call to send possible 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     initial and trailing metadata. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void FinishWithError(const Status& status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     GPR_CODEGEN_ASSERT(!status.ok()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -503,6 +671,24 @@ template <class W> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    public AsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Indicate that the stream is to be finished with a certain status code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification for when the server has sent the appropriate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// signals to the client to end the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Should not be used concurrently with other operations. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// It is appropriate to call this method when either: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * all messages from the client have been received (either known 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     implictly, or explicitly because a previous \a Read operation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with a non-ok result (e.g., cq->Next(&read_tag, &ok) filled in 'ok' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with 'false'. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * it is desired to end the call early with some non-OK status code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This operation will end when the server has finished sending out initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// (if not sent already), repsonse message, and status, or if some failure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// occurred when trying to do so. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] status To be sent to the client as the result of this call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void Finish(const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// Request the writing of \a msg and coalesce it with trailing metadata which 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -520,12 +706,24 @@ class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async server-side API for doing server streaming RPCs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the outgoing message stream from the server has messages of type \a W. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   explicit ServerAsyncWriter(ServerContext* ctx) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification of the sending the initial metadata to the client. Completion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// will be notified by \a tag on the associated completion queue. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This call is optional, but if it is used, it cannot be used concurrently 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// with or after the \a Finish method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - The initial metadata that will be sent to the client from this op will be 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     taken from the \a ServerContext associated with the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void SendInitialMetadata(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -539,6 +737,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncWriterInterface.Write(const W &msg, void *tag) method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     EnsureInitialMetadataSent(&write_ops_); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -547,6 +746,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncWriterInterface.Write(const W &msg, WriteOptions options, void *tag) method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, WriteOptions options, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (options.is_last_message()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -559,6 +759,13 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncWriterInterface.WriteAndFinish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ServerContext associated with this call is used 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     for sending trailing (and initial) metadata to the client. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note: \a status must have an OK code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void WriteAndFinish(const W& msg, WriteOptions options, const Status& status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -569,6 +776,13 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncWriterInterface.Finish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ServerContext associated with this call is used 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     for sending trailing (and initial if not already sent) metadata to the client. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note: there are no restrictions are the code of \a status, it may be non-OK 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(const Status& status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     EnsureInitialMetadataSent(&finish_ops_); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -606,6 +820,24 @@ class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          public AsyncWriterInterface<W>, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                          public AsyncReaderInterface<R> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Indicate that the stream is to be finished with a certain status code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification for when the server has sent the appropriate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// signals to the client to end the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Should not be used concurrently with other operations. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// It is appropriate to call this method when either: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * all messages from the client have been received (either known 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     implictly, or explicitly because a previous \a Read operation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with a non-ok result (e.g., cq->Next(&read_tag, &ok) filled in 'ok' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     with 'false'. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   * it is desired to end the call early with some non-OK status code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This operation will end when the server has finished sending out initial metadata 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// (if not sent already), repsonse message, and status, or if some failure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// occurred when trying to do so. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] status To be sent to the client as the result of this call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   virtual void Finish(const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /// Request the writing of \a msg and coalesce it with trailing metadata which 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -623,6 +855,9 @@ class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               const Status& status, void* tag) = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Async server-side API for doing bidirectional streaming RPCs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// where the incoming message stream coming from the client has messages of type \a R, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// and the outgoing message stream coming from the server has messages of type \a W. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 template <class W, class R> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     : public ServerAsyncReaderWriterInterface<W, R> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -630,6 +865,16 @@ class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   explicit ServerAsyncReaderWriter(ServerContext* ctx) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Request notification of the sending the initial metadata to the client. Completion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// will be notified by \a tag on the associated completion queue. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// This call is optional, but if it is used, it cannot be used concurrently 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// with or after the \a Finish method. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - The initial metadata that will be sent to the client from this op will be 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     taken from the \a ServerContext associated with the call. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// \param[in] tag Tag identifying this request. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void SendInitialMetadata(void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -643,12 +888,14 @@ class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&meta_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncReaderInterface.Read method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Read(R* msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     read_ops_.RecvMessage(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&read_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncWriterInterface.Write(const W& msg, void* tag) method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     EnsureInitialMetadataSent(&write_ops_); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -657,6 +904,7 @@ class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a AsyncWriterInterface.Write(const W& msg, WriteOptions options, void* tag) method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Write(const W& msg, WriteOptions options, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (options.is_last_message()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -667,6 +915,13 @@ class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncReaderWriterInterface.WriteAndFinish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ServerContext associated with this call is used 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     for sending trailing (and initial) metadata to the client. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note: \a status must have an OK code. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void WriteAndFinish(const W& msg, WriteOptions options, const Status& status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     write_ops_.set_output_tag(tag); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -677,6 +932,13 @@ class ServerAsyncReaderWriter final 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     call_.PerformOps(&write_ops_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// See the \a ServerAsyncReaderWriterInterface.Finish method for semantics. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Implicit input parameter: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///   - the \a ServerContext associated with this call is used 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ///     for sending trailing (and initial if not already sent) metadata to the client. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /// Note: there are no restrictions are the code of \a status, it may be non-OK 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void Finish(const Status& status, void* tag) override { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     finish_ops_.set_output_tag(tag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     EnsureInitialMetadataSent(&finish_ops_); 
			 |