A collection of RPC methods.
- Note
- Method lifetime. A method's future or coroutine is owned by its call and is destroyed as soon as the call ends (when the final response packet is committed, the client cancels, the connection closes, or the server shuts down). Perform all per-call work before committing the final write. Conversely, if a method's future or coroutine finishes before its
Writer or UnaryWriter has completed the call, the call is terminated and any remaining handles are detached.
-
Per-call state. All of a service's calls share the service object. Keep per-call state in the method's future or coroutine.
|
|
constexpr | Service (uint32_t service_id, span< const internal::Method > methods) |
| |
| | ~Service () |
| |
| constexpr | Item ()=default |
| |
|
|
struct | internal::ServiceAccess |
| |
◆ ~Service()
| pw::rpc2::Service::~Service |
( |
| ) |
|
|
protected |
- Precondition
- The service must not still be registered with a
Server, and any call dispatched to it must have finished.
A service cannot safely unlink itself: the registry belongs to the server's dispatcher, which is not reachable from here. Destroying a registered service is a bug in any case, because only closing the server guarantees no new call is dispatched to it.
Server::Close() unregisters everything, so a service may be destroyed once the close has completed — that is, once the ControlFuture from Close() has resolved or CloseBlocking() has returned.
The documentation for this class was generated from the following file:
- pw_rpc2/cpp/public/pw_rpc2/service.h