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

ServerRPC base. More...

#include <agrpc/detail/server_rpc_base.hpp>

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

Public Types

using executor_type = Executor
 The executor type.
 

Public Member Functions

template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>>
auto send_initial_metadata (CompletionToken &&token=detail::DefaultCompletionTokenT< Executor >{})
 Send initial metadata. More...
 
bool is_done () const noexcept
 Is this rpc done? More...
 
auto wait_for_done (CompletionToken &&token=detail::DefaultCompletionTokenT< Executor >{})
 Wait for done. More...
 
const executor_typeget_executor () const noexcept
 Get the executor. More...
 
const executor_typeget_scheduler () const noexcept
 Get the scheduler. More...
 
auto & context ()
 Get the underlying ServerContext
 
const auto & context () const
 Get the underlying ServerContext (const overload)
 
void cancel () noexcept
 Cancel this RPC. More...
 

Detailed Description

template<class Responder, class Traits, class Executor>
class agrpc::detail::ServerRPCBase< Responder, Traits, Executor >

ServerRPC base.

Since
2.7.0

Member Function Documentation

◆ send_initial_metadata()

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

Send initial metadata.

Request notification of the sending of initial metadata to the client.

This call is optional, but if it is used, it cannot be used concurrently with or after the finish/finish_with_error method.

Parameters
tokenA completion token like asio::yield_context or agrpc::use_sender. The completion signature is void(bool). true means that the data/metadata/status/etc is going to go to the wire. If it is false, it is not going to the wire because the call is already dead (i.e., canceled, deadline expired, other side dropped the channel, etc).

◆ is_done()

bool agrpc::detail::ServerRPCNotifyWhenDoneMixin< IsNotifyWhenDone, Responder, Executor >::is_done ( ) const
inlinenoexceptinherited

Is this rpc done?

Only available if Traits contain NOTIFY_WHEN_DONE = true.

Returns true if NotifyWhenDone has fired which indicates the finish has been called or that the rpc is dead (i.e., canceled, deadline expired, other side dropped the channel, etc).

Thread-safe

◆ wait_for_done()

auto agrpc::detail::ServerRPCNotifyWhenDoneMixin< IsNotifyWhenDone, Responder, Executor >::wait_for_done ( CompletionToken &&  token = detail::DefaultCompletionTokenT<Executor>{})
inlineinherited

Wait for done.

Only available if Traits contain NOTIFY_WHEN_DONE = true.

Request notification of the completion of this rpc, either due to calling finish or because the rpc is dead (i.e., canceled, deadline expired, other side dropped the channel, etc). rpc.context().IsCancelled() may only be called after this operation completes.

Cancelling this operation does not invoke grpc::ServerContext::TryCancel.

Parameters
tokenA completion token like asio::yield_context or agrpc::use_sender. The completion signature is void().

◆ 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::ServerRPCContextBase< Responder >::cancel ( )
inlinenoexceptinherited

Cancel this RPC.

Effectively calls context().TryCancel().

Thread-safe