GRPC C++  1.30.0
Data Structures | Public Member Functions | Friends
grpc_impl::ServerBidiReactor< Request, Response > Class Template Referenceabstract

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

#include <server_callback_impl.h>

Public Member Functions

 ServerBidiReactor ()
 
 ~ServerBidiReactor ()=default
 
void StartSendInitialMetadata ()
 Send any initial metadata stored in the RPC context. More...
 
void StartRead (Request *req)
 Initiate a read operation. More...
 
void StartWrite (const Response *resp)
 Initiate a write operation. More...
 
void StartWrite (const Response *resp, ::grpc::WriteOptions options)
 Initiate a write operation with specified options. More...
 
void StartWriteAndFinish (const Response *resp, ::grpc::WriteOptions options, ::grpc::Status s)
 Initiate a write operation with specified options and final RPC Status, which also causes any trailing metadata for this RPC to be sent out. More...
 
void StartWriteLast (const Response *resp, ::grpc::WriteOptions options)
 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). More...
 
void Finish (::grpc::Status s)
 Indicate that the stream is to be finished and the trailing metadata and RPC status are to be sent. More...
 
virtual void OnSendInitialMetadataDone (bool)
 Notifies the application that an explicit StartSendInitialMetadata operation completed. More...
 
virtual void OnReadDone (bool)
 Notifies the application that a StartRead operation completed. More...
 
virtual void OnWriteDone (bool)
 Notifies the application that a StartWrite (or StartWriteLast) operation completed. More...
 
void OnDone () override=0
 Notifies the application that all operations associated with this RPC have completed. More...
 
void OnCancel () override
 Notifies the application that this RPC has been cancelled. More...
 
- Public Member Functions inherited from grpc_impl::internal::ServerReactor
virtual ~ServerReactor ()=default
 
virtual bool InternalInlineable ()
 

Friends

class ServerCallbackReaderWriter< Request, Response >
 

Detailed Description

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

ServerBidiReactor is the interface for a bidirectional streaming RPC.

Constructor & Destructor Documentation

◆ ServerBidiReactor()

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

◆ ~ServerBidiReactor()

template<class Request, class Response>
grpc_impl::ServerBidiReactor< Request, Response >::~ServerBidiReactor ( )
default

Member Function Documentation

◆ Finish()

template<class Request, class Response>
void grpc_impl::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

◆ OnCancel()

template<class Request, class Response>
void grpc_impl::ServerBidiReactor< Request, Response >::OnCancel ( )
inlineoverridevirtual

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.

Implements grpc_impl::internal::ServerReactor.

◆ OnDone()

template<class Request, class Response>
void grpc_impl::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.

Implements grpc_impl::internal::ServerReactor.

◆ OnReadDone()

template<class Request, class Response>
virtual void grpc_impl::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.

◆ OnSendInitialMetadataDone()

template<class Request, class Response>
virtual void grpc_impl::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.

◆ OnWriteDone()

template<class Request, class Response>
virtual void grpc_impl::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.

◆ StartRead()

template<class Request, class Response>
void grpc_impl::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

◆ StartSendInitialMetadata()

template<class Request, class Response>
void grpc_impl::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).

◆ StartWrite() [1/2]

template<class Request, class Response>
void grpc_impl::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.

◆ StartWrite() [2/2]

template<class Request, class Response>
void grpc_impl::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

◆ StartWriteAndFinish()

template<class Request, class Response>
void grpc_impl::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

◆ StartWriteLast()

template<class Request, class Response>
void grpc_impl::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

Friends And Related Function Documentation

◆ ServerCallbackReaderWriter< Request, Response >

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

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