asio-grpc v3.4.0
Asynchronous gRPC with Asio/unified executors
Loading...
Searching...
No Matches
agrpc::detail::ServerRPCNotifyWhenDoneMixin< IsNotifyWhenDone, Responder, Executor > Class Template Reference

ServerRPC NotifyWhenDone base. More...

#include <agrpc/detail/server_rpc_notify_when_done_mixin.hpp>

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

Public Types

using executor_type = Executor
 The executor type.
 

Public Member Functions

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

Detailed Description

template<bool IsNotifyWhenDone, class Responder, class Executor>
class agrpc::detail::ServerRPCNotifyWhenDoneMixin< IsNotifyWhenDone, Responder, Executor >

ServerRPC NotifyWhenDone base.

Since
2.7.0

Member Function Documentation

◆ is_done()

template<bool IsNotifyWhenDone, class Responder , class Executor >
bool agrpc::detail::ServerRPCNotifyWhenDoneMixin< IsNotifyWhenDone, Responder, Executor >::is_done ( ) const
inlinenodiscardnoexcept

Is this rpc done?

Only available if Traits contain NOTIFY_WHEN_DONE = true.

Returns true if NotifyWhenDone has fired which indicates that 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()

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

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.

Internally, this operation uses grpc::ServerContext::AsyncNotifyWhenDone.

Attention
Only one call to wait_for_done() may be outstanding at a time.
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
inlinenodiscardnoexceptinherited

Get the executor.

Thread-safe

◆ get_scheduler()

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

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