|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The client side of the UI service (spec 5 §12, "Content addressing"): UiClient runs ui-hello, ui-catalog and ui-fetch over a transport the caller supplies, verifies every file against the manifest and the manifest against the ui-hello digest, and keeps what it verified in a VerifiedCache. More...
#include <algorithm>#include <cstddef>#include <exception>#include <expected>#include <functional>#include <map>#include <memory>#include <mutex>#include <optional>#include <stdexcept>#include <string>#include <string_view>#include <utility>#include <vector>#include "../attributes.hpp"#include "../core/completion.hpp"#include "../core/envelope_transport.hpp"#include "../core/executor.hpp"#include "../core/logger.hpp"#include "../core/wire.hpp"#include "../session/session.hpp"#include "../ui/frontend.hpp"#include "bundle.hpp"#include "file_store.hpp"#include "theme.hpp"Go to the source code of this file.
Classes | |
| class | morph::ui::IBundleStore |
| Where a client keeps verified files between runs, by content hash, and the digest of each application's last verified bundle. More... | |
| class | morph::ui::MemoryBundleStore |
| An IBundleStore in memory: it lasts as long as the process. Safe to call from any thread. More... | |
| class | morph::ui::VerifiedCache |
| A content-addressed cache that hands out only bytes that hash to the hash they are asked for. More... | |
| struct | morph::ui::LoadedBundle |
| A bundle the client verified: what the shell mounts, and what it was verified against. More... | |
| class | morph::ui::UiClient |
| Opens an application's bundle through the UI service, verifying everything it fetches. More... | |
| struct | morph::ui::DownloadedFile |
| A file a download brought back. More... | |
| class | morph::ui::FileTransfer |
| The client of the file side channel (files/1, spec 6 §18): uploads and downloads through ui-file, one chunk of at most kMaxFileChunkBytes in flight at a time, reporting progress after each. More... | |
Typedefs | |
| using | morph::ui::ExchangeReply = std::expected<::morph::wire::Envelope, std::string> |
| One reply, or why the transport could not deliver it. | |
| using | morph::ui::Exchange = std::function<void(::morph::wire::Envelope request, std::function<void(ExchangeReply reply)> done)> |
| Sends one request and calls its callback once with the reply. The transport assigns the request's callId and matches the reply to it; a failure to deliver either is the error. | |
Functions | |
| Exchange | morph::ui::exchangeOver (::morph::backend::IEnvelopeTransport &backend, ::morph::exec::IExecutor &cbExec) |
| An Exchange over a transport: each request is one IEnvelopeTransport::request, and its reply, ok or err, is the exchange's reply; a failure to deliver either is the error, as its message. | |
| std::expected< std::string, std::string > | morph::ui::evaluationValue (ExchangeReply reply) |
| The value an evaluate query takes from a ui-evaluate reply: the evaluated body's members, with the field errors under errors and the verdict under ready, where errors.<field> attaches each to its element. | |
| std::function<::morph::async::Completion< std::string >(std::string const &, std::string const &, std::string const &)> | morph::ui::evaluatorOver (Exchange exchange, ::morph::session::Context session, ::morph::exec::IExecutor *cbExec) |
An evaluator over the UI service: each evaluation is one ui-evaluate request through exchange, and resolves with evaluationValue of its reply. What BridgeDispatcher takes as its Evaluator. | |
| std::function<::morph::async::Completion< std::string >(std::string const &, std::string const &)> | morph::ui::watcherOver (Exchange exchange, std::function<::morph::session::Context()> currentSession, ::morph::exec::IExecutor *cbExec) |
A watcher over the server (spec 8 §7): each watch or unwatch is one request of that kind through exchange, carrying the session currentSession returns when it is sent. What SessionOptions::watcher takes. | |
The client side of the UI service (spec 5 §12, "Content addressing"): UiClient runs ui-hello, ui-catalog and ui-fetch over a transport the caller supplies, verifies every file against the manifest and the manifest against the ui-hello digest, and keeps what it verified in a VerifiedCache.
Specified in docs/spec/ui/service.md.
Definition in file service_client.hpp.
| using morph::ui::ExchangeReply = std::expected<::morph::wire::Envelope, std::string> |
One reply, or why the transport could not deliver it.
Definition at line 208 of file service_client.hpp.
| using morph::ui::Exchange = std::function<void(::morph::wire::Envelope request, std::function<void(ExchangeReply reply)> done)> |
Sends one request and calls its callback once with the reply. The transport assigns the request's callId and matches the reply to it; a failure to deliver either is the error.
Definition at line 212 of file service_client.hpp.
|
inlinenodiscard |
An Exchange over a transport: each request is one IEnvelopeTransport::request, and its reply, ok or err, is the exchange's reply; a failure to deliver either is the error, as its message.
Call it on cbExec's thread, where its replies arrive: UiClient sends each request from the reply before it, so a client opened there stays there.
| backend | The transport: SocketBackend or QtWebSocketBackend. Borrowed: it must outlive every request sent through the exchange, so a caller that may destroy it first guards the exchange itself. |
| cbExec | The executor replies are delivered on: the interpreter runtime's owner. Borrowed. |
Definition at line 223 of file service_client.hpp.
|
inlinenodiscard |
The value an evaluate query takes from a ui-evaluate reply: the evaluated body's members, with the field errors under errors and the verdict under ready, where errors.<field> attaches each to its element.
An action field named errors or ready is shadowed by them.
| reply | The reply, or why the transport could not deliver it. |
Definition at line 649 of file service_client.hpp.
|
inlinenodiscard |
An evaluator over the UI service: each evaluation is one ui-evaluate request through exchange, and resolves with evaluationValue of its reply. What BridgeDispatcher takes as its Evaluator.
| exchange | The transport. |
| session | The session every request carries. |
| cbExec | The executor the completion is delivered on: the interpreter runtime's owner. Borrowed. |
Definition at line 682 of file service_client.hpp.
|
inlinenodiscard |
A watcher over the server (spec 8 §7): each watch or unwatch is one request of that kind through exchange, carrying the session currentSession returns when it is sent. What SessionOptions::watcher takes.
The session is read at each send, not fixed when the watcher is built, because a watch must carry whoever is signed in now: the exchange does not stamp it, and the server refuses an unsigned one.
| exchange | The transport. |
| currentSession | The session to stamp on each request, read when it is sent. |
| cbExec | The executor the completion is delivered on: the interpreter runtime's owner. Borrowed. |
Definition at line 717 of file service_client.hpp.