Functions
Read()
Read one response from the streaming RPC.
Read()
can be called before a Write()
operation is specified by each service and RPC. Most services require at least one Write()
call before calling Read()
. Many services may return more than one response for a single Write()
request. Each service and RPC specifies how to discover if more responses will be forthcoming.
If the optional<>
is not engaged the streaming RPC has completed. The application should wait until any other pending operations (typically any other Write()
calls) complete and then call Finish()
to find the status of the streaming RPC.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns | |
---|---|
Type | Description |
future< absl::optional< ResponseType > > |
Write(RequestType const &, grpc::WriteOptions)
Write one request to the streaming RPC.
Write()
can be called before waiting for a matching Read()
operation is specified by each service and RPC. Many services tolerate multiple Write()
calls before performing or at least receiving a Read()
response.
If Write()
completes with false
the streaming RPC has completed. The application should wait until any other pending operations (typically any other Read()
calls) complete and then call Finish()
to find the status of the streaming RPC.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameters | |
---|---|
Name | Description |
|
RequestType const &
|
|
grpc::WriteOptions
|
Returns | |
---|---|
Type | Description |
future< bool > |
WritesDone()
Half-closes the streaming RPC.
Sends an indication to the service that no more requests will be issued by the client.
If WritesDone()
completes with false
the streaming RPC has completed. The application should wait until any other pending operations (typically any other Read()
calls) complete and then call Finish()
to find the status of the streaming RPC.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns | |
---|---|
Type | Description |
future< bool > |
Cancel()
Sends a best-effort request to cancel the RPC.
The application should still wait for the current operation(s) (any pending Start()
, Read()
, or Write*()
requests) to complete and use Finish()
to determine the status of the RPC.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns | |
---|---|
Type | Description |
void |
Finish()
Return the final status of the streaming RPC.
Streaming RPCs may return an error because the stream is closed, independently of any whether the application has called WritesDone()
or signaled that the stream is closed using other mechanisms (some RPCs define specific attributes to "close" the stream).
The application must wait until all pending Read()
and Write()
operations have completed before calling Finish()
.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns | |
---|---|
Type | Description |
future< Status > |
Start()
Start the streaming RPC.
Applications should call Start()
and wait for its result before calling Read()
and/or Write()
. If Start()
completes with false
the stream has completed with an error. The application should not call Read()
or Write()
in this case. On errors, the application should callFinish()
to determine the status of the streaming RPC.
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns | |
---|---|
Type | Description |
future< bool > |