|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Opens an application's bundle through the UI service, verifying everything it fetches. More...
#include <service_client.hpp>
Public Types | |
| using | Done = std::function<void(std::expected<LoadedBundle, ConnectError>)> |
| What open delivers. | |
| using | PollDone = std::function<void(std::expected<std::optional<LoadedBundle>, ConnectError>)> |
| What poll delivers: the changed bundle, nothing when the digest is the one already held, or why there is none. | |
Public Member Functions | |
| UiClient (Exchange exchange, HelloRequest client, std::shared_ptr< IBundleStore > store) | |
| A client. | |
| void | open (::morph::session::Context session, Done done) const |
Opens the bundle. done is called once, from whichever thread the exchange calls back on; a synchronous exchange calls it before open returns. | |
| void | poll (::morph::session::Context session, std::string knownDigest, PollDone done) const |
One step of a development client's reload (spec 5 §12): sends ui-hello, and when the manifest digest differs from knownDigest, opens the changed bundle as open does, fetching only what the cache does not hold. done is called once, as open's is. | |
| std::expected< LoadedBundle, ConnectError > | openOffline (std::string_view application) const |
Rebuilds the last bundle this store verified for application, without a connection. Files the store no longer holds, or that no longer verify, are left out; the catalog is empty. | |
Opens an application's bundle through the UI service, verifying everything it fetches.
open runs ui-hello, refuses a bundle that needs a vocabulary the client does not speak, takes the manifest from the cache or fetches it by the digest and verifies it, runs ui-catalog, and fetches the files the principal may use that the cache does not hold, all at once, verifying each. A file that does not hash to its manifest entry, or a manifest that does not hash to the digest, refuses the whole bundle (Unverified). An unchanged manifest fetches nothing.
Definition at line 250 of file service_client.hpp.
| using morph::ui::UiClient::Done = std::function<void(std::expected<LoadedBundle, ConnectError>)> |
What open delivers.
Definition at line 265 of file service_client.hpp.
| using morph::ui::UiClient::PollDone = std::function<void(std::expected<std::optional<LoadedBundle>, ConnectError>)> |
What poll delivers: the changed bundle, nothing when the digest is the one already held, or why there is none.
Definition at line 278 of file service_client.hpp.
|
inline |
A client.
| exchange | The transport. |
| client | What the client speaks and carries, sent with ui-hello. |
| store | Where verified files are kept. |
| std::invalid_argument | if exchange is empty or store is null. |
Definition at line 257 of file service_client.hpp.
|
inline |
Opens the bundle. done is called once, from whichever thread the exchange calls back on; a synchronous exchange calls it before open returns.
| session | The session every request carries: the principal's token, or none before sign-in. |
| done | Called with the bundle, or why there is none. |
Definition at line 271 of file service_client.hpp.
|
inline |
One step of a development client's reload (spec 5 §12): sends ui-hello, and when the manifest digest differs from knownDigest, opens the changed bundle as open does, fetching only what the cache does not hold. done is called once, as open's is.
| session | The session every request carries. |
| knownDigest | The digest of the bundle the client has, as HelloReply::digest spells it. |
| done | Called with the changed bundle, with nothing when the digest is unchanged, or with why the poll failed. |
Definition at line 287 of file service_client.hpp.
|
inlinenodiscard |
Rebuilds the last bundle this store verified for application, without a connection. Files the store no longer holds, or that no longer verify, are left out; the catalog is empty.
| application | The application's id. |
Definition at line 306 of file service_client.hpp.