morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::backend::IEnvelopeService Class Referenceabstract

Envelope kinds a RemoteServer answers through an extension, such as the UI service's ui-* kinds. More...

#include <remote.hpp>

Inheritance diagram for morph::backend::IEnvelopeService:
morph::ui::UiService

Public Member Functions

 IEnvelopeService (const IEnvelopeService &)=delete
IEnvelopeService & operator= (const IEnvelopeService &)=delete
 IEnvelopeService (IEnvelopeService &&)=delete
IEnvelopeService & operator= (IEnvelopeService &&)=delete
virtual bool serves (std::string_view kind) const =0
 Whether this service answers kind.
virtual std::string handle (const ::morph::wire::Envelope &request, const ::morph::session::IAuthorizer &authorizer)=0
 Answers one envelope of a kind serves accepted.
virtual std::string handle (const ::morph::wire::Envelope &request, const ::morph::session::IAuthorizer &authorizer, ConnectionFacts &facts)
 Answers one envelope of a kind serves accepted, with the facts of the connection it arrived on.

Detailed Description

Envelope kinds a RemoteServer answers through an extension, such as the UI service's ui-* kinds.

Core does not know the kinds a higher layer adds, and must not include that layer. A server consults its services only for a kind it does not answer itself, so a service cannot take over execute, hello or any other built-in kind; a kind no service serves is still answered err "unknown envelope kind: <kind>". See docs/spec/core/backend.md, "Envelope services".

Definition at line 231 of file remote.hpp.

Member Function Documentation

◆ serves()

virtual bool morph::backend::IEnvelopeService::serves ( std::string_view kind) const
nodiscardpure virtual

Whether this service answers kind.

Parameters
kindThe envelope's kind.
Returns
true to have handle answer it.

Implemented in morph::ui::UiService.

◆ handle() [1/2]

virtual std::string morph::backend::IEnvelopeService::handle ( const ::morph::wire::Envelope & request,
const ::morph::session::IAuthorizer & authorizer )
nodiscardpure virtual

Answers one envelope of a kind serves accepted.

Runs on the server strand, so it must not block. The server has already stamped the verified principal onto request.session (the client's claim is never seen here); authorising the request is the service's, through authorizer. A throw becomes an err reply carrying its message.

Parameters
requestThe decoded envelope.
authorizerThe server's authoriser.
Returns
The encoded reply envelope (wire::encode), addressed to request.callId.

Implemented in morph::ui::UiService.

◆ handle() [2/2]

virtual std::string morph::backend::IEnvelopeService::handle ( const ::morph::wire::Envelope & request,
const ::morph::session::IAuthorizer & authorizer,
ConnectionFacts & facts )
inlinenodiscardvirtual

Answers one envelope of a kind serves accepted, with the facts of the connection it arrived on.

What the server calls. A service that learns something about the connection, as the UI service learns that ui-hello negotiated events, overrides this one and records it in facts; the default forwards to the two-parameter handle and leaves facts alone. A service overriding only one of the two adds using IEnvelopeService::handle;, so the other is not hidden. Same thread and error rules as the two-parameter handle.

Parameters
requestThe decoded envelope.
authorizerThe server's authoriser.
factsThe connection's facts, which the service may set; fresh ones for a message handled without a connection.
Returns
The encoded reply envelope (wire::encode), addressed to request.callId.

Reimplemented in morph::ui::UiService.

Definition at line 275 of file remote.hpp.


The documentation for this class was generated from the following file: