template<typename Request, typename Response>
class ugrpc::server::BidirectionalStream< Request, Response >
Controls a request stream -> response stream RPC.
This class allows the following concurrent calls:
GetContext
Read
;
- one of (
Write
, Finish
, FinishWithError
, WriteAndFinish
).
The RPC is cancelled on destruction unless the stream has been finished.
If any method throws, further methods must not be called on the same stream, except for GetContext
.
Definition at line 207 of file rpc.hpp.
|
bool | Read (Request &request) override |
| Await and read the next incoming message.
|
|
void | Write (Response &response) override |
| Write the next outgoing message.
|
|
void | Write (Response &&response) override |
| Write the next outgoing message.
|
|
void | Finish () |
| Complete the RPC successfully.
|
|
void | FinishWithError (const grpc::Status &status) override |
| Complete the RPC with an error.
|
|
void | WriteAndFinish (Response &response) |
| Equivalent to Write + Finish
|
|
void | WriteAndFinish (Response &&response) |
| Equivalent to Write + Finish
|
|
| BidirectionalStream (impl::CallParams &&call_params, impl::RawReaderWriter< Request, Response > &stream) |
| For internal use only.
|
|
| BidirectionalStream (const BidirectionalStream &)=delete |
|
| BidirectionalStream (BidirectionalStream &&)=delete |
|
bool | IsFinished () const override |
| Useful for generic error reporting via FinishWithError.
|
|
grpc::ServerContext & | GetContext () |
|
std::string_view | GetCallName () const |
| Name of the RPC in the format full.path.ServiceName/MethodName
|
|
std::string_view | GetServiceName () const |
| Get name of gRPC service.
|
|
std::string_view | GetMethodName () const |
| Get name of called gRPC method.
|
|
tracing::Span & | GetSpan () |
| Get the span of the current RPC. Span's lifetime covers the Handle call of the outermost middleware.
|
|
CallKind | GetCallKind () const |
| Get RPCs kind of method.
|
|
utils::AnyStorage< StorageContext > & | GetStorageContext () |
| Returns call context for storing per-call custom data.
|
|
void | SetMetricsCallName (std::string_view call_name) |
| Set a custom call name for metric labels.
|
|
template<typename Request , typename Response >
Equivalent to Write + Finish
This call saves one round-trip, compared to separate Write
and Finish
.
Finish
must not be called multiple times.
- Parameters
-
response | the final response message |
- Exceptions
-
Definition at line 548 of file rpc.hpp.
template<typename Request , typename Response >
Equivalent to Write + Finish
This call saves one round-trip, compared to separate Write
and Finish
.
Finish
must not be called multiple times.
- Parameters
-
response | the final response message |
- Exceptions
-
Definition at line 553 of file rpc.hpp.