Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
grpc::ServerBidiReactor< Request, Response > Class Template Referenceabstract

ServerBidiReactor is the interface for a bidirectional streaming RPC. More...

#include <server_callback.h>

Classes

struct  PreBindBacklog
 

Public Member Functions

void Finish (grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_)
 
void OnCancel () override
 
void OnDone () override=0
 
virtual void OnReadDone (bool)
 
virtual void OnSendInitialMetadataDone (bool)
 
virtual void OnWriteDone (bool)
 
 ServerBidiReactor ()
 
void StartRead (Request *req) ABSL_LOCKS_EXCLUDED(stream_mu_)
 
void StartSendInitialMetadata () ABSL_LOCKS_EXCLUDED(stream_mu_)
 
void StartWrite (const Response *resp)
 
void StartWrite (const Response *resp, grpc::WriteOptions options) ABSL_LOCKS_EXCLUDED(stream_mu_)
 
void StartWriteAndFinish (const Response *resp, grpc::WriteOptions options, grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_)
 
void StartWriteLast (const Response *resp, grpc::WriteOptions options)
 
 ~ServerBidiReactor () override=default
 

Private Member Functions

PreBindBacklog backlog_ ABSL_GUARDED_BY (stream_mu_)
 
virtual void InternalBindStream (ServerCallbackReaderWriter< Request, Response > *stream)
 

Private Attributes

std::atomic< ServerCallbackReaderWriter< Request, Response > * > stream_ {nullptr}
 
grpc::internal::Mutex stream_mu_
 

Friends

class ServerCallbackReaderWriter< Request, Response >
 

Detailed Description

template<class Request, class Response>
class grpc::ServerBidiReactor< Request, Response >

ServerBidiReactor is the interface for a bidirectional streaming RPC.

Definition at line 188 of file impl/codegen/server_callback.h.

Constructor & Destructor Documentation

◆ ServerBidiReactor()

template<class Request , class Response >
grpc::ServerBidiReactor< Request, Response >::ServerBidiReactor ( )
inline

Definition at line 277 of file impl/codegen/server_callback.h.

◆ ~ServerBidiReactor()

template<class Request , class Response >
grpc::ServerBidiReactor< Request, Response >::~ServerBidiReactor ( )
overridedefault

Member Function Documentation

◆ ABSL_GUARDED_BY()

template<class Request , class Response >
PreBindBacklog backlog_ grpc::ServerBidiReactor< Request, Response >::ABSL_GUARDED_BY ( stream_mu_  )
private

◆ Finish()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::Finish ( grpc::Status  s)
inline

Indicate that the stream is to be finished and the trailing metadata and RPC status are to be sent. Every RPC MUST be finished using either Finish or StartWriteAndFinish (but not both), even if the RPC is already cancelled.

Parameters
[in]sThe status outcome of this RPC

Definition at line 395 of file impl/codegen/server_callback.h.

◆ InternalBindStream()

template<class Request , class Response >
virtual void grpc::ServerBidiReactor< Request, Response >::InternalBindStream ( ServerCallbackReaderWriter< Request, Response > *  stream)
inlineprivatevirtual

Definition at line 445 of file impl/codegen/server_callback.h.

◆ OnCancel()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::OnCancel ( )
inlineoverride

Notifies the application that this RPC has been cancelled. This is an override (from the internal base class) but not final, so derived classes should override it if they want to take action.

Definition at line 439 of file impl/codegen/server_callback.h.

◆ OnDone()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::OnDone ( )
overridepure virtual

Notifies the application that all operations associated with this RPC have completed. This is an override (from the internal base class) but still abstract, so derived classes MUST override it to be instantiated.

◆ OnReadDone()

template<class Request , class Response >
virtual void grpc::ServerBidiReactor< Request, Response >::OnReadDone ( bool  )
inlinevirtual

Notifies the application that a StartRead operation completed.

Parameters
[in]okWas it successful? If false, no further read-side operation will succeed.

Definition at line 422 of file impl/codegen/server_callback.h.

◆ OnSendInitialMetadataDone()

template<class Request , class Response >
virtual void grpc::ServerBidiReactor< Request, Response >::OnSendInitialMetadataDone ( bool  )
inlinevirtual

Notifies the application that an explicit StartSendInitialMetadata operation completed. Not used when the sending of initial metadata piggybacks onto the first write.

Parameters
[in]okWas it successful? If false, no further write-side operation will succeed.

Definition at line 416 of file impl/codegen/server_callback.h.

◆ OnWriteDone()

template<class Request , class Response >
virtual void grpc::ServerBidiReactor< Request, Response >::OnWriteDone ( bool  )
inlinevirtual

Notifies the application that a StartWrite (or StartWriteLast) operation completed.

Parameters
[in]okWas it successful? If false, no further write-side operation will succeed.

Definition at line 429 of file impl/codegen/server_callback.h.

◆ StartRead()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartRead ( Request *  req)
inline

Initiate a read operation.

Parameters
[out]reqWhere to eventually store the read message. Valid when the library calls OnReadDone

Definition at line 301 of file impl/codegen/server_callback.h.

◆ StartSendInitialMetadata()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartSendInitialMetadata ( )
inline

Send any initial metadata stored in the RPC context. If not invoked, any initial metadata will be passed along with the first Write or the Finish (if there are no writes).

Definition at line 283 of file impl/codegen/server_callback.h.

◆ StartWrite() [1/2]

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartWrite ( const Response *  resp)
inline

Initiate a write operation.

Parameters
[in]respThe message to be written. The library does not take ownership but the caller must ensure that the message is not deleted or modified until OnWriteDone is called.

Definition at line 320 of file impl/codegen/server_callback.h.

◆ StartWrite() [2/2]

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartWrite ( const Response *  resp,
grpc::WriteOptions  options 
)
inline

Initiate a write operation with specified options.

Parameters
[in]respThe message to be written. The library does not take ownership but the caller must ensure that the message is not deleted or modified until OnWriteDone is called.
[in]optionsThe WriteOptions to use for writing this message

Definition at line 330 of file impl/codegen/server_callback.h.

◆ StartWriteAndFinish()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartWriteAndFinish ( const Response *  resp,
grpc::WriteOptions  options,
grpc::Status  s 
)
inline

Initiate a write operation with specified options and final RPC Status, which also causes any trailing metadata for this RPC to be sent out. StartWriteAndFinish is like merging StartWriteLast and Finish into a single step. A key difference, though, is that this operation doesn't have an OnWriteDone reaction - it is considered complete only when OnDone is available. An RPC can either have StartWriteAndFinish or Finish, but not both.

Parameters
[in]respThe message to be written. The library does not take ownership but the caller must ensure that the message is not deleted or modified until OnDone is called.
[in]optionsThe WriteOptions to use for writing this message
[in]sThe status outcome of this RPC

Definition at line 359 of file impl/codegen/server_callback.h.

◆ StartWriteLast()

template<class Request , class Response >
void grpc::ServerBidiReactor< Request, Response >::StartWriteLast ( const Response *  resp,
grpc::WriteOptions  options 
)
inline

Inform system of a planned write operation with specified options, but allow the library to schedule the actual write coalesced with the writing of trailing metadata (which takes place on a Finish call).

Parameters
[in]respThe message to be written. The library does not take ownership but the caller must ensure that the message is not deleted or modified until OnWriteDone is called.
[in]optionsThe WriteOptions to use for writing this message

Definition at line 385 of file impl/codegen/server_callback.h.

Friends And Related Function Documentation

◆ ServerCallbackReaderWriter< Request, Response >

template<class Request , class Response >
friend class ServerCallbackReaderWriter< Request, Response >
friend

Definition at line 442 of file impl/codegen/server_callback.h.

Member Data Documentation

◆ stream_

template<class Request , class Response >
std::atomic<ServerCallbackReaderWriter<Request, Response>*> grpc::ServerBidiReactor< Request, Response >::stream_ {nullptr}
private

Definition at line 477 of file impl/codegen/server_callback.h.

◆ stream_mu_

template<class Request , class Response >
grpc::internal::Mutex grpc::ServerBidiReactor< Request, Response >::stream_mu_
private

Definition at line 472 of file impl/codegen/server_callback.h.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:31