ClientBidiReactor is the interface for a bidirectional streaming RPC.
More...
#include <client_callback_impl.h>
|
virtual | ~ClientBidiReactor () |
|
void | StartCall () |
| Activate the RPC and initiate any reads or writes that have been Start'ed before this call. More...
|
|
void | StartRead (Response *resp) |
| Initiate a read operation (or post it for later initiation if StartCall has not yet been invoked). More...
|
|
void | StartWrite (const Request *req) |
| Initiate a write operation (or post it for later initiation if StartCall has not yet been invoked). More...
|
|
void | StartWrite (const Request *req, ::grpc::WriteOptions options) |
| Initiate/post a write operation with specified options. More...
|
|
void | StartWriteLast (const Request *req, ::grpc::WriteOptions options) |
| Initiate/post a write operation with specified options and an indication that this is the last write (like StartWrite and StartWritesDone, merged). More...
|
|
void | StartWritesDone () |
| Indicate that the RPC will have no more write operations. More...
|
|
void | AddHold () |
| Holds are needed if (and only if) this stream has operations that take place on it after StartCall but from outside one of the reactions (OnReadDone, etc). More...
|
|
void | AddMultipleHolds (int holds) |
|
void | RemoveHold () |
|
virtual void | OnDone (const ::grpc::Status &) |
| Notifies the application that all operations associated with this RPC have completed and all Holds have been removed. More...
|
|
virtual void | OnReadInitialMetadataDone (bool) |
| Notifies the application that a read of initial metadata from the server is done. 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...
|
|
virtual void | OnWritesDoneDone (bool) |
| Notifies the application that a StartWritesDone operation completed. More...
|
|
template<class Request, class Response>
class grpc_impl::ClientBidiReactor< Request, Response >
ClientBidiReactor is the interface for a bidirectional streaming RPC.
◆ ~ClientBidiReactor()
template<class Request, class Response>
◆ AddHold()
template<class Request, class Response>
Holds are needed if (and only if) this stream has operations that take place on it after StartCall but from outside one of the reactions (OnReadDone, etc).
This is not a common use of the streaming API.
Holds must be added before calling StartCall. If a stream still has a hold in place, its resources will not be destroyed even if the status has already come in from the wire and there are currently no active callbacks outstanding. Similarly, the stream will not call OnDone if there are still holds on it.
For example, if a StartRead or StartWrite operation is going to be initiated from elsewhere in the application, the application should call AddHold or AddMultipleHolds before StartCall. If there is going to be, for example, a read-flow and a write-flow taking place outside the reactions, then call AddMultipleHolds(2) before StartCall. When the application knows that it won't issue any more read operations (such as when a read comes back as not ok), it should issue a RemoveHold(). It should also call RemoveHold() again after it does StartWriteLast or StartWritesDone that indicates that there will be no more write ops. The number of RemoveHold calls must match the total number of AddHold calls plus the number of holds added by AddMultipleHolds. The argument to AddMultipleHolds must be positive.
◆ AddMultipleHolds()
template<class Request, class Response>
◆ OnDone()
template<class Request, class Response>
Notifies the application that all operations associated with this RPC have completed and all Holds have been removed.
OnDone provides the RPC status outcome for both successful and failed RPCs and will be called in all cases. If it is not called, it indicates an application-level problem (like failure to remove a hold).
- Parameters
-
[in] | s | The status outcome of this RPC |
◆ OnReadDone()
template<class Request, class Response>
Notifies the application that a StartRead operation completed.
- Parameters
-
[in] | ok | Was it successful? If false, no new read/write operation will succeed, and any further Start* should not be called. |
◆ OnReadInitialMetadataDone()
template<class Request, class Response>
Notifies the application that a read of initial metadata from the server is done.
If the application chooses not to implement this method, it can assume that the initial metadata has been read before the first call of OnReadDone or OnDone.
- Parameters
-
[in] | ok | Was the initial metadata read successfully? If false, no new read/write operation will succeed, and any further Start* operations should not be called. |
◆ OnWriteDone()
template<class Request, class Response>
Notifies the application that a StartWrite or StartWriteLast operation completed.
- Parameters
-
[in] | ok | Was it successful? If false, no new read/write operation will succeed, and any further Start* should not be called. |
◆ OnWritesDoneDone()
template<class Request, class Response>
Notifies the application that a StartWritesDone operation completed.
Note that this is only used on explicit StartWritesDone operations and not for those that are implicitly invoked as part of a StartWriteLast.
- Parameters
-
[in] | ok | Was it successful? If false, the application will later see the failure reflected as a bad status in OnDone and no further Start* should be called. |
◆ RemoveHold()
template<class Request, class Response>
◆ StartCall()
template<class Request, class Response>
Activate the RPC and initiate any reads or writes that have been Start'ed before this call.
All streaming RPCs issued by the client MUST have StartCall invoked on them (even if they are canceled) as this call is the activation of their lifecycle.
◆ StartRead()
template<class Request, class Response>
Initiate a read operation (or post it for later initiation if StartCall has not yet been invoked).
- Parameters
-
[out] | resp | Where to eventually store the read message. Valid when the library calls OnReadDone |
◆ StartWrite() [1/2]
template<class Request, class Response>
Initiate a write operation (or post it for later initiation if StartCall has not yet been invoked).
- Parameters
-
[in] | req | The 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>
Initiate/post a write operation with specified options.
- Parameters
-
[in] | req | The 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] | options | The WriteOptions to use for writing this message |
◆ StartWriteLast()
template<class Request, class Response>
Initiate/post a write operation with specified options and an indication that this is the last write (like StartWrite and StartWritesDone, merged).
Note that calling this means that no more calls to StartWrite, StartWriteLast, or StartWritesDone are allowed.
- Parameters
-
[in] | req | The 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] | options | The WriteOptions to use for writing this message |
◆ StartWritesDone()
template<class Request, class Response>
Indicate that the RPC will have no more write operations.
This can only be issued once for a given RPC. This is not required or allowed if StartWriteLast is used since that already has the same implication. Note that calling this means that no more calls to StartWrite, StartWriteLast, or StartWritesDone are allowed.
◆ ClientCallbackReaderWriter< Request, Response >
template<class Request, class Response>
The documentation for this class was generated from the following file: