Skip to main content
Version: 0.7.0

The interface library

A program outside the Core speaks one of three contracts, and each language offers a library per contract it covers, over a base the three share.

LibraryIts partyIts lifecycle
plugina Plugin unitlaunched by the Core, admitted, holds one Session per incarnation
interfacean interface client — a panel, a browser's back end, a remote toolattaches to a channel, is admitted by reaching it, and is arbitrated against other channels
administrativetooling, or a person's sessionreaches a socket, whose mode is the whole of its authority

A panel links the interface library and not the administrative one, so an interface acquires no administrative reach is a fact about what is in the binary.

What the base holds, and what it does not​

The base holdsIt does not hold
connecting, and the transport's own framinganything a subscription needs
the envelope, and correlationthe shape of an admission
a refusal — code, message, detail — in the language's error idioma channel's attachment, or its suspension
the addresses a party may computea capability, a stream's tolerances, a channel's grade
the contract version each library statesany operation of any contract

What the interface library does​

ItHow
computes an addressa managed interface is handed its channel's socket in YOKE_SOCKET; in an application instance a channel's socket derives from the instance's name under the account's runtime directory; in the service form, from the runtime directory. A channel name that could choose where the socket is is refused
attachesto a local socket by its path, or to host:port over TLS 1.3 against the roots the caller supplies. A Core speaking another version of the contract is refused before any operation
presents a credential firston a channel whose class takes one: an account and its secret, or a token an earlier authentication issued. The answer carries the session token, the caller's to keep
surfaces the openingwhat the channel may address and observe, the standing subscription, and the contract's version (attaching)
carries every operation as one callread, subscribe, confirm, command, ask, start and stop a stream, subscribe to a stream, reclaim — each answered on its own, all on the one connection (the operations)
reports a refusal by its codeexactly as the contract enumerates it; a channel's suspension carries the grade and the channel it is suspended in favour of

What it never does, in any language:

  • it never retries and never reconnects — an attachment that ended has ended;
  • it never confirms on the author's behalf — a confirmation states what the author has processed, and only the author knows that;
  • it never sends what the author did not ask for.

An author who has learnt the model in one language has learnt it in all of them; only the spelling changes. The lifecycle, the ways of failing, the refusals and the ordering a library delivers are the same in every one; the shape of the API is the language's own.

In C++​

yoke-sdk-cpp is released as its source. An archive of the tagged tree, which cmake --install turns into the library, its headers, a CMake package and a pkg-config file; no package manager is involved.

find_package(yoke-sdk-cpp 0.5 REQUIRED)
target_link_libraries(panel PRIVATE yoke::yoke-cpp)
#include <yoke/interface.hpp>

namespace yi = yoke::iface;

auto attachment = yi::Attachment::attach(yi::managed(getenv));
for (const auto &record : attachment->picture().records()) { /* compose */ }
std::string answer = attachment->ask("pipeline", "spectrum.identify", spectrum);
the headeryoke/interface.hpp, namespace yoke::iface; the contract's generated messages are installed beside it, as yoke::interface::v1
a refusalyoke::Refusal, with its code and detail; yoke::iface::Suspended for a suspended channel
the endyoke::iface::Ended, from any call once the attachment has ended
threadsone of the library's own per attachment, reading what the Core sends, and one more at a routable address carrying the TLS; every member may be called from any thread
what it builds againstprotobuf, gRPC for C++, and OpenSSL 3

The reference panel is written this way: a Qt client of the local projection, linking the published library like anyone's, and composing its window from the opening picture alone.