asio-grpc v3.1.0
Asynchronous gRPC with Asio/unified executors
agrpc::detail::ClientRPCBase< Responder, Executor > Class Template Reference

ServerRPC base. More...

#include <agrpc/detail/client_rpc_base.hpp>

+ Inheritance diagram for agrpc::detail::ClientRPCBase< Responder, Executor >:
+ Collaboration diagram for agrpc::detail::ClientRPCBase< Responder, Executor >:

Public Types

using executor_type = Executor
 The executor type.
 

Public Member Functions

 ClientRPCBase (agrpc::GrpcContext &grpc_context)
 Construct from a GrpcContext.
 
template<class ClientContextInitFunction >
 ClientRPCBase (agrpc::GrpcContext &grpc_context, ClientContextInitFunction &&init_function)
 Construct from a GrpcContext and an init function. More...
 
 ClientRPCBase (const Executor &executor)
 Construct from an executor.
 
template<class ClientContextInitFunction >
 ClientRPCBase (const Executor &executor, ClientContextInitFunction &&init_function)
 Construct from an executor and init function. More...
 
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>>
auto read_initial_metadata (CompletionToken &&token=detail::DefaultCompletionTokenT< Executor >{})
 Read initial metadata. More...
 
const executor_typeget_executor () const noexcept
 Get the executor. More...
 
const executor_typeget_scheduler () const noexcept
 Get the scheduler. More...
 
grpc::ClientContext & context ()
 Get the underlying grpc::ClientContext
 
const grpc::ClientContext & context () const
 Get the underlying grpc::ClientContext (const overload)
 
void cancel () noexcept
 Cancel this RPC. More...
 

Detailed Description

template<class Responder, class Executor>
class agrpc::detail::ClientRPCBase< Responder, Executor >

ServerRPC base.

Since
2.7.0

Constructor & Destructor Documentation

◆ ClientRPCBase() [1/2]

template<class Responder , class Executor >
template<class ClientContextInitFunction >
agrpc::detail::ClientRPCBase< Responder, Executor >::ClientRPCBase ( agrpc::GrpcContext grpc_context,
ClientContextInitFunction &&  init_function 
)
inline

Construct from a GrpcContext and an init function.

Template Parameters
ClientContextInitFunctionA function with signature void(grpc::ClientContext&) which will be invoked during construction. It can, for example, be used to set this rpc's deadline.

◆ ClientRPCBase() [2/2]

template<class Responder , class Executor >
template<class ClientContextInitFunction >
agrpc::detail::ClientRPCBase< Responder, Executor >::ClientRPCBase ( const Executor &  executor,
ClientContextInitFunction &&  init_function 
)
inline

Construct from an executor and init function.

Template Parameters
ClientContextInitFunctionA function with signature void(grpc::ClientContext&) which will be invoked during construction. It can, for example, be used to set this rpc's deadline.

Member Function Documentation

◆ read_initial_metadata()

template<class Responder , class Executor >
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>>
auto agrpc::detail::ClientRPCBase< Responder, Executor >::read_initial_metadata ( CompletionToken &&  token = detail::DefaultCompletionTokenT<Executor>{})
inline

Read initial metadata.

Request notification of the reading of the initial metadata.

This call is optional.

Side effect:

  • Upon receiving initial metadata from the server, the ClientContext associated with this call is updated, and the calling code can access the received metadata through the ClientContext.
Attention
If the server does not explicitly send initial metadata (e.g. by calling agrpc::send_initial_metadata) but waits for a message from the client instead then this function won't complete until write() is called.
Parameters
tokenA completion token like asio::yield_context or agrpc::use_sender. The completion signature is void(bool). true indicates that the metadata was read. If it is false, then the call is dead.

◆ get_executor()

template<class Executor >
const executor_type & agrpc::detail::RPCExecutorBase< Executor >::get_executor ( ) const
inlinenoexceptinherited

Get the executor.

Thread-safe

◆ get_scheduler()

template<class Executor >
const executor_type & agrpc::detail::RPCExecutorBase< Executor >::get_scheduler ( ) const
inlinenoexceptinherited

Get the scheduler.

Thread-safe

Since
2.9.0

◆ cancel()

template<class Responder >
void agrpc::detail::ClientRPCContextBase< Responder >::cancel ( )
inlinenoexceptinherited

Cancel this RPC.

Effectively calls context().TryCancel().

Thread-safe