Compare commits
28
Commits
ad1a1f5eb7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d74a2e90b4 | ||
|
|
f047b9c7ae | ||
|
|
01f681165f | ||
|
|
45dd65b48e | ||
|
|
8bbcf8ecd9 | ||
|
|
8121d16113 | ||
|
|
88eb755e5f | ||
|
|
383e4bc6dd | ||
|
|
54338b3ea2 | ||
|
|
f7fa60ba81 | ||
|
|
afb816f459 | ||
|
|
919e79eb2a | ||
|
|
a080cde54c | ||
|
|
908c90a8bc | ||
|
|
8cf633d555 | ||
|
|
92b9acf291 | ||
|
|
935411be14 | ||
|
|
e55f531074 | ||
|
|
3d00ac265f | ||
|
|
43c12d74f5 | ||
|
|
a1a5d3d60b | ||
|
|
93970cfab5 | ||
|
|
5d514328f7 | ||
|
|
e8e4ed5eb7 | ||
|
|
1daa604ee9 | ||
|
|
dcd2c072ae | ||
|
|
e07993262c | ||
|
|
c5c86e9a16 |
No files matched your search
+30
@@ -0,0 +1,30 @@
|
|||||||
|
# _book/ is NOT ignored: it is the built site, and the deploy hook publishes
|
||||||
|
# whatever is committed there (see _course/NEW-COURSE.md). Render before
|
||||||
|
# committing, or the website does not change.
|
||||||
|
.quarto/
|
||||||
|
*.tex
|
||||||
|
!preamble.tex
|
||||||
|
*.aux
|
||||||
|
*.log
|
||||||
|
*.toc
|
||||||
|
*.out
|
||||||
|
*.fls
|
||||||
|
*.fdb_latexmk
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
/.quarto/
|
||||||
|
**/*.quarto_ipynb
|
||||||
|
|
||||||
|
/.luarc.json
|
||||||
|
|
||||||
|
# notes extension: glossary cache, hand-in extracts
|
||||||
|
/.gls-cache*.lua
|
||||||
|
/_handin/
|
||||||
|
|
||||||
|
# message boards produced by running the tutorial's services. The one from
|
||||||
|
# step 18 is committed on purpose (it is a record of that run); later boards
|
||||||
|
# are runtime data.
|
||||||
|
SIN.04028-From-Calling-to-Eventing/supplemental-java/**/messageBoard-*/
|
||||||
|
|
||||||
|
# server files (temp here to test)
|
||||||
|
/_srv/
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# [Step 0 — What this is about]{.en}[Étape 0 — De quoi il s'agit]{.fr}[Schritt 0 — Worum es geht]{.de} {#sec-step-0}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Step 0 contains no code. It states the subject: not ROT13, but the architecture around it. The functionality stays almost unchanged for 81 steps, which is what makes the changes around it visible.
|
||||||
|
|
||||||
|
Two rules are set here and hold all the way through:
|
||||||
|
|
||||||
|
> **Meet each solution only after you have experienced the problem it solves.**
|
||||||
|
|
||||||
|
That is why the build-up does not start with MQTT, and not with dynamic subscriptions either. A system with deliberately awkward mediators is built first, put into operation, and only then asked whether those mediators have earned their place.
|
||||||
|
|
||||||
|
The second rule is about vocabulary: *Intent*, *Status/State* and *Event* are named only after they have been used. They appear around step 42, not before.
|
||||||
|
|
||||||
|
The planned route, from step 0:
|
||||||
|
|
||||||
|
```text
|
||||||
|
direct method calls → egoistic services → mediators → separate processes
|
||||||
|
→ filesystem as transport → Syncthing → "why all these mediators?" → rewind
|
||||||
|
→ services subscribe themselves → dynamic wiring → across processes
|
||||||
|
→ across Syncthing → when a mediator IS useful → MQTT
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
L'étape 0 ne contient aucun code. Elle énonce le sujet : non pas ROT13, mais l'architecture autour de lui. La fonctionnalité reste presque inchangée pendant 81 étapes, et c'est précisément ce qui rend visibles les changements alentour.
|
||||||
|
|
||||||
|
Deux règles sont posées ici et valent jusqu'au bout :
|
||||||
|
|
||||||
|
> **Ne rencontrer une solution qu'après avoir vécu le problème qu'elle résout.**
|
||||||
|
|
||||||
|
C'est pourquoi la construction ne commence ni par MQTT, ni par les abonnements dynamiques. Un système aux médiateurs délibérément maladroits est bâti d'abord, mis en service, et l'on demande seulement ensuite s'ils ont mérité leur place.
|
||||||
|
|
||||||
|
La seconde règle concerne le vocabulaire : *Intent*, *Status/State* et *Event* ne sont nommés qu'après avoir été utilisés. Ils apparaissent vers l'étape 42, pas avant.
|
||||||
|
|
||||||
|
L'itinéraire prévu, dès l'étape 0 :
|
||||||
|
|
||||||
|
```text
|
||||||
|
direct method calls → egoistic services → mediators → separate processes
|
||||||
|
→ filesystem as transport → Syncthing → "why all these mediators?" → rewind
|
||||||
|
→ services subscribe themselves → dynamic wiring → across processes
|
||||||
|
→ across Syncthing → when a mediator IS useful → MQTT
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Schritt 0 enthält keinen Code. Er nennt das Thema: nicht ROT13, sondern die Architektur darum herum. Die Funktionalität bleibt über 81 Schritte fast unverändert — genau das macht die Veränderungen ringsherum sichtbar.
|
||||||
|
|
||||||
|
Zwei Regeln werden hier gesetzt und gelten bis zum Schluss:
|
||||||
|
|
||||||
|
> **Einer Lösung erst begegnen, nachdem man das Problem erlebt hat, das sie löst.**
|
||||||
|
|
||||||
|
Deshalb beginnt der Aufbau nicht mit MQTT und auch nicht mit dynamischen Abonnements. Zuerst entsteht ein System mit absichtlich unbequemen Vermittlern, wird in Betrieb genommen, und erst dann wird gefragt, ob sie ihren Platz verdient haben.
|
||||||
|
|
||||||
|
Die zweite Regel betrifft das Vokabular: *Intent*, *Status/State* und *Event* werden erst benannt, nachdem sie benutzt wurden. Sie erscheinen etwa ab Schritt 42, nicht früher.
|
||||||
|
|
||||||
|
Die geplante Route, von Schritt 0 an:
|
||||||
|
|
||||||
|
```text
|
||||||
|
direct method calls → egoistic services → mediators → separate processes
|
||||||
|
→ filesystem as transport → Syncthing → "why all these mediators?" → rewind
|
||||||
|
→ services subscribe themselves → dynamic wiring → across processes
|
||||||
|
→ across Syncthing → when a mediator IS useful → MQTT
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The three questions]{.en}[Les trois questions]{.fr}[Die drei Fragen]{.de} {#sec-three-questions}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The wording of the three questions matters, and it is easy to replace it with something weaker:
|
||||||
|
|
||||||
|
| As asked here | A weaker version |
|
||||||
|
|---|---|
|
||||||
|
| Who **knows** whom? | who *communicates* with whom |
|
||||||
|
| Who **owns** what? | which *data* each part holds |
|
||||||
|
| Who **decides** how the system is wired? | which part *connects* everything |
|
||||||
|
|
||||||
|
"Knowing" is not "communicating": two components can exchange messages all day without either one naming the other. "Deciding the wiring" is not "connecting": the part that forwards messages need not be the part that chose the route. Both distinctions become concrete later — the first already in step 1, the second in part III.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
La formulation des trois questions compte, et il est facile de la remplacer par une version plus faible :
|
||||||
|
|
||||||
|
| Telle qu'elle est posée ici | Une version plus faible |
|
||||||
|
|---|---|
|
||||||
|
| Qui **connaît** qui ? | qui *communique* avec qui |
|
||||||
|
| Qui **possède** quoi ? | quelles *données* détient chaque partie |
|
||||||
|
| Qui **décide** du câblage ? | quelle partie *relie* le tout |
|
||||||
|
|
||||||
|
« Connaître » n'est pas « communiquer » : deux composants peuvent échanger des messages toute la journée sans que l'un nomme l'autre. « Décider du câblage » n'est pas « relier » : la partie qui transmet les messages n'est pas forcément celle qui a choisi la route. Les deux distinctions deviennent concrètes plus tard — la première dès l'étape 1, la seconde dans la partie III.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Der Wortlaut der drei Fragen ist wichtig, und man ersetzt ihn leicht durch eine schwächere Fassung:
|
||||||
|
|
||||||
|
| So gefragt | Eine schwächere Fassung |
|
||||||
|
|---|---|
|
||||||
|
| Wer **kennt** wen? | wer mit wem *kommuniziert* |
|
||||||
|
| Wer **besitzt** was? | welche *Daten* jeder Teil hält |
|
||||||
|
| Wer **entscheidet** über die Verdrahtung? | welcher Teil alles *verbindet* |
|
||||||
|
|
||||||
|
„Kennen“ ist nicht „kommunizieren“: zwei Komponenten können den ganzen Tag Nachrichten austauschen, ohne dass eine die andere nennt. „Über die Verdrahtung entscheiden“ ist nicht „verbinden“: der Teil, der Nachrichten weiterleitet, muss nicht der Teil sein, der die Route gewählt hat. Beide Unterscheidungen werden später konkret — die erste schon in Schritt 1, die zweite in Teil III.
|
||||||
|
:::
|
||||||
@@ -0,0 +1,373 @@
|
|||||||
|
# [Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de} {#sec-part-i}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Steps 1 to 10 stay inside one JVM. The system is built three times: as direct calls, as three capabilities that refuse to know each other, and as those same capabilities glued together by mediators. Nothing is distributed yet, and that is the point: the only thing that changes is who knows whom.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les étapes 1 à 10 restent dans une seule JVM. Le système est construit trois fois : en appels directs, en trois capacités qui refusent de se connaître, puis en ces mêmes capacités reliées par des médiateurs. Rien n'est encore distribué, et c'est bien l'idée : la seule chose qui change est qui connaît qui.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Schritte 1 bis 10 bleiben in einer JVM. Das System wird dreimal gebaut: als direkte Aufrufe, als drei Fähigkeiten, die einander nicht kennen wollen, und als dieselben Fähigkeiten, von Vermittlern zusammengeklebt. Nichts ist bisher verteilt, und genau das ist der Punkt: das Einzige, was sich ändert, ist wer wen kennt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 1 — Rock bottom: just call it]{.en}[Étape 1 — Au plus simple : appeler, point]{.fr}[Schritt 1 — Ganz unten: einfach aufrufen]{.de} {#sec-step-1}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
`ProceduralRot13.java` is the whole system in one compact source file: a loop that reads a line, and one statement that prints the rotated text.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void main() {
|
||||||
|
while (true) {
|
||||||
|
var text = IO.readln();
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IO.println(rot13(text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`IO.readln()` stands on its own line, but `rot13(text)` is not a step of its own: it is called *inside* the argument of `IO.println`. Neither `rot13` nor `IO.println` knows anything about the other. The one that knows both is `main()`, which names them and fixes their order.
|
||||||
|
|
||||||
|
What `main()` knows about `rot13`: that it exists, how to invoke it (a bare name, both live in the same implicitly generated class), what argument it takes, what it returns, that it is available *right now*, and that execution continues after it returns. It does not know how `rot13` is implemented — that is the one thing it can ignore.
|
||||||
|
|
||||||
|
The availability guarantee is worth naming, because it disappears later: `main()` and `rot13` are two methods of one already-loaded class, called on the same thread, in the same process. Nothing has to be started first, no message travels anywhere, no listener has to be subscribed.
|
||||||
|
|
||||||
|
**Observed:** typing a line prints it rotated; `Ctrl+D` ends the program silently, because `IO.readln()` returns `null` and `main()` returns.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
`ProceduralRot13.java` est le système entier dans un seul fichier source compact : une boucle qui lit une ligne, et une instruction qui affiche le texte transformé.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void main() {
|
||||||
|
while (true) {
|
||||||
|
var text = IO.readln();
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IO.println(rot13(text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`IO.readln()` occupe sa propre ligne, mais `rot13(text)` n'est pas une étape distincte : il est appelé *dans* l'argument de `IO.println`. Ni `rot13` ni `IO.println` ne sait quoi que ce soit de l'autre. Celui qui connaît les deux, c'est `main()`, qui les nomme et fixe leur ordre.
|
||||||
|
|
||||||
|
Ce que `main()` sait de `rot13` : qu'il existe, comment l'invoquer (un simple nom, tous deux vivent dans la même classe générée implicitement), quel argument il prend, ce qu'il retourne, qu'il est disponible *à l'instant*, et que l'exécution continue après son retour. Il ne sait pas comment `rot13` est implémenté — c'est la seule chose qu'il peut ignorer.
|
||||||
|
|
||||||
|
La garantie de disponibilité mérite d'être nommée, car elle disparaîtra plus tard : `main()` et `rot13` sont deux méthodes d'une classe déjà chargée, appelées sur le même fil, dans le même processus. Rien n'a besoin d'être démarré d'abord, aucun message ne voyage, aucun auditeur n'a besoin d'être abonné.
|
||||||
|
|
||||||
|
**Observé :** taper une ligne l'affiche transformée ; `Ctrl+D` termine le programme sans rien afficher, car `IO.readln()` retourne `null` et `main()` retourne.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
`ProceduralRot13.java` ist das ganze System in einer kompakten Quelldatei: eine Schleife, die eine Zeile liest, und eine Anweisung, die den rotierten Text ausgibt.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void main() {
|
||||||
|
while (true) {
|
||||||
|
var text = IO.readln();
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IO.println(rot13(text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`IO.readln()` steht in einer eigenen Zeile, `rot13(text)` aber ist kein eigener Schritt: es wird *innerhalb* des Arguments von `IO.println` aufgerufen. Weder `rot13` noch `IO.println` weiss etwas vom anderen. Wer beide kennt, ist `main()`: es nennt sie und legt ihre Reihenfolge fest.
|
||||||
|
|
||||||
|
Was `main()` über `rot13` weiss: dass es existiert, wie man es aufruft (ein blosser Name, beide liegen in derselben implizit erzeugten Klasse), welches Argument es nimmt, was es zurückgibt, dass es *jetzt sofort* verfügbar ist und dass die Ausführung nach der Rückkehr weiterläuft. Nicht bekannt ist, wie `rot13` implementiert ist — das Einzige, was es ignorieren darf.
|
||||||
|
|
||||||
|
Die Verfügbarkeitsgarantie lohnt eine eigene Erwähnung, denn sie verschwindet später: `main()` und `rot13` sind zwei Methoden einer bereits geladenen Klasse, aufgerufen im selben Thread, im selben Prozess. Nichts muss zuerst starten, keine Nachricht reist irgendwohin, kein Empfänger muss abonniert sein.
|
||||||
|
|
||||||
|
**Beobachtet:** eine getippte Zeile erscheint rotiert; `Ctrl+D` beendet das Programm still, weil `IO.readln()` `null` zurückgibt und `main()` zurückkehrt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
![[The procedural version. The wiring is written into the code: `main()` names all three parts and fixes their order.]{.en}[La version procédurale. Le câblage est écrit dans le code : `main()` nomme les trois parties et fixe leur ordre.]{.fr}[Die prozedurale Fassung. Die Verdrahtung steht im Code: `main()` nennt alle drei Teile und legt ihre Reihenfolge fest.]{.de}](figures/direct-calls-@tr{langcode}){#fig-direct-calls .flow-figure}
|
||||||
|
|
||||||
|
## [Step 2 — Three egoistic capabilities]{.en}[Étape 2 — Trois capacités égoïstes]{.fr}[Schritt 2 — Drei egoistische Fähigkeiten]{.de} {#sec-step-2}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
An **egoistic** component says: I know what I can do, what data I accept and what data I produce — and I would rather not know the business process around me. Concretely, `ConsoleIn` must not contain `rot13(...)`, and `ROT13` must not contain `consoleOut(...)`.
|
||||||
|
|
||||||
|
Removing those calls immediately creates a problem, best put as a question: if nobody knows anybody, **who makes this into a system?** Note what the question does *not* say: the knowledge is not gone, it has to go somewhere else. Two connections are missing, not one — `ConsoleIn ↔ ROT13` and `ROT13 ↔ ConsoleOut`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Un composant **égoïste** dit : je sais ce que je peux faire, quelles données j'accepte et quelles données je produis — et je préfère ne pas connaître le processus métier qui m'entoure. Concrètement, `ConsoleIn` ne doit pas contenir `rot13(...)`, et `ROT13` ne doit pas contenir `consoleOut(...)`.
|
||||||
|
|
||||||
|
Supprimer ces appels crée aussitôt un problème, qui se pose en question : si personne ne connaît personne, **qui fait de cela un système ?** Notez ce que la question ne dit pas : la connaissance n'a pas disparu, elle doit aller ailleurs. Il manque deux liaisons, pas une — `ConsoleIn ↔ ROT13` et `ROT13 ↔ ConsoleOut`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Eine **egoistische** Komponente sagt: ich weiss, was ich kann, welche Daten ich annehme und welche ich erzeuge — und den Geschäftsprozess um mich herum möchte ich lieber nicht kennen. Konkret: `ConsoleIn` darf kein `rot13(...)` enthalten, und `ROT13` kein `consoleOut(...)`.
|
||||||
|
|
||||||
|
Das Entfernen dieser Aufrufe schafft sofort ein Problem, das sich als Frage stellen lässt: wenn niemand niemanden kennt, **wer macht daraus ein System?** Zu beachten ist, was die Frage nicht sagt: das Wissen ist nicht verschwunden, es muss woandershin. Es fehlen zwei Verbindungen, nicht eine — `ConsoleIn ↔ ROT13` und `ROT13 ↔ ConsoleOut`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 3 — Give every capability a mailbox]{.en}[Étape 3 — Donner une boîte aux lettres à chaque capacité]{.fr}[Schritt 3 — Jeder Fähigkeit ein Postfach geben]{.de} {#sec-step-3}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The smallest mechanism for the missing connections: a message and a named queue.
|
||||||
|
|
||||||
|
```java
|
||||||
|
record Message(String type, String value) {}
|
||||||
|
|
||||||
|
Map<String, BlockingQueue<Message>> mailboxes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
BlockingQueue<Message> mailbox(String name) {
|
||||||
|
return mailboxes.computeIfAbsent(name, _ -> new LinkedBlockingQueue<>());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
These are **mailboxes**, not topics, and the distinction is worth insisting on: if two readers call `take()` on the same mailbox, they compete — each message goes to exactly *one* of them and is not copied to both. A topic, in Publish/Subscribe, would hand every subscriber its own copy. One reader per message is enough for now, and the limitation is kept on purpose: it is what makes it clear later what Publish/Subscribe actually adds.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Le plus petit mécanisme pour les liaisons manquantes : un message et une file nommée.
|
||||||
|
|
||||||
|
```java
|
||||||
|
record Message(String type, String value) {}
|
||||||
|
|
||||||
|
Map<String, BlockingQueue<Message>> mailboxes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
BlockingQueue<Message> mailbox(String name) {
|
||||||
|
return mailboxes.computeIfAbsent(name, _ -> new LinkedBlockingQueue<>());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Ce sont des **boîtes aux lettres** (*mailboxes*) et non des sujets (*topics*), et la distinction mérite qu'on y insiste : si deux lecteurs appellent `take()` sur la même boîte, ils sont en concurrence — chaque message va à *un seul* d'entre eux et n'est pas copié aux deux. Un *topic*, en Publish/Subscribe, remettrait à chaque abonné sa propre copie. Un lecteur par message suffit pour l'instant, et la limitation est conservée volontairement : c'est elle qui rendra visible plus tard ce que Publish/Subscribe apporte réellement.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Der kleinste Mechanismus für die fehlenden Verbindungen: eine Nachricht und eine benannte Warteschlange.
|
||||||
|
|
||||||
|
```java
|
||||||
|
record Message(String type, String value) {}
|
||||||
|
|
||||||
|
Map<String, BlockingQueue<Message>> mailboxes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
BlockingQueue<Message> mailbox(String name) {
|
||||||
|
return mailboxes.computeIfAbsent(name, _ -> new LinkedBlockingQueue<>());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Das sind bewusst **Postfächer** (*mailboxes*) und keine Topics, und der Unterschied ist wichtig: rufen zwei Leser `take()` auf demselben Postfach auf, konkurrieren sie — jede Nachricht geht an *genau einen* von ihnen und wird nicht an beide kopiert. Ein Topic in Publish/Subscribe gäbe jedem Abonnenten seine eigene Kopie. Ein Leser pro Nachricht genügt vorläufig, und die Einschränkung bleibt absichtlich bestehen: sie macht später sichtbar, was Publish/Subscribe wirklich hinzufügt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Steps 4–6 — The three capabilities become egoistic]{.en}[Étapes 4–6 — Les trois capacités deviennent égoïstes]{.fr}[Schritte 4–6 — Die drei Fähigkeiten werden egoistisch]{.de} {#sec-steps-4-6}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Each capability now touches only its own mailbox names:
|
||||||
|
|
||||||
|
| Capability | reads | writes |
|
||||||
|
|---|---|---|
|
||||||
|
| ConsoleIn | the keyboard | `consoleIn.outbox` |
|
||||||
|
| ROT13 | `rot13.inbox` | `rot13.outbox` |
|
||||||
|
| ConsoleOut | `consoleOut.inbox` | the console |
|
||||||
|
|
||||||
|
No capability contains the name of another, and that is exactly the result: three nicely isolated capabilities that do absolutely nothing together. Nothing moves a message from `consoleIn.outbox` to `rot13.inbox`, or from `rot13.outbox` to `consoleOut.inbox`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Chaque capacité ne touche plus que ses propres noms de boîtes :
|
||||||
|
|
||||||
|
| Capacité | lit | écrit |
|
||||||
|
|---|---|---|
|
||||||
|
| ConsoleIn | le clavier | `consoleIn.outbox` |
|
||||||
|
| ROT13 | `rot13.inbox` | `rot13.outbox` |
|
||||||
|
| ConsoleOut | `consoleOut.inbox` | la console |
|
||||||
|
|
||||||
|
Aucune capacité ne contient le nom d'une autre, et c'est exactement le résultat : trois capacités bien isolées qui ne font absolument rien ensemble. Rien ne déplace un message de `consoleIn.outbox` vers `rot13.inbox`, ni de `rot13.outbox` vers `consoleOut.inbox`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Jede Fähigkeit berührt nur noch ihre eigenen Postfachnamen:
|
||||||
|
|
||||||
|
| Fähigkeit | liest | schreibt |
|
||||||
|
|---|---|---|
|
||||||
|
| ConsoleIn | die Tastatur | `consoleIn.outbox` |
|
||||||
|
| ROT13 | `rot13.inbox` | `rot13.outbox` |
|
||||||
|
| ConsoleOut | `consoleOut.inbox` | die Konsole |
|
||||||
|
|
||||||
|
Keine Fähigkeit enthält den Namen einer anderen, und genau das ist das Ergebnis: drei schön isolierte Fähigkeiten, die zusammen absolut nichts tun. Nichts bewegt eine Nachricht von `consoleIn.outbox` nach `rot13.inbox` oder von `rot13.outbox` nach `consoleOut.inbox`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 7 — Enter the mediator]{.en}[Étape 7 — Entre le médiateur]{.fr}[Schritt 7 — Auftritt des Vermittlers]{.de} {#sec-step-7}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The smallest possible glue: a loop that takes from one mailbox and puts into another, knowing nothing about what travels through it.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void mediate(String from, String to) {
|
||||||
|
while (true)
|
||||||
|
mailbox(to).put(mailbox(from).take());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`main()` starts five virtual threads: the three capabilities, plus two mediators whose routes are given as arguments — `consoleIn.outbox → rot13.inbox` and `rot13.outbox → consoleOut.inbox`.
|
||||||
|
|
||||||
|
**Observed:** `Hello World` in, `Uryyb Jbeyq` out, exactly as in step 1. But `Ctrl+D` no longer ends the program. ConsoleIn's thread *returns* (it does not loop), and the other four threads sit blocked in `take()` on empty mailboxes, using no CPU. What actually keeps the process alive is the last line of `main()`, `Thread.currentThread().join()`: the main thread waits for itself, which can never finish. Virtual threads are daemon threads, so those four waiting threads would not have kept the JVM running on their own.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
La colle la plus simple possible : une boucle qui retire d'une boîte et dépose dans une autre, sans rien savoir de ce qui la traverse.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void mediate(String from, String to) {
|
||||||
|
while (true)
|
||||||
|
mailbox(to).put(mailbox(from).take());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`main()` démarre cinq threads virtuels : les trois capacités, plus deux médiateurs dont les routes sont passées en arguments — `consoleIn.outbox → rot13.inbox` et `rot13.outbox → consoleOut.inbox`.
|
||||||
|
|
||||||
|
**Observé :** `Hello World` en entrée, `Uryyb Jbeyq` en sortie, exactement comme à l'étape 1. Mais `Ctrl+D` ne termine plus le programme. Le thread de ConsoleIn *retourne* (il ne boucle pas), et les quatre autres threads restent bloqués dans `take()` sur des boîtes vides, sans consommer de CPU. Ce qui maintient réellement le processus en vie, c'est la dernière ligne de `main()`, `Thread.currentThread().join()` : le thread principal s'attend lui-même, ce qui ne peut jamais aboutir. Les threads virtuels sont des threads *daemon* : ces quatre threads en attente n'auraient donc pas maintenu la JVM en vie à eux seuls.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Der kleinstmögliche Klebstoff: eine Schleife, die aus einem Postfach nimmt und in ein anderes legt, ohne etwas über das Durchlaufende zu wissen.
|
||||||
|
|
||||||
|
```java
|
||||||
|
void mediate(String from, String to) {
|
||||||
|
while (true)
|
||||||
|
mailbox(to).put(mailbox(from).take());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`main()` startet fünf virtuelle Threads: die drei Fähigkeiten plus zwei Vermittler, deren Routen als Argumente übergeben werden — `consoleIn.outbox → rot13.inbox` und `rot13.outbox → consoleOut.inbox`.
|
||||||
|
|
||||||
|
**Beobachtet:** `Hello World` hinein, `Uryyb Jbeyq` heraus, genau wie in Schritt 1. Aber `Ctrl+D` beendet das Programm nicht mehr. Der Thread von ConsoleIn *kehrt zurück* (er schleift nicht), und die vier anderen Threads hängen blockiert in `take()` an leeren Postfächern, ohne CPU zu verbrauchen. Am Leben hält den Prozess tatsächlich die letzte Zeile von `main()`, `Thread.currentThread().join()`: der Haupt-Thread wartet auf sich selbst, was nie enden kann. Virtuelle Threads sind Daemon-Threads; die vier wartenden Threads allein hätten die JVM also nicht am Laufen gehalten.
|
||||||
|
:::
|
||||||
|
|
||||||
|
![[The mediated version inside one JVM. In the web version, **Play** walks one message through all eight hops.]{.en}[La version médiatisée dans une seule JVM. Dans la version web, **Lancer** fait parcourir à un message les huit sauts.]{.fr}[Die vermittelte Fassung in einer JVM. In der Webfassung schickt **Abspielen** eine Nachricht durch alle acht Sprünge.]{.de}](figures/mailboxes-jvm-@tr{langcode}){#fig-mailboxes-jvm .flow-figure}
|
||||||
|
|
||||||
|
## [Step 8 — Ask again: who knows whom?]{.en}[Étape 8 — Redemander : qui connaît qui ?]{.fr}[Schritt 8 — Nochmals fragen: wer kennt wen?]{.de} {#sec-step-8}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Does ConsoleIn know ROT13? No. Does ROT13 know ConsoleIn or ConsoleOut? No. Has the topology disappeared? No — it sits in the two `mediate(...)` calls inside `main()`.
|
||||||
|
|
||||||
|
This is the first major result:
|
||||||
|
|
||||||
|
> **Decoupling often does not make knowledge disappear. It moves knowledge to where it belongs.**
|
||||||
|
|
||||||
|
The capability "ROT13 transforms text" belongs to ROT13. The topology `ConsoleIn → ROT13 → ConsoleOut` belongs to system composition. What changed since step 1 is not that the wiring left `main()` — it is still there — but that it is no longer written *inside* a capability. It is now data: two pairs of mailbox names. Rewiring touches those two lines and no capability at all.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
ConsoleIn connaît-il ROT13 ? Non. ROT13 connaît-il ConsoleIn ou ConsoleOut ? Non. La topologie a-t-elle disparu ? Non — elle se trouve dans les deux appels `mediate(...)` à l'intérieur de `main()`.
|
||||||
|
|
||||||
|
C'est le premier résultat majeur :
|
||||||
|
|
||||||
|
> **Le découplage ne fait souvent pas disparaître la connaissance. Il la déplace là où elle appartient.**
|
||||||
|
|
||||||
|
La capacité « ROT13 transforme du texte » appartient à ROT13. La topologie `ConsoleIn → ROT13 → ConsoleOut` appartient à la composition du système. Ce qui a changé depuis l'étape 1, ce n'est pas que le câblage a quitté `main()` — il y est toujours — mais qu'il n'est plus écrit *à l'intérieur* d'une capacité. C'est désormais une donnée : deux paires de noms de boîtes. Recâbler touche ces deux lignes et aucune capacité.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Kennt ConsoleIn ROT13? Nein. Kennt ROT13 ConsoleIn oder ConsoleOut? Nein. Ist die Topologie verschwunden? Nein — sie steckt in den zwei `mediate(...)`-Aufrufen innerhalb von `main()`.
|
||||||
|
|
||||||
|
Das ist das erste grosse Ergebnis:
|
||||||
|
|
||||||
|
> **Entkopplung lässt Wissen oft nicht verschwinden. Sie verschiebt Wissen dorthin, wo es hingehört.**
|
||||||
|
|
||||||
|
Die Fähigkeit „ROT13 transformiert Text" gehört zu ROT13. Die Topologie `ConsoleIn → ROT13 → ConsoleOut` gehört zur Systemkomposition. Geändert hat sich seit Schritt 1 nicht, dass die Verdrahtung `main()` verlassen hat — sie ist noch dort —, sondern dass sie nicht mehr *innerhalb* einer Fähigkeit steht. Sie ist jetzt Daten: zwei Paare von Postfachnamen. Umverdrahten berührt diese zwei Zeilen und keine einzige Fähigkeit.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 9 — Why virtual threads?]{.en}[Étape 9 — Pourquoi des threads virtuels ?]{.fr}[Schritt 9 — Warum virtuelle Threads?]{.de} {#sec-step-9}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Five loops now wait indefinitely: the keyboard, `rot13.inbox`, `consoleOut.inbox` and the two mediators' sources. Virtual threads are simply the cheap Java way to let five waits happen at once inside one JVM.
|
||||||
|
|
||||||
|
They are an implementation convenience, not an architecture. The architecture — who knows whom, and where the wiring lives — is in the mailbox names, not in the threads. The evidence for the separation: the same architecture will run as separate processes in step 11, with no threads shared between the parts.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Cinq boucles attendent désormais indéfiniment : le clavier, `rot13.inbox`, `consoleOut.inbox` et les sources des deux médiateurs. Les threads virtuels sont simplement le moyen Java peu coûteux de faire attendre cinq choses à la fois dans une seule JVM.
|
||||||
|
|
||||||
|
C'est une commodité d'implémentation, pas une architecture. L'architecture — qui connaît qui, et où vit le câblage — réside dans les noms de boîtes, pas dans les threads. La preuve de cette séparation : la même architecture tournera en processus séparés à l'étape 11, sans aucun thread partagé entre les parties.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Fünf Schleifen warten nun unbegrenzt: die Tastatur, `rot13.inbox`, `consoleOut.inbox` und die Quellen der zwei Vermittler. Virtuelle Threads sind einfach der billige Java-Weg, fünf Wartevorgänge gleichzeitig in einer JVM laufen zu lassen.
|
||||||
|
|
||||||
|
Sie sind eine Implementierungsbequemlichkeit, keine Architektur. Die Architektur — wer wen kennt und wo die Verdrahtung liegt — steckt in den Postfachnamen, nicht in den Threads. Der Beleg für die Trennung: dieselbe Architektur läuft in Schritt 11 als getrennte Prozesse, ohne geteilte Threads zwischen den Teilen.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 10 — Keep the services egoistic]{.en}[Étape 10 — Garder les services égoïstes]{.fr}[Schritt 10 — Die Dienste egoistisch halten]{.de} {#sec-step-10}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The obvious shortcut: the first mediator only copies messages unchanged, so why not delete it and let ROT13 `take()` from `consoleIn.outbox` directly?
|
||||||
|
|
||||||
|
Because ROT13 would then contain the name `consoleIn.outbox`, which means it would know that ConsoleIn exists and where it publishes. The topology would move *into* ROT13, and ROT13 would stop being an egoistic capability. The test that makes this concrete: suppose the input comes from a new `FileIn` capability publishing to `fileIn.outbox`.
|
||||||
|
|
||||||
|
| | with the mediator | with the shortcut |
|
||||||
|
|---|---|---|
|
||||||
|
| what changes | one argument of the mediator | `runRot13` itself |
|
||||||
|
| who is touched | no capability | ROT13, whose job did not change |
|
||||||
|
|
||||||
|
The price is worth stating plainly: this design may look indirect — even a little odd. There is another way to keep services egoistic *without* a mediator in every message's path, and it comes later.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Le raccourci évident : le premier médiateur ne fait que recopier les messages tels quels, alors pourquoi ne pas le supprimer et laisser ROT13 faire `take()` directement sur `consoleIn.outbox` ?
|
||||||
|
|
||||||
|
Parce que ROT13 contiendrait alors le nom `consoleIn.outbox`, c'est-à-dire qu'il saurait que ConsoleIn existe et où il publie. La topologie entrerait *dans* ROT13, et ROT13 cesserait d'être une capacité égoïste. Le test qui rend cela concret : supposons que l'entrée vienne d'une nouvelle capacité `FileIn` publiant dans `fileIn.outbox`.
|
||||||
|
|
||||||
|
| | avec le médiateur | avec le raccourci |
|
||||||
|
|---|---|---|
|
||||||
|
| ce qui change | un argument du médiateur | `runRot13` lui-même |
|
||||||
|
| qui est touché | aucune capacité | ROT13, dont le travail n'a pas changé |
|
||||||
|
|
||||||
|
Le prix mérite d'être dit clairement : ce design peut sembler indirect — voire un peu bizarre. Il existe une autre manière de garder les services égoïstes *sans* médiateur sur le chemin de chaque message ; elle viendra plus tard.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die naheliegende Abkürzung: der erste Vermittler kopiert Nachrichten nur unverändert — warum ihn also nicht löschen und ROT13 direkt `take()` auf `consoleIn.outbox` machen lassen?
|
||||||
|
|
||||||
|
Weil ROT13 dann den Namen `consoleIn.outbox` enthielte, also wüsste, dass ConsoleIn existiert und wohin es veröffentlicht. Die Topologie wanderte *in* ROT13 hinein, und ROT13 wäre keine egoistische Fähigkeit mehr. Der Test, der das konkret macht: die Eingabe komme künftig von einer neuen Fähigkeit `FileIn`, die in `fileIn.outbox` veröffentlicht.
|
||||||
|
|
||||||
|
| | mit Vermittler | mit der Abkürzung |
|
||||||
|
|---|---|---|
|
||||||
|
| was sich ändert | ein Argument des Vermittlers | `runRot13` selbst |
|
||||||
|
| wer berührt wird | keine Fähigkeit | ROT13, dessen Aufgabe unverändert blieb |
|
||||||
|
|
||||||
|
Der Preis gehört klar gesagt: dieses Design mag indirekt wirken — sogar etwas eigenartig. Es gibt einen anderen Weg, Dienste egoistisch zu halten, *ohne* Vermittler im Pfad jeder Nachricht; er kommt später.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What part I moved]{.en}[Ce que la partie I a déplacé]{.fr}[Was Teil I verschoben hat]{.de} {#sec-part-i-result}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
| stage | where the topology lives | who could rewire it |
|
||||||
|
|---|---|---|
|
||||||
|
| step 1 | inside the capability code (`IO.println(rot13(text))`) | whoever edits that code |
|
||||||
|
| steps 7–8 | in `main()`, as pairs of mailbox names | whoever edits `main()` |
|
||||||
|
|
||||||
|
Functionality: unchanged. Lines of code: more. Parts that know each other: none. That is the trade everything that follows keeps testing.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
| étape | où vit la topologie | qui peut recâbler |
|
||||||
|
|---|---|---|
|
||||||
|
| étape 1 | dans le code de la capacité (`IO.println(rot13(text))`) | celui qui édite ce code |
|
||||||
|
| étapes 7–8 | dans `main()`, en paires de noms de boîtes | celui qui édite `main()` |
|
||||||
|
|
||||||
|
Fonctionnalité : inchangée. Lignes de code : davantage. Parties qui se connaissent : aucune. C'est le compromis que tout ce qui suit continue de mettre à l'épreuve.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
| Stufe | wo die Topologie liegt | wer umverdrahten kann |
|
||||||
|
|---|---|---|
|
||||||
|
| Schritt 1 | im Code der Fähigkeit (`IO.println(rot13(text))`) | wer diesen Code ändert |
|
||||||
|
| Schritte 7–8 | in `main()`, als Paare von Postfachnamen | wer `main()` ändert |
|
||||||
|
|
||||||
|
Funktionalität: unverändert. Codezeilen: mehr. Teile, die einander kennen: keine. Das ist der Tauschhandel, den alles Folgende immer wieder prüft.
|
||||||
|
:::
|
||||||
@@ -0,0 +1,361 @@
|
|||||||
|
# [Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de} {#sec-part-ii}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Steps 11 to 18 take the architecture of part I and split it across five operating-system processes on one computer. The capabilities keep their mailbox names; only the transport underneath changes, from Java objects to files in directories. The first genuinely distributed problem shows up here, and it has nothing to do with ROT13.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les étapes 11 à 18 reprennent l'architecture de la partie I et la répartissent sur cinq processus du système d'exploitation, sur un seul ordinateur. Les capacités gardent leurs noms de boîtes ; seul le transport en dessous change, des objets Java vers des fichiers dans des répertoires. Le premier problème réellement distribué apparaît ici, et il n'a rien à voir avec ROT13.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Schritte 11 bis 18 nehmen die Architektur aus Teil I und verteilen sie auf fünf Betriebssystemprozesse auf einem Rechner. Die Fähigkeiten behalten ihre Postfachnamen; nur der Transport darunter wechselt, von Java-Objekten zu Dateien in Verzeichnissen. Das erste wirklich verteilte Problem tritt hier auf, und es hat nichts mit ROT13 zu tun.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 11 — Separate the components]{.en}[Étape 11 — Séparer les composants]{.fr}[Schritt 11 — Die Komponenten trennen]{.de} {#sec-step-11}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Three processes cannot share a `BlockingQueue`: every `java` command starts its own JVM with its own memory, so the `mailboxes` map would exist three times and each copy would see only its own messages. An external transport is needed.
|
||||||
|
|
||||||
|
TCP would do, MQTT would do. The most primitive option is picked deliberately, the **filesystem**, for a one-line reason: *because you can see it*. Messages become files you can list with `ls` and read with `cat` while the system runs. Primitive here does not mean inferior; part VIII comes back to what the filesystem is genuinely good and bad at.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Trois processus ne peuvent pas partager une `BlockingQueue` : chaque commande `java` démarre sa propre JVM avec sa propre mémoire, la carte `mailboxes` existerait donc en trois exemplaires et chacun ne verrait que ses propres messages. Il faut un transport externe.
|
||||||
|
|
||||||
|
TCP conviendrait, MQTT conviendrait. C'est délibérément l'option la plus primitive qui est choisie, le **système de fichiers**, pour une raison en une ligne : *parce qu'on peut le voir*. Les messages deviennent des fichiers que l'on peut lister avec `ls` et lire avec `cat` pendant que le système tourne. Primitif ne veut pas dire inférieur : la partie VIII revient sur ce que le système de fichiers fait vraiment bien et vraiment mal.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Drei Prozesse können keine `BlockingQueue` teilen: jeder `java`-Befehl startet seine eigene JVM mit eigenem Speicher, die `mailboxes`-Map existierte also dreimal, und jede Kopie sähe nur ihre eigenen Nachrichten. Ein externer Transport ist nötig.
|
||||||
|
|
||||||
|
TCP würde gehen, MQTT würde gehen. Absichtlich fällt die Wahl auf die primitivste Möglichkeit, das **Dateisystem**, mit einer einzeiligen Begründung: *weil man es sehen kann*. Nachrichten werden Dateien, die man mit `ls` auflisten und mit `cat` lesen kann, während das System läuft. Primitiv heisst hier nicht schlechter; Teil VIII kommt darauf zurück, was das Dateisystem wirklich gut und wirklich schlecht kann.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Steps 12–13 — A directory becomes a mailbox]{.en}[Étapes 12–13 — Un répertoire devient une boîte aux lettres]{.fr}[Schritte 12–13 — Ein Verzeichnis wird zum Postfach]{.de} {#sec-steps-12-13}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The mapping is one line long:
|
||||||
|
|
||||||
|
```text
|
||||||
|
directory = mailbox file = message
|
||||||
|
publish = create file receive = watch directory
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
messageBoard/
|
||||||
|
├── consoleIn/outbox/
|
||||||
|
├── rot13/inbox/
|
||||||
|
├── rot13/outbox/
|
||||||
|
└── consoleOut/inbox/
|
||||||
|
```
|
||||||
|
|
||||||
|
The `Message` record gains an optional timestamp, and the file format stays two lines plus an optional third:
|
||||||
|
|
||||||
|
```text
|
||||||
|
TEXT
|
||||||
|
Hello World
|
||||||
|
TIMESTAMP: 2026-09-22T10:42:12.123Z
|
||||||
|
```
|
||||||
|
|
||||||
|
A message written by hand may leave the timestamp out. The `TIMESTAMP: ` marker keeps a payload line that happens to look like a date from being mistaken for metadata; in this tiny format, a final line starting with `TIMESTAMP: ` is reserved.
|
||||||
|
|
||||||
|
Jackson could be introduced here and deliberately is not. The point of a ridiculously simple format is that almost nothing hides the architecture — the whole message is readable in any text editor, which is what keeps the attention on who talks to whom.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
La correspondance tient en une ligne :
|
||||||
|
|
||||||
|
```text
|
||||||
|
directory = mailbox file = message
|
||||||
|
publish = create file receive = watch directory
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
messageBoard/
|
||||||
|
├── consoleIn/outbox/
|
||||||
|
├── rot13/inbox/
|
||||||
|
├── rot13/outbox/
|
||||||
|
└── consoleOut/inbox/
|
||||||
|
```
|
||||||
|
|
||||||
|
Le record `Message` gagne un horodatage optionnel, et le format de fichier reste deux lignes plus une troisième facultative :
|
||||||
|
|
||||||
|
```text
|
||||||
|
TEXT
|
||||||
|
Hello World
|
||||||
|
TIMESTAMP: 2026-09-22T10:42:12.123Z
|
||||||
|
```
|
||||||
|
|
||||||
|
Un message écrit à la main peut omettre l'horodatage. Le marqueur `TIMESTAMP: ` empêche qu'une ligne de contenu ressemblant à une date soit prise pour une métadonnée ; dans ce format minuscule, une dernière ligne commençant par `TIMESTAMP: ` est réservée.
|
||||||
|
|
||||||
|
Jackson pourrait être introduit ici et ne l'est volontairement pas. L'intérêt d'un format ridiculement simple, c'est que presque rien ne cache l'architecture — le message entier est lisible dans n'importe quel éditeur de texte, ce qui maintient l'attention sur qui parle à qui.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Zuordnung ist eine Zeile lang:
|
||||||
|
|
||||||
|
```text
|
||||||
|
directory = mailbox file = message
|
||||||
|
publish = create file receive = watch directory
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
messageBoard/
|
||||||
|
├── consoleIn/outbox/
|
||||||
|
├── rot13/inbox/
|
||||||
|
├── rot13/outbox/
|
||||||
|
└── consoleOut/inbox/
|
||||||
|
```
|
||||||
|
|
||||||
|
Der `Message`-Record erhält einen optionalen Zeitstempel, und das Dateiformat bleibt zwei Zeilen plus eine optionale dritte:
|
||||||
|
|
||||||
|
```text
|
||||||
|
TEXT
|
||||||
|
Hello World
|
||||||
|
TIMESTAMP: 2026-09-22T10:42:12.123Z
|
||||||
|
```
|
||||||
|
|
||||||
|
Eine handgeschriebene Nachricht darf den Zeitstempel weglassen. Die Marke `TIMESTAMP: ` verhindert, dass eine Inhaltszeile, die zufällig wie ein Datum aussieht, für Metadaten gehalten wird; in diesem winzigen Format ist eine letzte Zeile, die mit `TIMESTAMP: ` beginnt, reserviert.
|
||||||
|
|
||||||
|
Jackson könnte hier eingeführt werden und wird es absichtlich nicht. Der Sinn eines lächerlich einfachen Formats ist, dass fast nichts die Architektur verdeckt — die ganze Nachricht ist in jedem Texteditor lesbar, was die Aufmerksamkeit darauf hält, wer mit wem spricht.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 14 — The first distributed-systems problem: publication]{.en}[Étape 14 — Le premier problème de système distribué : la publication]{.fr}[Schritt 14 — Das erste Problem verteilter Systeme: die Veröffentlichung]{.de} {#sec-step-14}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
A reader watching a directory can discover a file *before the writer has finished writing it*. Hence a publication protocol:
|
||||||
|
|
||||||
|
1. create a private temporary file;
|
||||||
|
2. write the complete message;
|
||||||
|
3. close it;
|
||||||
|
4. atomically rename it to its final `.msg` name;
|
||||||
|
5. consumers react only to final files.
|
||||||
|
|
||||||
|
```java
|
||||||
|
Files.writeString(temporary, content);
|
||||||
|
Files.move(temporary, published, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
```
|
||||||
|
|
||||||
|
Both halves are needed. The rename is atomic — a reader sees either no `.msg` file or the complete one — but it protects nothing if readers also pick up `.tmp` files. `.tmp` and `.msg` stay in the same directory so the move cannot cross filesystems, where atomicity would be lost.
|
||||||
|
|
||||||
|
> **Writing and publishing are not the same operation.**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Un lecteur qui surveille un répertoire peut découvrir un fichier *avant que l'écrivain ait fini de l'écrire*. D'où un protocole de publication :
|
||||||
|
|
||||||
|
1. créer un fichier temporaire privé ;
|
||||||
|
2. écrire le message complet ;
|
||||||
|
3. le fermer ;
|
||||||
|
4. le renommer atomiquement vers son nom final `.msg` ;
|
||||||
|
5. les consommateurs ne réagissent qu'aux fichiers finaux.
|
||||||
|
|
||||||
|
```java
|
||||||
|
Files.writeString(temporary, content);
|
||||||
|
Files.move(temporary, published, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
```
|
||||||
|
|
||||||
|
Les deux moitiés sont nécessaires. Le renommage est atomique — un lecteur voit soit aucun fichier `.msg`, soit le fichier complet — mais il ne protège rien si les lecteurs ramassent aussi les `.tmp`. `.tmp` et `.msg` restent dans le même répertoire, pour que le déplacement ne traverse pas de système de fichiers, où l'atomicité serait perdue.
|
||||||
|
|
||||||
|
> **Écrire et publier ne sont pas la même opération.**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Ein Leser, der ein Verzeichnis beobachtet, kann eine Datei entdecken, *bevor der Schreiber sie fertig geschrieben hat*. Daher ein Veröffentlichungsprotokoll:
|
||||||
|
|
||||||
|
1. eine private temporäre Datei erzeugen;
|
||||||
|
2. die vollständige Nachricht schreiben;
|
||||||
|
3. sie schliessen;
|
||||||
|
4. sie atomar auf ihren endgültigen `.msg`-Namen umbenennen;
|
||||||
|
5. Konsumenten reagieren nur auf endgültige Dateien.
|
||||||
|
|
||||||
|
```java
|
||||||
|
Files.writeString(temporary, content);
|
||||||
|
Files.move(temporary, published, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
```
|
||||||
|
|
||||||
|
Beide Hälften sind nötig. Das Umbenennen ist atomar — ein Leser sieht entweder keine `.msg`-Datei oder die vollständige —, aber es schützt nichts, wenn Leser auch `.tmp`-Dateien aufgreifen. `.tmp` und `.msg` bleiben im selben Verzeichnis, damit der Verschiebevorgang kein Dateisystem überschreitet, wo die Atomarität verloren ginge.
|
||||||
|
|
||||||
|
> **Schreiben und Veröffentlichen sind nicht dieselbe Operation.**
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 15 — Observe a mailbox with `WatchService`]{.en}[Étape 15 — Observer une boîte avec `WatchService`]{.fr}[Schritt 15 — Ein Postfach mit `WatchService` beobachten]{.de} {#sec-step-15}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Java's own filesystem observer supplies the consumer half: register a directory for `ENTRY_CREATE`, block in `watcher.take()`, and ignore every filename that does not end in `.msg`.
|
||||||
|
|
||||||
|
That also gives a low-tech injection tool. With `ActuatorService` running as the consumer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf 'TEXT\nHello from a file' > messageBoard/consoleOut/inbox/manual.tmp
|
||||||
|
mv messageBoard/consoleOut/inbox/manual.tmp messageBoard/consoleOut/inbox/manual.msg
|
||||||
|
```
|
||||||
|
|
||||||
|
**Observed:** nothing happens when the `.tmp` file appears; the line is printed the moment the rename creates the `.msg` name. Both accepted formats work, with and without the trailing timestamp.
|
||||||
|
|
||||||
|
The architectural point reads `producer → filesystem → consumer`: the consumer could not tell a human typing `mv` from a real service. It knows its own inbox, not who writes into it. Egoism survived the process boundary.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
L'observateur de système de fichiers de Java fournit la moitié consommateur : enregistrer un répertoire pour `ENTRY_CREATE`, se bloquer dans `watcher.take()`, et ignorer tout nom de fichier qui ne finit pas par `.msg`.
|
||||||
|
|
||||||
|
Cela donne aussi un outil d'injection très rudimentaire. Avec `ActuatorService` lancé comme consommateur :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf 'TEXT\nHello from a file' > messageBoard/consoleOut/inbox/manual.tmp
|
||||||
|
mv messageBoard/consoleOut/inbox/manual.tmp messageBoard/consoleOut/inbox/manual.msg
|
||||||
|
```
|
||||||
|
|
||||||
|
**Observé :** rien ne se passe à l'apparition du fichier `.tmp` ; la ligne est affichée à l'instant où le renommage crée le nom `.msg`. Les deux formats acceptés fonctionnent, avec et sans horodatage final.
|
||||||
|
|
||||||
|
Le point architectural s'écrit `producer → filesystem → consumer` : le consommateur n'a pas pu distinguer un humain tapant `mv` d'un véritable service. Il connaît sa propre boîte d'entrée, pas qui y écrit. L'égoïsme a survécu à la frontière de processus.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Javas eigener Dateisystem-Beobachter liefert die Konsumentenhälfte: ein Verzeichnis für `ENTRY_CREATE` registrieren, in `watcher.take()` blockieren und jeden Dateinamen ignorieren, der nicht auf `.msg` endet.
|
||||||
|
|
||||||
|
Das ergibt auch ein sehr einfaches Einspeisewerkzeug. Mit `ActuatorService` als laufendem Konsumenten:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf 'TEXT\nHello from a file' > messageBoard/consoleOut/inbox/manual.tmp
|
||||||
|
mv messageBoard/consoleOut/inbox/manual.tmp messageBoard/consoleOut/inbox/manual.msg
|
||||||
|
```
|
||||||
|
|
||||||
|
**Beobachtet:** beim Auftauchen der `.tmp`-Datei geschieht nichts; die Zeile erscheint in dem Moment, in dem das Umbenennen den `.msg`-Namen erzeugt. Beide erlaubten Formate funktionieren, mit und ohne abschliessenden Zeitstempel.
|
||||||
|
|
||||||
|
Die architektonische Lehre lautet `producer → filesystem → consumer`: der Konsument konnte einen Menschen, der `mv` tippt, nicht von einem echten Dienst unterscheiden. Er kennt sein eigenes Eingangspostfach, nicht den, der hineinschreibt. Der Egoismus hat die Prozessgrenze überlebt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Steps 16–17 — Services and mediator become processes]{.en}[Étapes 16–17 — Services et médiateur deviennent des processus]{.fr}[Schritte 16–17 — Dienste und Vermittler werden Prozesse]{.de} {#sec-steps-16-17}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The three capabilities become three programs, and the mediator a fourth kind of program:
|
||||||
|
|
||||||
|
| program | plays | reads | writes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `SensorService.java` | ConsoleIn | the keyboard | `consoleIn/outbox` |
|
||||||
|
| `ProcessorService.java` | ROT13 | `rot13/inbox` | `rot13/outbox` |
|
||||||
|
| `ActuatorService.java` | ConsoleOut | `consoleOut/inbox` | the console |
|
||||||
|
| `Mediator.java <from> <to>` | the glue | `<from>` | `<to>` |
|
||||||
|
|
||||||
|
The mediator is generic: its route is not compiled in, it arrives as two startup arguments. But there is an asymmetry worth keeping in mind: the three capabilities receive their **work** as messages in a mailbox, while the mediator receives its **route** as startup configuration, and it has no name and no control mailbox of its own that anyone could write to.
|
||||||
|
|
||||||
|
The practical consequence: arguments are read once, so changing the route of a running mediator means stopping it and starting it again. A configuration file would be no different — it is still read at startup. This stays deliberately unfixed until the cost of the distributed mediators has been felt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les trois capacités deviennent trois programmes, et le médiateur un quatrième type de programme :
|
||||||
|
|
||||||
|
| programme | joue | lit | écrit |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `SensorService.java` | ConsoleIn | le clavier | `consoleIn/outbox` |
|
||||||
|
| `ProcessorService.java` | ROT13 | `rot13/inbox` | `rot13/outbox` |
|
||||||
|
| `ActuatorService.java` | ConsoleOut | `consoleOut/inbox` | la console |
|
||||||
|
| `Mediator.java <from> <to>` | la colle | `<from>` | `<to>` |
|
||||||
|
|
||||||
|
Le médiateur est générique : sa route n'est pas compilée en dur, elle arrive en deux arguments de démarrage. Mais une asymétrie mérite d'être gardée en tête : les trois capacités reçoivent leur **travail** sous forme de messages dans une boîte, tandis que le médiateur reçoit sa **route** comme configuration de démarrage, et il n'a ni nom ni boîte de contrôle propre où quelqu'un pourrait écrire.
|
||||||
|
|
||||||
|
Conséquence pratique : les arguments sont lus une seule fois, donc changer la route d'un médiateur en cours d'exécution exige de l'arrêter et de le relancer. Un fichier de configuration ne changerait rien — il est lui aussi lu au démarrage. Ce point reste volontairement ouvert jusqu'à ce que le coût des médiateurs distribués ait été ressenti.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die drei Fähigkeiten werden drei Programme, und der Vermittler eine vierte Art Programm:
|
||||||
|
|
||||||
|
| Programm | spielt | liest | schreibt |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `SensorService.java` | ConsoleIn | die Tastatur | `consoleIn/outbox` |
|
||||||
|
| `ProcessorService.java` | ROT13 | `rot13/inbox` | `rot13/outbox` |
|
||||||
|
| `ActuatorService.java` | ConsoleOut | `consoleOut/inbox` | die Konsole |
|
||||||
|
| `Mediator.java <from> <to>` | der Klebstoff | `<from>` | `<to>` |
|
||||||
|
|
||||||
|
Der Vermittler ist generisch: seine Route ist nicht einkompiliert, sie kommt als zwei Startargumente. Doch eine Asymmetrie sollte man im Kopf behalten: die drei Fähigkeiten erhalten ihre **Arbeit** als Nachrichten in einem Postfach, der Vermittler dagegen seine **Route** als Startkonfiguration — und er hat keinen Namen und kein eigenes Steuerpostfach, in das jemand schreiben könnte.
|
||||||
|
|
||||||
|
Praktische Folge: Argumente werden einmal gelesen, das Ändern der Route eines laufenden Vermittlers heisst also: anhalten und neu starten. Eine Konfigurationsdatei wäre nicht anders — auch sie wird beim Start gelesen. Dieser Punkt bleibt absichtlich offen, bis die Kosten der verteilten Vermittler zu spüren waren.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Step 18 — Run the fully external local version]{.en}[Étape 18 — Exécuter la version entièrement externe, en local]{.fr}[Schritt 18 — Die vollständig externe lokale Fassung ausführen]{.de} {#sec-step-18}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Five terminals, five processes, one local filesystem between them:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java SensorService.java # terminal 1
|
||||||
|
java Mediator.java consoleIn/outbox rot13/inbox # terminal 2
|
||||||
|
java ProcessorService.java # terminal 3
|
||||||
|
java Mediator.java rot13/outbox consoleOut/inbox # terminal 4
|
||||||
|
java ActuatorService.java # terminal 5
|
||||||
|
```
|
||||||
|
|
||||||
|
**Observed:** `Hello World` typed in terminal 1 appeared as `Uryyb Jbeyq` in terminal 5. The three middle terminals showed nothing new — each mediator prints one "Mediating: …" line at startup, and `ProcessorService` prints nothing at all. Afterwards each of the four mailbox directories held one `.msg` file: the same line, copied along the chain.
|
||||||
|
|
||||||
|
Count it: **five processes** for what step 1 did in one statement. This is not the moment to optimise: it is not meant to be comfortable yet.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Cinq terminaux, cinq processus, un seul système de fichiers local entre eux :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java SensorService.java # terminal 1
|
||||||
|
java Mediator.java consoleIn/outbox rot13/inbox # terminal 2
|
||||||
|
java ProcessorService.java # terminal 3
|
||||||
|
java Mediator.java rot13/outbox consoleOut/inbox # terminal 4
|
||||||
|
java ActuatorService.java # terminal 5
|
||||||
|
```
|
||||||
|
|
||||||
|
**Observé :** `Hello World` tapé dans le terminal 1 est apparu comme `Uryyb Jbeyq` dans le terminal 5. Les trois terminaux du milieu n'ont rien affiché de nouveau — chaque médiateur affiche une ligne « Mediating: … » au démarrage, et `ProcessorService` n'affiche rien du tout. Ensuite, chacun des quatre répertoires de boîtes contenait un fichier `.msg` : la même ligne, recopiée le long de la chaîne.
|
||||||
|
|
||||||
|
Comptons : **cinq processus** pour ce que l'étape 1 faisait en une instruction. Ce n'est pas le moment d'optimiser : ce n'est pas encore censé être confortable.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Fünf Terminals, fünf Prozesse, ein lokales Dateisystem dazwischen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java SensorService.java # terminal 1
|
||||||
|
java Mediator.java consoleIn/outbox rot13/inbox # terminal 2
|
||||||
|
java ProcessorService.java # terminal 3
|
||||||
|
java Mediator.java rot13/outbox consoleOut/inbox # terminal 4
|
||||||
|
java ActuatorService.java # terminal 5
|
||||||
|
```
|
||||||
|
|
||||||
|
**Beobachtet:** `Hello World`, in Terminal 1 getippt, erschien als `Uryyb Jbeyq` in Terminal 5. Die drei mittleren Terminals zeigten nichts Neues — jeder Vermittler gibt beim Start eine Zeile „Mediating: …" aus, und `ProcessorService` gibt überhaupt nichts aus. Danach enthielt jedes der vier Postfachverzeichnisse eine `.msg`-Datei: dieselbe Zeile, entlang der Kette kopiert.
|
||||||
|
|
||||||
|
Nachzählen: **fünf Prozesse** für das, was Schritt 1 in einer Anweisung tat. Jetzt ist nicht der Moment zu optimieren: bequem soll es noch nicht sein.
|
||||||
|
:::
|
||||||
|
|
||||||
|
![[The five processes and the four mailbox directories. In the web version, **Play** follows one line of text from the keyboard to the console.]{.en}[Les cinq processus et les quatre répertoires de boîtes. Dans la version web, **Lancer** suit une ligne de texte du clavier à la console.]{.fr}[Die fünf Prozesse und die vier Postfachverzeichnisse. In der Webfassung folgt **Abspielen** einer Textzeile von der Tastatur zur Konsole.]{.de}](figures/filesystem-processes-@tr{langcode}){#fig-filesystem-processes .flow-figure}
|
||||||
|
|
||||||
|
## [What part II moved]{.en}[Ce que la partie II a déplacé]{.fr}[Was Teil II verschoben hat]{.de} {#sec-part-ii-result}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
| stage | where the topology lives | who could rewire it |
|
||||||
|
|---|---|---|
|
||||||
|
| step 1 | inside the capability code | whoever edits that code |
|
||||||
|
| steps 7–8 | in `main()`, as mailbox names | whoever edits `main()` |
|
||||||
|
| step 18 | in the two `Mediator.java <from> <to>` command lines | whoever starts the processes |
|
||||||
|
|
||||||
|
The topology has now left the source code altogether: no `.java` file contains the route. It lives in what the operator typed, which means a person is currently the orchestrator. What the five-process version bought is real — the wiring can change without touching any program — and what it cost is equally real: five processes, four copies of every message, and a program that no longer stops when you press `Ctrl+D`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
| étape | où vit la topologie | qui peut recâbler |
|
||||||
|
|---|---|---|
|
||||||
|
| étape 1 | dans le code de la capacité | celui qui édite ce code |
|
||||||
|
| étapes 7–8 | dans `main()`, en noms de boîtes | celui qui édite `main()` |
|
||||||
|
| étape 18 | dans les deux lignes de commande `Mediator.java <from> <to>` | celui qui lance les processus |
|
||||||
|
|
||||||
|
La topologie a maintenant quitté le code source : aucun fichier `.java` ne contient la route. Elle vit dans ce que l'opérateur a tapé, ce qui fait d'une personne l'orchestrateur actuel. Ce que la version à cinq processus apporte est réel — le câblage peut changer sans toucher aucun programme — et ce qu'elle coûte l'est tout autant : cinq processus, quatre copies de chaque message, et un programme qui ne s'arrête plus quand on appuie sur `Ctrl+D`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
| Stufe | wo die Topologie liegt | wer umverdrahten kann |
|
||||||
|
|---|---|---|
|
||||||
|
| Schritt 1 | im Code der Fähigkeit | wer diesen Code ändert |
|
||||||
|
| Schritte 7–8 | in `main()`, als Postfachnamen | wer `main()` ändert |
|
||||||
|
| Schritt 18 | in den zwei Befehlszeilen `Mediator.java <from> <to>` | wer die Prozesse startet |
|
||||||
|
|
||||||
|
Die Topologie hat den Quellcode nun ganz verlassen: keine `.java`-Datei enthält die Route. Sie steckt in dem, was der Bediener getippt hat — damit ist derzeit ein Mensch der Orchestrator. Was die Fünf-Prozess-Fassung einbringt, ist echt: die Verdrahtung kann sich ändern, ohne ein Programm anzufassen. Was sie kostet, ist ebenso echt: fünf Prozesse, vier Kopien jeder Nachricht und ein Programm, das bei `Ctrl+D` nicht mehr stehen bleibt.
|
||||||
|
:::
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
# [Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de} {#sec-part-iii}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd.
|
||||||
|
A figure for the two-machine replication is still to be drawn; the
|
||||||
|
measurements below carry the argument in the meantime. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Five processes on one computer still share one filesystem. Steps 19 to 27 put them on two machines, replicate the message board between them with Syncthing, measure what that costs, and then break a mediator on purpose. By the end, the mediators' price is a number rather than an opinion.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Cinq processus sur un seul ordinateur partagent encore un même système de fichiers. Les étapes 19 à 27 les répartissent sur deux machines, répliquent le tableau de messages entre elles avec Syncthing, mesurent ce que cela coûte, puis cassent délibérément un médiateur. À la fin, le prix des médiateurs est un chiffre, non une opinion.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Fünf Prozesse auf einem Rechner teilen immer noch ein Dateisystem. Die Schritte 19 bis 27 verteilen sie auf zwei Maschinen, replizieren das Nachrichtenbrett mit Syncthing zwischen ihnen, messen die Kosten und zerbrechen dann absichtlich einen Vermittler. Am Ende ist der Preis der Vermittler eine Zahl und keine Meinung.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Syncthing replicates; it does not deliver]{.en}[Syncthing réplique ; il ne distribue pas]{.fr}[Syncthing repliziert; es liefert nicht aus]{.de} {#sec-syncthing-not-a-broker}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Syncthing keeps a directory replicated between machines. That is all it is asked to do here. It knows nothing about Intent, Status, Event, ROT13 or mediators, and it has no concept of a consumer: no subscriptions, no topics, no delivery guarantees, no notion that anybody is waiting.
|
||||||
|
|
||||||
|
The trigger is still ours. Each service runs its own `WatchService` on a **local** directory; Syncthing only makes files appear there. That is why none of the three services changed a single line when the system became distributed.
|
||||||
|
|
||||||
|
Two consequences follow, and both show up later as observations rather than warnings:
|
||||||
|
|
||||||
|
- replication is **asynchronous** — the `.tmp → .msg` rename is atomic on each machine separately, and nothing promises ordering or atomicity between machines;
|
||||||
|
- the filesystem is a serious transport with its own strengths: files can be large, replicas survive a reboot, and every message is readable with `cat`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Syncthing maintient un répertoire répliqué entre plusieurs machines. C'est tout ce qu'on lui demande ici. Il ne sait rien d'Intent, de Status, d'Event, de ROT13 ni des médiateurs, et il n'a aucune notion de consommateur : pas d'abonnement, pas de sujet, aucune garantie de livraison, aucune idée que quelqu'un attend.
|
||||||
|
|
||||||
|
Le déclencheur reste le nôtre. Chaque service exécute son propre `WatchService` sur un répertoire **local** ; Syncthing fait seulement apparaître les fichiers à cet endroit. C'est pourquoi aucun des trois services n'a changé d'une ligne lorsque le système est devenu distribué.
|
||||||
|
|
||||||
|
Deux conséquences en découlent, et toutes deux apparaîtront comme des observations plutôt que comme des avertissements :
|
||||||
|
|
||||||
|
- la réplication est **asynchrone** — le renommage `.tmp → .msg` est atomique sur chaque machine séparément, et rien ne promet d'ordre ni d'atomicité entre machines ;
|
||||||
|
- le système de fichiers est un transport sérieux, avec ses forces : les fichiers peuvent être gros, les répliques survivent à un redémarrage, et chaque message se lit avec `cat`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Syncthing hält ein Verzeichnis zwischen Maschinen repliziert. Mehr wird hier nicht verlangt. Es weiss nichts von Intent, Status, Event, ROT13 oder Vermittlern, und es kennt keinen Konsumenten: keine Abonnements, keine Topics, keine Lieferzusagen, keine Vorstellung davon, dass jemand wartet.
|
||||||
|
|
||||||
|
Der Auslöser bleibt unser eigener. Jeder Dienst betreibt seinen eigenen `WatchService` auf einem **lokalen** Verzeichnis; Syncthing lässt die Dateien dort nur erscheinen. Deshalb musste keiner der drei Dienste eine Zeile ändern, als das System verteilt wurde.
|
||||||
|
|
||||||
|
Daraus folgen zwei Dinge, die später als Beobachtung und nicht als Warnung auftreten:
|
||||||
|
|
||||||
|
- Replikation ist **asynchron** — das Umbenennen `.tmp → .msg` ist auf jeder Maschine einzeln atomar, und nichts verspricht Reihenfolge oder Atomarität zwischen Maschinen;
|
||||||
|
- das Dateisystem ist ein ernstzunehmender Transport mit eigenen Stärken: Dateien dürfen gross sein, Replikate überleben einen Neustart, und jede Nachricht lässt sich mit `cat` lesen.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Test one layer at a time]{.en}[Tester une couche à la fois]{.fr}[Eine Schicht auf einmal prüfen]{.de} {#sec-one-layer}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Before any Java touched the replicated folder, the dullest possible test ran first: write `hello.txt` on one machine, confirm it appears on the other, delete it, confirm the deletion travels back. Both directions worked.
|
||||||
|
|
||||||
|
That order matters. When the distributed run later failed, the question "is it replication or is it my program?" had already been answered for the transport, and the search could start one layer up.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Avant que le moindre programme Java ne touche au dossier répliqué, le test le plus ennuyeux possible a été fait d'abord : écrire `hello.txt` sur une machine, vérifier qu'il apparaît sur l'autre, le supprimer, vérifier que la suppression revient. Les deux sens fonctionnent.
|
||||||
|
|
||||||
|
Cet ordre compte. Quand l'exécution distribuée a échoué plus tard, la question « est-ce la réplication ou mon programme ? » était déjà tranchée pour le transport, et la recherche pouvait commencer une couche plus haut.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Bevor irgendein Java-Programm den replizierten Ordner berührte, lief der langweiligste denkbare Test: `hello.txt` auf einer Maschine schreiben, prüfen, dass es auf der anderen erscheint, es löschen, prüfen, dass die Löschung zurückkommt. Beide Richtungen funktionierten.
|
||||||
|
|
||||||
|
Diese Reihenfolge ist wichtig. Als der verteilte Lauf später scheiterte, war die Frage „Replikation oder mein Programm?" für den Transport schon beantwortet, und die Suche konnte eine Schicht höher beginnen.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What one keystroke costs]{.en}[Ce que coûte une frappe]{.fr}[Was ein Tastendruck kostet]{.de} {#sec-keystroke-cost}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
With the sensor on one machine and the mediators, ROT13 and the actuator on the other, one typed line produced **four** `.msg` files, one per mailbox:
|
||||||
|
|
||||||
|
| mailbox | content | timestamp inside |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/inbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/outbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
| `consoleOut/inbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
|
||||||
|
The repeated timestamps are the evidence that two of those four publications are **pure copies**: the mediators republish the message unchanged, timestamp included. They compute `identity(x) = x`, as separate distributed processes.
|
||||||
|
|
||||||
|
The timing, taken from the four files' modification times on one machine so that no clock skew enters: the sensor's file appears at `01:02:05.432`, the other three at `01:02:13.460`, `.504` and `.532` — **8.10 s** later, and within **72 ms of each other**. So the chain's own work took milliseconds; the eight seconds are Syncthing's propagation. The same chain, run entirely on one machine, completes in about 24 ms.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Avec le capteur sur une machine et les médiateurs, ROT13 et l'actionneur sur l'autre, une ligne tapée a produit **quatre** fichiers `.msg`, un par boîte :
|
||||||
|
|
||||||
|
| boîte | contenu | horodatage interne |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/inbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/outbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
| `consoleOut/inbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
|
||||||
|
Les horodatages répétés prouvent que deux de ces quatre publications sont de **pures copies** : les médiateurs republient le message inchangé, horodatage compris. Ils calculent `identity(x) = x`, sous forme de processus distribués distincts.
|
||||||
|
|
||||||
|
Le temps, mesuré sur les dates de modification des quatre fichiers d'une seule machine pour qu'aucun décalage d'horloge n'intervienne : le fichier du capteur apparaît à `01:02:05.432`, les trois autres à `01:02:13.460`, `.504` et `.532` — **8,10 s** plus tard, et à **72 ms** l'un de l'autre. Le travail propre de la chaîne a donc pris des millisecondes ; les huit secondes sont la propagation de Syncthing. La même chaîne, exécutée entièrement sur une machine, termine en 24 ms environ.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Mit dem Sensor auf einer Maschine und den Vermittlern, ROT13 und dem Aktor auf der anderen erzeugte eine getippte Zeile **vier** `.msg`-Dateien, eine pro Postfach:
|
||||||
|
|
||||||
|
| Postfach | Inhalt | Zeitstempel darin |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/inbox` | `Hello World` | 23:02:05.315 |
|
||||||
|
| `rot13/outbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
| `consoleOut/inbox` | `Uryyb Jbeyq` | 23:02:13.471 |
|
||||||
|
|
||||||
|
Die wiederholten Zeitstempel belegen, dass zwei dieser vier Veröffentlichungen **reine Kopien** sind: die Vermittler veröffentlichen die Nachricht unverändert erneut, Zeitstempel eingeschlossen. Sie berechnen `identity(x) = x`, als eigene verteilte Prozesse.
|
||||||
|
|
||||||
|
Die Zeiten, gemessen an den Änderungszeiten der vier Dateien auf einer Maschine, damit keine Uhrendifferenz hineinspielt: die Datei des Sensors erscheint um `01:02:05.432`, die drei anderen um `01:02:13.460`, `.504` und `.532` — **8,10 s** später und innerhalb von **72 ms** zueinander. Die eigentliche Arbeit der Kette dauerte also Millisekunden; die acht Sekunden sind Syncthings Verbreitung. Dieselbe Kette, vollständig auf einer Maschine, braucht etwa 24 ms.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Break a mediator]{.en}[Casser un médiateur]{.fr}[Einen Vermittler zerbrechen]{.de} {#sec-break-a-mediator}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Stop the first mediator and type two lines. ConsoleIn is alive, ROT13 is alive, ConsoleOut is alive, Syncthing is alive — and the business flow is dead. The two lines pile up in `consoleIn/outbox`; nothing moves past it. The mediators are part of the availability chain.
|
||||||
|
|
||||||
|
Then restart the mediator. **Nothing is delivered.** `FileMessageBoard.watch` registers a directory for `ENTRY_CREATE` and blocks in `watcher.take()`; it never lists what is already there. The two files are still on disk, in both replicas — so no data was lost. What has no memory is the *subscription*.
|
||||||
|
|
||||||
|
That distinction is worth keeping: **the messages survived, the delivery did not.** A broker answers this with session state and retained messages; in our own code it would be one line — list the existing `.msg` files before entering the watch loop — which the material deliberately does not write yet.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Arrêtez le premier médiateur et tapez deux lignes. ConsoleIn est vivant, ROT13 est vivant, ConsoleOut est vivant, Syncthing est vivant — et le flux métier est mort. Les deux lignes s'accumulent dans `consoleIn/outbox` ; rien ne va plus loin. Les médiateurs font partie de la chaîne de disponibilité.
|
||||||
|
|
||||||
|
Redémarrez ensuite le médiateur. **Rien n'est livré.** `FileMessageBoard.watch` enregistre un répertoire pour `ENTRY_CREATE` et se bloque dans `watcher.take()` ; il ne liste jamais ce qui est déjà là. Les deux fichiers sont toujours sur le disque, dans les deux répliques : aucune donnée n'a été perdue. Ce qui n'a pas de mémoire, c'est l'*abonnement*.
|
||||||
|
|
||||||
|
La distinction mérite d'être retenue : **les messages ont survécu, la livraison non.** Un courtier répond à cela par l'état de session et les messages retenus ; dans notre propre code, ce serait une ligne — lister les fichiers `.msg` existants avant d'entrer dans la boucle d'observation — que le matériel se garde volontairement d'écrire pour l'instant.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Halten Sie den ersten Vermittler an und tippen Sie zwei Zeilen. ConsoleIn lebt, ROT13 lebt, ConsoleOut lebt, Syncthing lebt — und der Geschäftsfluss ist tot. Die zwei Zeilen stapeln sich in `consoleIn/outbox`; weiter kommt nichts. Die Vermittler gehören zur Verfügbarkeitskette.
|
||||||
|
|
||||||
|
Starten Sie den Vermittler neu. **Nichts wird ausgeliefert.** `FileMessageBoard.watch` registriert ein Verzeichnis für `ENTRY_CREATE` und blockiert in `watcher.take()`; es listet nie, was schon da ist. Die zwei Dateien liegen weiter auf der Platte, in beiden Replikaten — es ging also nichts verloren. Kein Gedächtnis hat das *Abonnement*.
|
||||||
|
|
||||||
|
Diese Unterscheidung lohnt sich: **die Nachrichten überlebten, die Auslieferung nicht.** Ein Broker antwortet darauf mit Sitzungszustand und retained messages; im eigenen Code wäre es eine Zeile — die vorhandenen `.msg`-Dateien auflisten, bevor die Beobachtungsschleife beginnt — die das Material bewusst noch nicht schreibt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The mediator becomes an ordinary service]{.en}[Le médiateur devient un service ordinaire]{.fr}[Der Vermittler wird ein gewöhnlicher Dienst]{.de} {#sec-configurable-mediator}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Before removing the mediators, one asymmetry gets removed: the services receive their *work* as messages, while the mediator received its *route* as shell arguments. So the mediator is given only a name, `ConfigurableMediator mediator1`, from which it derives one permanent control mailbox, `mediators/mediator1/inbox`, and the route arrives as a message:
|
||||||
|
|
||||||
|
```text
|
||||||
|
ROUTE
|
||||||
|
consoleIn/outbox
|
||||||
|
rot13/inbox
|
||||||
|
```
|
||||||
|
|
||||||
|
`from` and `to` travel in **one** message on purpose: as two, the mediator would briefly hold a new source with the old destination and forward to the wrong place. A route is one fact, and one fact belongs in one message.
|
||||||
|
|
||||||
|
A short-lived orchestrator publishes both routes and exits, so the topology is visible in one place and is **not** in the data path. Running it after the services, and typing a line before it, shows both halves at once: the early line is stranded, the later one flows.
|
||||||
|
|
||||||
|
What improved: the mediator now has an identity, takes configuration through its own inbox, keeps a generic capability, and gets its topology from an orchestrator. What did not improve: the data path. It is still `event → mediator → copied event`, still a process in the availability chain, still copying every message without adding meaning. And this version accepts exactly **one** route: `waitForRoute(...)` returns, then the mediator enters `watch(route.from(), …)` and never reads its control inbox again. Live rewiring is not promised, because one blocking `watch` cannot serve a control inbox and a source at the same time — the reason a subscription helper appears later.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Avant de supprimer les médiateurs, une asymétrie disparaît : les services reçoivent leur *travail* sous forme de messages, alors que le médiateur recevait sa *route* en arguments de shell. On ne lui donne donc qu'un nom, `ConfigurableMediator mediator1`, dont il dérive une boîte de contrôle permanente, `mediators/mediator1/inbox`, et la route arrive comme message :
|
||||||
|
|
||||||
|
```text
|
||||||
|
ROUTE
|
||||||
|
consoleIn/outbox
|
||||||
|
rot13/inbox
|
||||||
|
```
|
||||||
|
|
||||||
|
`from` et `to` voyagent dans **un seul** message, volontairement : en deux, le médiateur combinerait brièvement une nouvelle source avec l'ancienne destination et transmettrait au mauvais endroit. Une route est un seul fait, et un fait tient dans un message.
|
||||||
|
|
||||||
|
Un orchestrateur éphémère publie les deux routes puis s'arrête : la topologie est visible en un seul endroit et n'est **pas** dans le chemin des données. Le lancer après les services, en ayant tapé une ligne avant, montre les deux moitiés d'un coup : la ligne précoce reste bloquée, la suivante circule.
|
||||||
|
|
||||||
|
Ce qui s'améliore : le médiateur a une identité, reçoit sa configuration par sa propre boîte, garde une capacité générique et tient sa topologie d'un orchestrateur. Ce qui ne s'améliore pas : le chemin des données. Il reste `event → médiateur → copie de l'event`, toujours un processus dans la chaîne de disponibilité, qui copie chaque message sans rien y ajouter. Et cette version accepte exactement **une** route : `waitForRoute(...)` retourne, puis le médiateur entre dans `watch(route.from(), …)` et ne lit plus jamais sa boîte de contrôle. Le recâblage à chaud n'est pas promis, car un `watch` bloquant ne peut pas servir à la fois une boîte de contrôle et une source — d'où l'aide à l'abonnement qui apparaît plus tard.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Bevor die Vermittler verschwinden, fällt eine Asymmetrie weg: die Dienste erhalten ihre *Arbeit* als Nachrichten, der Vermittler erhielt seine *Route* als Shell-Argumente. Er bekommt daher nur einen Namen, `ConfigurableMediator mediator1`, aus dem er ein dauerhaftes Steuerpostfach ableitet, `mediators/mediator1/inbox`, und die Route kommt als Nachricht:
|
||||||
|
|
||||||
|
```text
|
||||||
|
ROUTE
|
||||||
|
consoleIn/outbox
|
||||||
|
rot13/inbox
|
||||||
|
```
|
||||||
|
|
||||||
|
`from` und `to` reisen absichtlich in **einer** Nachricht: als zwei hielte der Vermittler kurz eine neue Quelle mit dem alten Ziel und leitete an die falsche Stelle weiter. Eine Route ist ein Fakt, und ein Fakt gehört in eine Nachricht.
|
||||||
|
|
||||||
|
Ein kurzlebiger Orchestrator veröffentlicht beide Routen und endet, damit die Topologie an einer Stelle sichtbar ist und **nicht** im Datenpfad liegt. Startet man ihn nach den Diensten und hat vorher eine Zeile getippt, zeigen sich beide Hälften auf einmal: die frühe Zeile bleibt liegen, die späte läuft durch.
|
||||||
|
|
||||||
|
Was besser wird: der Vermittler hat eine Identität, nimmt Konfiguration über sein eigenes Postfach, behält eine generische Fähigkeit und bezieht seine Topologie von einem Orchestrator. Was nicht besser wird: der Datenpfad. Er bleibt `event → Vermittler → kopiertes event`, weiter ein Prozess in der Verfügbarkeitskette, der jede Nachricht ohne Bedeutungsgewinn kopiert. Und diese Fassung nimmt genau **eine** Route an: `waitForRoute(...)` kehrt zurück, dann betritt der Vermittler `watch(route.from(), …)` und liest sein Steuerpostfach nie wieder. Umverdrahten im Betrieb wird nicht versprochen, weil ein blockierendes `watch` nicht gleichzeitig ein Steuerpostfach und eine Quelle bedienen kann — der Grund für die Abonnement-Hilfe später.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What part III moved]{.en}[Ce que la partie III a déplacé]{.fr}[Was Teil III verschoben hat]{.de} {#sec-part-iii-result}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
| stage | where the topology lives | in the data path? |
|
||||||
|
|---|---|---|
|
||||||
|
| step 18 | the operator's command lines | the mediators are |
|
||||||
|
| step 27 | an orchestrator, published as Intent | the mediators still are |
|
||||||
|
|
||||||
|
The question the part ends on is therefore sharp rather than rhetorical: **why can't the service interested in the data simply listen to it itself?**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
| étape | où vit la topologie | dans le chemin des données ? |
|
||||||
|
|---|---|---|
|
||||||
|
| étape 18 | les lignes de commande de l'opérateur | les médiateurs y sont |
|
||||||
|
| étape 27 | un orchestrateur, publiée comme Intent | les médiateurs y sont encore |
|
||||||
|
|
||||||
|
La question sur laquelle se referme la partie est donc précise et non rhétorique : **pourquoi le service intéressé par la donnée ne pourrait-il pas l'écouter lui-même ?**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
| Stufe | wo die Topologie liegt | im Datenpfad? |
|
||||||
|
|---|---|---|
|
||||||
|
| Schritt 18 | die Befehlszeilen des Bedieners | die Vermittler sind es |
|
||||||
|
| Schritt 27 | ein Orchestrator, als Intent veröffentlicht | die Vermittler sind es weiterhin |
|
||||||
|
|
||||||
|
Die Frage, mit der der Teil schliesst, ist daher scharf und nicht rhetorisch: **warum kann der Dienst, der sich für die Daten interessiert, sie nicht selbst hören?**
|
||||||
|
:::
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
# [Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de} {#sec-part-iv}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Steps 28 to 34 go back to one JVM on purpose. With no replication delay and no five-terminal setup, the only thing that can change is who knows whom — so the idea can be tried in seconds instead of in a distributed debugging session.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les étapes 28 à 34 reviennent volontairement à une seule JVM. Sans délai de réplication ni cinq terminaux, la seule chose qui peut changer est qui connaît qui — l'idée s'essaie donc en quelques secondes plutôt que pendant une séance de débogage distribué.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Schritte 28 bis 34 kehren absichtlich zu einer JVM zurück. Ohne Replikationsverzögerung und ohne fünf Terminals kann sich nur ändern, wer wen kennt — die Idee lässt sich also in Sekunden ausprobieren statt in einer verteilten Fehlersuche.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The obvious shortcut, and its trap]{.en}[Le raccourci évident, et son piège]{.fr}[Die naheliegende Abkürzung und ihre Falle]{.de} {#sec-the-trap}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
If the first mediator only copies messages, delete it and let ROT13 read the source itself:
|
||||||
|
|
||||||
|
```java
|
||||||
|
listen("consoleIn.outbox");
|
||||||
|
```
|
||||||
|
|
||||||
|
The mediator is gone. But ask the recurring question: ROT13 now contains the name of ConsoleIn's mailbox. The topology moved out of the mediator and **into the service**. As the material puts it: "We removed the mediator… and put topology back into the service. *Oops.*"
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Si le premier médiateur ne fait que copier des messages, supprimons-le et laissons ROT13 lire la source lui-même :
|
||||||
|
|
||||||
|
```java
|
||||||
|
listen("consoleIn.outbox");
|
||||||
|
```
|
||||||
|
|
||||||
|
Le médiateur a disparu. Mais posons la question récurrente : ROT13 contient désormais le nom de la boîte de ConsoleIn. La topologie a quitté le médiateur pour entrer **dans le service**. Comme le dit le matériel : « nous avons supprimé le médiateur… et remis la topologie dans le service. *Oups.* »
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Wenn der erste Vermittler nur Nachrichten kopiert: löschen wir ihn und lassen ROT13 die Quelle selbst lesen:
|
||||||
|
|
||||||
|
```java
|
||||||
|
listen("consoleIn.outbox");
|
||||||
|
```
|
||||||
|
|
||||||
|
Der Vermittler ist weg. Doch die wiederkehrende Frage: ROT13 enthält jetzt den Namen von ConsoleIns Postfach. Die Topologie ist aus dem Vermittler **in den Dienst** gewandert. Im Wortlaut des Materials: „Wir haben den Vermittler entfernt … und die Topologie zurück in den Dienst gelegt. *Hoppla.*"
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Capability is not topology]{.en}[La capacité n'est pas la topologie]{.fr}[Fähigkeit ist nicht Topologie]{.de} {#sec-capability-vs-topology}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
ROT13 may know two things: *I can transform text*, and *I am capable of listening for compatible text messages*. It may **not** know *my input always comes from consoleIn.outbox* — that is deployment topology.
|
||||||
|
|
||||||
|
So the name is not compiled in; it arrives at runtime:
|
||||||
|
|
||||||
|
```text
|
||||||
|
TOPIC consoleIn.outbox
|
||||||
|
```
|
||||||
|
|
||||||
|
ROT13 learns its wiring from data. Note who sends it: in `DynamicQueueRot13.java` it is `main()` that publishes both `TOPIC` messages — a configurator, outside the data path, in the role the orchestrator played before. It cannot be ConsoleIn: if ConsoleIn told ROT13 what to subscribe to, ConsoleIn would have to know ROT13 exists, and the topology would simply have moved into a different capability.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
ROT13 peut savoir deux choses : *je sais transformer du texte* et *je suis capable d'écouter des messages texte compatibles*. Il ne doit **pas** savoir *mon entrée vient toujours de consoleIn.outbox* — c'est de la topologie de déploiement.
|
||||||
|
|
||||||
|
Le nom n'est donc pas compilé ; il arrive à l'exécution :
|
||||||
|
|
||||||
|
```text
|
||||||
|
TOPIC consoleIn.outbox
|
||||||
|
```
|
||||||
|
|
||||||
|
ROT13 apprend son câblage par la donnée. Notez qui l'envoie : dans `DynamicQueueRot13.java`, c'est `main()` qui publie les deux messages `TOPIC` — un configurateur, hors du chemin des données, dans le rôle qu'occupait l'orchestrateur. Ce ne peut pas être ConsoleIn : s'il disait à ROT13 à quoi s'abonner, il devrait savoir que ROT13 existe, et la topologie aurait seulement changé de capacité d'accueil.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
ROT13 darf zwei Dinge wissen: *ich kann Text transformieren* und *ich kann auf kompatible Textnachrichten hören*. Es darf **nicht** wissen: *meine Eingabe kommt immer aus consoleIn.outbox* — das ist Deployment-Topologie.
|
||||||
|
|
||||||
|
Der Name ist daher nicht einkompiliert, er kommt zur Laufzeit:
|
||||||
|
|
||||||
|
```text
|
||||||
|
TOPIC consoleIn.outbox
|
||||||
|
```
|
||||||
|
|
||||||
|
ROT13 lernt seine Verdrahtung aus Daten. Wer sie sendet, ist wichtig: in `DynamicQueueRot13.java` veröffentlicht `main()` beide `TOPIC`-Nachrichten — ein Konfigurator ausserhalb des Datenpfads, in der Rolle des früheren Orchestrators. ConsoleIn kann es nicht sein: sagte ConsoleIn ROT13, was es abonnieren soll, müsste es wissen, dass ROT13 existiert — die Topologie wäre nur in eine andere Fähigkeit gewandert.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What changes in the code]{.en}[Ce qui change dans le code]{.fr}[Was sich im Code ändert]{.de} {#sec-dynamic-mechanics}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
`listen(...)` is nothing exotic: a virtual thread that repeatedly calls `take()` on one of the same queues. `subscribe(...)` starts one such thread per subscribed name. The consequence is visible in the mailboxes:
|
||||||
|
|
||||||
|
- ROT13 takes **straight from `consoleIn.outbox`** — the name it was told;
|
||||||
|
- `rot13.inbox` is no longer a payload mailbox. It carries control messages, and ROT13's loop reads it to decide whether a message is a `TOPIC` to act on.
|
||||||
|
|
||||||
|
Nothing writes into `rot13.inbox` to move data anymore. The mailbox did not disappear; it changed job, from carrying payload to carrying Intent.
|
||||||
|
|
||||||
|
One observation from running it: after `Ctrl+D`, output stops but the program stays up. Nothing was interrupted — `runConsoleIn` returns on end of input, so the **producer** is gone, while both subscriber threads sit blocked in `take()` on sources that will never publish again. The JVM stays alive because `main` ends with `Thread.currentThread().join()`. "The flow stopped" always has to be traced to *which* participant stopped.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
`listen(...)` n'a rien d'exotique : un thread virtuel qui appelle `take()` en boucle sur l'une des mêmes files. `subscribe(...)` démarre un tel thread par nom abonné. La conséquence se voit dans les boîtes :
|
||||||
|
|
||||||
|
- ROT13 retire **directement de `consoleIn.outbox`** — le nom qu'on lui a transmis ;
|
||||||
|
- `rot13.inbox` n'est plus une boîte de charge utile. Elle porte des messages de contrôle, et la boucle de ROT13 la lit pour décider si un message est un `TOPIC` à appliquer.
|
||||||
|
|
||||||
|
Plus rien n'écrit dans `rot13.inbox` pour déplacer des données. La boîte n'a pas disparu : elle a changé de métier, de la charge utile vers l'Intent.
|
||||||
|
|
||||||
|
Une observation à l'exécution : après `Ctrl+D`, la sortie s'arrête mais le programme reste en vie. Rien n'a été interrompu — `runConsoleIn` retourne à la fin de l'entrée, donc le **producteur** a disparu, tandis que les deux threads abonnés restent bloqués dans `take()` sur des sources qui ne publieront plus. La JVM survit parce que `main` finit par `Thread.currentThread().join()`. « Le flux s'est arrêté » doit toujours être ramené à *quel* participant s'est arrêté.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
`listen(...)` ist nichts Exotisches: ein virtueller Thread, der wiederholt `take()` auf einer derselben Warteschlangen aufruft. `subscribe(...)` startet einen solchen Thread pro abonniertem Namen. Die Folge ist in den Postfächern sichtbar:
|
||||||
|
|
||||||
|
- ROT13 nimmt **direkt aus `consoleIn.outbox`** — dem Namen, den es erhalten hat;
|
||||||
|
- `rot13.inbox` ist kein Nutzlast-Postfach mehr. Es trägt Steuernachrichten, und ROT13s Schleife liest es, um zu entscheiden, ob eine Nachricht ein anzuwendendes `TOPIC` ist.
|
||||||
|
|
||||||
|
Nichts schreibt mehr in `rot13.inbox`, um Daten zu bewegen. Das Postfach verschwand nicht; es wechselte die Aufgabe, von Nutzlast zu Intent.
|
||||||
|
|
||||||
|
Eine Beobachtung aus dem Lauf: nach `Ctrl+D` endet die Ausgabe, das Programm bleibt aber am Leben. Unterbrochen wurde nichts — `runConsoleIn` kehrt am Eingabeende zurück, der **Produzent** ist also weg, während beide Abonnenten-Threads in `take()` auf Quellen warten, die nie wieder veröffentlichen. Die JVM lebt weiter, weil `main` mit `Thread.currentThread().join()` endet. „Der Fluss stoppte" muss immer darauf zurückgeführt werden, *welcher* Beteiligte stoppte.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [`ROUTE` and `TOPIC` are Intent]{.en}[`ROUTE` et `TOPIC` sont de l'Intent]{.fr}[`ROUTE` und `TOPIC` sind Intent]{.de} {#sec-route-topic-intent}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Apply two tests to `TOPIC consoleIn.outbox`. Does it describe something that happened? No. Something currently true? No. It says *please begin listening here* — desired behaviour, which is **Intent**. The mediator's `ROUTE` is the same kind of message: *please forward from here to there*.
|
||||||
|
|
||||||
|
One trap worth naming, because it is tempting in a defence: *publishing* an Intent is naturally something that happened. Classification follows what the message says, not the fact that it exists.
|
||||||
|
|
||||||
|
And one condition, which returns later: the dynamic version is **not** automatically superior. It makes sense only if the consumer actually understands the producer's message contract.
|
||||||
|
|
||||||
|
```text
|
||||||
|
STATIC MEDIATED DYNAMIC DIRECT
|
||||||
|
Producer → Mediator → Consumer Intent → (Producer ──► Consumer)
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Appliquons deux tests à `TOPIC consoleIn.outbox`. Décrit-il quelque chose qui est arrivé ? Non. Quelque chose actuellement vrai ? Non. Il dit *commence à écouter ici* — un comportement souhaité, donc de l'**Intent**. Le `ROUTE` du médiateur est du même genre : *transmets d'ici à là*.
|
||||||
|
|
||||||
|
Un piège à nommer, car il est tentant dans une soutenance : *publier* un Intent est bien sûr quelque chose qui est arrivé. La classification suit ce que dit le message, pas le fait qu'il existe.
|
||||||
|
|
||||||
|
Et une condition, qui reviendra : la version dynamique n'est **pas** automatiquement supérieure. Elle n'a de sens que si le consommateur comprend vraiment le contrat de message du producteur.
|
||||||
|
|
||||||
|
```text
|
||||||
|
MÉDIÉ STATIQUE DIRECT DYNAMIQUE
|
||||||
|
Producteur → Médiateur → Consommateur Intent → (Producteur ──► Consommateur)
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Zwei Tests für `TOPIC consoleIn.outbox`. Beschreibt es etwas, das geschehen ist? Nein. Etwas, das gerade gilt? Nein. Es sagt *beginne hier zu hören* — gewünschtes Verhalten, also **Intent**. Das `ROUTE` des Vermittlers ist dieselbe Art Nachricht: *leite von hier nach dort weiter*.
|
||||||
|
|
||||||
|
Eine Falle, die benannt gehört, weil sie in einer Verteidigung verlockt: ein Intent zu *veröffentlichen* ist natürlich etwas, das geschehen ist. Die Einordnung folgt dem, was die Nachricht sagt, nicht ihrer Existenz.
|
||||||
|
|
||||||
|
Und eine Bedingung, die wiederkommt: die dynamische Fassung ist **nicht** automatisch besser. Sie ergibt nur Sinn, wenn der Konsument den Nachrichtenvertrag des Produzenten wirklich versteht.
|
||||||
|
|
||||||
|
```text
|
||||||
|
STATISCH VERMITTELT DYNAMISCH DIREKT
|
||||||
|
Produzent → Vermittler → Konsument Intent → (Produzent ──► Konsument)
|
||||||
|
```
|
||||||
|
:::
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
# [Part V — Replay the dynamic idea across processes]{.en}[Partie V — Rejouer l'idée dynamique entre processus]{.fr}[Teil V — Die dynamische Idee über Prozesse hinweg wiederholen]{.de} {#sec-part-v}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Steps 35 to 38 take the subscription idea out of the single JVM. The services become separate programs again, but instead of mediators copying files, each service watches the mailbox it was *told* to watch. One assumption of the first filesystem helper does not survive the move, and fixing it is what this part is really about.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les étapes 35 à 38 sortent l'idée d'abonnement de la JVM unique. Les services redeviennent des programmes séparés, mais au lieu de médiateurs qui copient des fichiers, chaque service observe la boîte qu'on lui a *indiquée*. Une hypothèse du premier utilitaire de fichiers ne survit pas au déplacement, et c'est bien de la corriger qu'il s'agit ici.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Schritte 35 bis 38 holen die Abonnement-Idee aus der einzelnen JVM heraus. Die Dienste werden wieder getrennte Programme, aber anstelle von Vermittlern, die Dateien kopieren, beobachtet jeder Dienst das Postfach, das ihm *gesagt* wurde. Eine Annahme des ersten Dateisystem-Helfers übersteht den Umzug nicht, und genau deren Korrektur ist das Thema dieses Teils.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [One blocking watch is not enough]{.en}[Une observation bloquante ne suffit pas]{.fr}[Ein blockierendes watch genügt nicht]{.de} {#sec-watch-limit}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
`FileMessageBoard.watch(topic, receiver)` registers **one** directory and blocks forever. That was enough while every process watched one fixed mailbox. A dynamically wired service needs more:
|
||||||
|
|
||||||
|
```text
|
||||||
|
always watch its own control inbox
|
||||||
|
AND
|
||||||
|
add a watched directory at runtime
|
||||||
|
AND
|
||||||
|
possibly remove it later
|
||||||
|
```
|
||||||
|
|
||||||
|
The old signature cannot express that, and the consequence was already visible earlier: the configurable mediator accepted exactly one `ROUTE`, because the moment it began watching its source it went deaf to its own control inbox. The limitation was never *whose* directory — it was *one, fixed, forever*.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
`FileMessageBoard.watch(topic, receiver)` enregistre **un** répertoire et se bloque indéfiniment. Cela suffisait tant que chaque processus observait une boîte fixe. Un service câblé dynamiquement demande davantage :
|
||||||
|
|
||||||
|
```text
|
||||||
|
observer en permanence sa propre boîte de contrôle
|
||||||
|
ET
|
||||||
|
ajouter un répertoire observé à l'exécution
|
||||||
|
ET
|
||||||
|
éventuellement le retirer ensuite
|
||||||
|
```
|
||||||
|
|
||||||
|
L'ancienne signature ne peut pas exprimer cela, et la conséquence était déjà visible : le médiateur configurable n'acceptait qu'une seule `ROUTE`, car dès qu'il observait sa source il devenait sourd à sa propre boîte de contrôle. La limite n'a jamais été *de qui* est le répertoire, mais *un seul, fixe, pour toujours*.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
`FileMessageBoard.watch(topic, receiver)` registriert **ein** Verzeichnis und blockiert für immer. Das genügte, solange jeder Prozess ein festes Postfach beobachtete. Ein dynamisch verdrahteter Dienst braucht mehr:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dauerhaft das eigene Steuerpostfach beobachten
|
||||||
|
UND
|
||||||
|
zur Laufzeit ein beobachtetes Verzeichnis hinzufügen
|
||||||
|
UND
|
||||||
|
es möglicherweise später entfernen
|
||||||
|
```
|
||||||
|
|
||||||
|
Die alte Signatur kann das nicht ausdrücken, und die Folge war schon vorher sichtbar: der konfigurierbare Vermittler nahm genau eine `ROUTE` an, denn sobald er seine Quelle beobachtete, wurde er für sein eigenes Steuerpostfach taub. Die Grenze war nie, *wessen* Verzeichnis es ist — sondern *eines, festes, für immer*.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The helper: `FileSubscriptions`]{.en}[L'utilitaire : `FileSubscriptions`]{.fr}[Der Helfer: `FileSubscriptions`]{.de} {#sec-filesubscriptions}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
One `WatchService` can serve many directories. `register(...)` returns a `WatchKey` identifying one of them, `watcher.take()` returns whichever key has events, and `key.cancel()` deregisters it. The helper keeps both directions, `name → key` and `key → name`, so an event can be traced back to the mailbox it came from.
|
||||||
|
|
||||||
|
Events do not reach a callback directly. They go onto a queue, read with `take()`, carrying
|
||||||
|
|
||||||
|
```java
|
||||||
|
record IncomingMessage(String mailbox, Message message) {}
|
||||||
|
```
|
||||||
|
|
||||||
|
Two reasons, and order of arrival is only the third. First, the observing thread must stay responsive for *every* subscribed directory: a callback that transformed, published or blocked would stall the observation of all the others. Second, the mailbox name travels with the message, so **one** loop in the service can decide what a message means — control inbox, so this is Intent to act on; subscribed source, so this is data to transform — and that same loop is free to add or remove subscriptions, because it is not sitting inside a callback.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Un seul `WatchService` peut servir plusieurs répertoires. `register(...)` retourne un `WatchKey` qui en identifie un, `watcher.take()` retourne la clé qui a des événements, et `key.cancel()` la désenregistre. L'utilitaire garde les deux sens, `nom → clé` et `clé → nom`, pour qu'un événement puisse être rattaché à la boîte dont il vient.
|
||||||
|
|
||||||
|
Les événements n'arrivent pas directement dans un callback. Ils passent par une file, lue avec `take()`, et portent
|
||||||
|
|
||||||
|
```java
|
||||||
|
record IncomingMessage(String mailbox, Message message) {}
|
||||||
|
```
|
||||||
|
|
||||||
|
Deux raisons, l'ordre d'arrivée n'étant que la troisième. D'abord, le thread observateur doit rester réactif pour *tous* les répertoires abonnés : un callback qui transforme, publie ou bloque arrêterait l'observation de tous les autres. Ensuite, le nom de la boîte voyage avec le message, de sorte qu'**une seule** boucle du service peut décider de son sens — boîte de contrôle, donc un Intent à appliquer ; source abonnée, donc des données à transformer — et cette même boucle peut ajouter ou retirer des abonnements, puisqu'elle n'est pas prisonnière d'un callback.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Ein `WatchService` kann viele Verzeichnisse bedienen. `register(...)` gibt einen `WatchKey` zurück, der eines davon bezeichnet, `watcher.take()` liefert den Schlüssel mit Ereignissen, und `key.cancel()` meldet ihn ab. Der Helfer hält beide Richtungen, `Name → Schlüssel` und `Schlüssel → Name`, damit ein Ereignis auf das Postfach zurückgeführt werden kann, aus dem es kam.
|
||||||
|
|
||||||
|
Ereignisse erreichen keinen Callback direkt. Sie gehen in eine Warteschlange, gelesen mit `take()`, und tragen
|
||||||
|
|
||||||
|
```java
|
||||||
|
record IncomingMessage(String mailbox, Message message) {}
|
||||||
|
```
|
||||||
|
|
||||||
|
Dafür zwei Gründe; die Ankunftsreihenfolge ist nur der dritte. Erstens muss der beobachtende Thread für *jedes* abonnierte Verzeichnis ansprechbar bleiben: ein Callback, der transformiert, veröffentlicht oder blockiert, hielte die Beobachtung aller anderen auf. Zweitens reist der Postfachname mit der Nachricht, sodass **eine** Schleife im Dienst deren Bedeutung bestimmen kann — Steuerpostfach, also ein anzuwendender Intent; abonnierte Quelle, also zu transformierende Daten — und dieselbe Schleife darf Abonnements hinzufügen oder entfernen, weil sie nicht in einem Callback feststeckt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Two publications instead of four]{.en}[Deux publications au lieu de quatre]{.fr}[Zwei Veröffentlichungen statt vier]{.de} {#sec-two-publications}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Run `SensorService`, `DynamicProcessorService` and `DynamicActuatorService` — and no mediators — then let `Configure.java` publish the two `TOPIC` messages. A line typed afterwards leaves exactly two application publications in the board:
|
||||||
|
|
||||||
|
| mailbox | content | what it is |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `TEXT hello` | the input |
|
||||||
|
| `rot13/outbox` | `TEXT uryyb` | the result |
|
||||||
|
| `rot13/inbox` | `TOPIC consoleIn/outbox` | Intent, published once |
|
||||||
|
| `consoleOut/inbox` | `TOPIC rot13/outbox` | Intent, published once |
|
||||||
|
|
||||||
|
`consoleOut/inbox` holds **no payload at all**: ConsoleOut takes straight from `rot13/outbox`. Its inbox changed job, from carrying messages to carrying wiring.
|
||||||
|
|
||||||
|
A line typed *before* `Configure.java` ran stays in `consoleIn/outbox` forever. A subscription that does not exist yet misses what came before it — exactly what the restarted mediator showed when it delivered nothing.
|
||||||
|
|
||||||
|
| version | application publications | processes in the data path |
|
||||||
|
|---|---|---|
|
||||||
|
| mediated (step 18) | 4 | 5 |
|
||||||
|
| configurable mediator (step 27) | 4 | 5 |
|
||||||
|
| dynamic (step 38) | **2** | **3** |
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Lancez `SensorService`, `DynamicProcessorService` et `DynamicActuatorService` — sans médiateurs — puis laissez `Configure.java` publier les deux messages `TOPIC`. Une ligne tapée ensuite laisse exactement deux publications applicatives dans le tableau :
|
||||||
|
|
||||||
|
| boîte | contenu | nature |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `TEXT hello` | l'entrée |
|
||||||
|
| `rot13/outbox` | `TEXT uryyb` | le résultat |
|
||||||
|
| `rot13/inbox` | `TOPIC consoleIn/outbox` | Intent, publié une fois |
|
||||||
|
| `consoleOut/inbox` | `TOPIC rot13/outbox` | Intent, publié une fois |
|
||||||
|
|
||||||
|
`consoleOut/inbox` ne contient **aucune charge utile** : ConsoleOut retire directement de `rot13/outbox`. Sa boîte a changé de métier, des messages vers le câblage.
|
||||||
|
|
||||||
|
Une ligne tapée *avant* l'exécution de `Configure.java` reste dans `consoleIn/outbox` pour toujours. Un abonnement qui n'existe pas encore manque ce qui l'a précédé — le même constat que le médiateur redémarré qui n'a rien livré.
|
||||||
|
|
||||||
|
| version | publications applicatives | processus dans le chemin des données |
|
||||||
|
|---|---|---|
|
||||||
|
| médiée (étape 18) | 4 | 5 |
|
||||||
|
| médiateur configurable (étape 27) | 4 | 5 |
|
||||||
|
| dynamique (étape 38) | **2** | **3** |
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Starten Sie `SensorService`, `DynamicProcessorService` und `DynamicActuatorService` — ohne Vermittler — und lassen Sie dann `Configure.java` die zwei `TOPIC`-Nachrichten veröffentlichen. Eine danach getippte Zeile hinterlässt genau zwei Anwendungsveröffentlichungen im Brett:
|
||||||
|
|
||||||
|
| Postfach | Inhalt | was es ist |
|
||||||
|
|---|---|---|
|
||||||
|
| `consoleIn/outbox` | `TEXT hello` | die Eingabe |
|
||||||
|
| `rot13/outbox` | `TEXT uryyb` | das Ergebnis |
|
||||||
|
| `rot13/inbox` | `TOPIC consoleIn/outbox` | Intent, einmal veröffentlicht |
|
||||||
|
| `consoleOut/inbox` | `TOPIC rot13/outbox` | Intent, einmal veröffentlicht |
|
||||||
|
|
||||||
|
`consoleOut/inbox` enthält **keine Nutzlast**: ConsoleOut nimmt direkt aus `rot13/outbox`. Sein Postfach wechselte die Aufgabe, von Nachrichten zu Verdrahtung.
|
||||||
|
|
||||||
|
Eine Zeile, die *vor* dem Lauf von `Configure.java` getippt wurde, bleibt für immer in `consoleIn/outbox`. Ein Abonnement, das noch nicht existiert, verpasst, was ihm vorausging — dieselbe Lehre wie beim neu gestarteten Vermittler, der nichts auslieferte.
|
||||||
|
|
||||||
|
| Fassung | Anwendungsveröffentlichungen | Prozesse im Datenpfad |
|
||||||
|
|---|---|---|
|
||||||
|
| vermittelt (Schritt 18) | 4 | 5 |
|
||||||
|
| konfigurierbarer Vermittler (Schritt 27) | 4 | 5 |
|
||||||
|
| dynamisch (Schritt 38) | **2** | **3** |
|
||||||
|
:::
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
# [Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de} {#sec-part-vi}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Steps 39 to 47 distribute the dynamic version across two machines, say precisely what "direct" means, and then — only now, after the ideas have been used — give the three kinds of message their names: Intent, Status, Event.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Les étapes 39 à 47 répartissent la version dynamique sur deux machines, précisent ce que « direct » veut dire, puis — maintenant seulement, après avoir utilisé les idées — donnent leurs noms aux trois sortes de messages : Intent, Status, Event.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die Schritte 39 bis 47 verteilen die dynamische Fassung auf zwei Maschinen, sagen genau, was „direkt" bedeutet, und geben dann — erst jetzt, nachdem die Ideen benutzt wurden — den drei Nachrichtenarten ihre Namen: Intent, Status, Event.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The distributed dynamic run]{.en}[L'exécution dynamique distribuée]{.fr}[Der verteilte dynamische Lauf]{.de} {#sec-distributed-dynamic}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Sensor on one machine, ROT13 and the actuator on the other, no mediator anywhere. After the two `TOPIC` Intents had replicated, a typed line produced the result on the other machine — and the board shows what that cost:
|
||||||
|
|
||||||
|
- `consoleIn/outbox`: the input;
|
||||||
|
- `rot13/outbox`: the result, written by the service that produced it;
|
||||||
|
- `consoleOut/inbox`: **Intent only**, where the mediated version held a full copy of every message.
|
||||||
|
|
||||||
|
The timing was the interesting part. The input was published at 02:35:12 and the results appeared on the first machine at 04:11:28.797 and .893 — 96 ms apart, long after the input. Syncthing had been saturated overnight, so the batch arrived when the queue drained. The chain was correct throughout; the transport's latency is simply not something the architecture controls. Compare 24 ms for the same chain on one machine.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Capteur sur une machine, ROT13 et l'actionneur sur l'autre, aucun médiateur. Après la réplication des deux Intents `TOPIC`, une ligne tapée a produit le résultat sur l'autre machine — et le tableau montre ce que cela coûte :
|
||||||
|
|
||||||
|
- `consoleIn/outbox` : l'entrée ;
|
||||||
|
- `rot13/outbox` : le résultat, écrit par le service qui l'a produit ;
|
||||||
|
- `consoleOut/inbox` : **de l'Intent seulement**, là où la version médiée contenait une copie complète de chaque message.
|
||||||
|
|
||||||
|
Le temps est la partie intéressante. L'entrée a été publiée à 02:35:12 et les résultats sont apparus sur la première machine à 04:11:28,797 et ,893 — à 96 ms d'écart, bien après l'entrée. Syncthing était saturé pendant la nuit : le lot est arrivé quand la file s'est vidée. La chaîne est restée correcte ; la latence du transport n'est tout simplement pas contrôlée par l'architecture. À comparer aux 24 ms de la même chaîne sur une seule machine.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Sensor auf einer Maschine, ROT13 und der Aktor auf der anderen, nirgends ein Vermittler. Nachdem die zwei `TOPIC`-Intents repliziert waren, erzeugte eine getippte Zeile das Ergebnis auf der anderen Maschine — und das Brett zeigt die Kosten:
|
||||||
|
|
||||||
|
- `consoleIn/outbox`: die Eingabe;
|
||||||
|
- `rot13/outbox`: das Ergebnis, geschrieben von dem Dienst, der es erzeugt hat;
|
||||||
|
- `consoleOut/inbox`: **nur Intent**, wo die vermittelte Fassung eine vollständige Kopie jeder Nachricht hielt.
|
||||||
|
|
||||||
|
Spannend war die Zeit. Die Eingabe wurde um 02:35:12 veröffentlicht, die Ergebnisse erschienen auf der ersten Maschine um 04:11:28,797 und ,893 — 96 ms auseinander, lange nach der Eingabe. Syncthing war über Nacht überlastet; der Stapel kam, als die Warteschlange abfloss. Die Kette war durchgehend korrekt; die Latenz des Transports steuert die Architektur nicht. Zum Vergleich: 24 ms für dieselbe Kette auf einer Maschine.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What "direct" means, exactly]{.en}[Ce que « direct » veut dire, exactement]{.fr}[Was „direkt" genau bedeutet]{.de} {#sec-direct-precisely}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Two hops that look alike are architecturally opposite:
|
||||||
|
|
||||||
|
- a **transport hop** — Syncthing on each side, possibly a relay in between — adds no participant that knows the topology and nothing reacts to it. If the packets detoured through another continent, no claim here would be contradicted.
|
||||||
|
- an **architectural hop** — a mediator copying `consoleIn/outbox → rot13/inbox` — adds a component that must know both names, sits in the availability chain, and republishes the message.
|
||||||
|
|
||||||
|
So the defensible claim is: *ROT13 reacts to ConsoleIn's publication with no component of ours in between, and without containing ConsoleIn's identity.* Not: *the data goes straight from A to B.* The architecture controls which messages a service reacts to, not the transport's routing.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Deux sauts qui se ressemblent sont architecturalement opposés :
|
||||||
|
|
||||||
|
- un **saut de transport** — Syncthing de chaque côté, éventuellement un relais entre les deux — n'ajoute aucun participant qui connaisse la topologie, et rien n'y réagit. Si les paquets passaient par un autre continent, aucune affirmation ici ne serait contredite.
|
||||||
|
- un **saut architectural** — un médiateur copiant `consoleIn/outbox → rot13/inbox` — ajoute un composant qui doit connaître les deux noms, se place dans la chaîne de disponibilité et republie le message.
|
||||||
|
|
||||||
|
L'affirmation défendable est donc : *ROT13 réagit à la publication de ConsoleIn sans aucun de nos composants entre les deux, et sans contenir l'identité de ConsoleIn.* Et non : *les données vont directement de A à B.* L'architecture décide à quels messages un service réagit, pas du routage du transport.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Zwei Sprünge, die gleich aussehen, sind architektonisch Gegensätze:
|
||||||
|
|
||||||
|
- ein **Transportsprung** — Syncthing auf jeder Seite, möglicherweise ein Relay dazwischen — fügt keinen Beteiligten hinzu, der die Topologie kennt, und nichts reagiert darauf. Liefen die Pakete über einen anderen Kontinent, widerspräche das keiner Aussage hier.
|
||||||
|
- ein **architektonischer Sprung** — ein Vermittler, der `consoleIn/outbox → rot13/inbox` kopiert — fügt eine Komponente hinzu, die beide Namen kennen muss, in der Verfügbarkeitskette steht und die Nachricht erneut veröffentlicht.
|
||||||
|
|
||||||
|
Die vertretbare Aussage lautet daher: *ROT13 reagiert auf ConsoleIns Veröffentlichung, ohne eine unserer Komponenten dazwischen und ohne ConsoleIns Identität zu enthalten.* Nicht: *die Daten gehen direkt von A nach B.* Die Architektur bestimmt, auf welche Nachrichten ein Dienst reagiert, nicht die Wegewahl des Transports.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Intent, Status, Event]{.en}[Intent, Status, Event]{.fr}[Intent, Status, Event]{.de} {#sec-ise}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Three kinds of message, named only after being used:
|
||||||
|
|
||||||
|
| | says | our examples |
|
||||||
|
|---|---|---|
|
||||||
|
| **E** — Event | something **happened** | `TEXT hello` as `ConsoleIn/E/text`; `TEXT uryyb` as `ROT13/E/crypted` |
|
||||||
|
| **S** — Status/State | something is **currently true** | `ROT13/S/subscriptions` — not published by our system yet |
|
||||||
|
| **I** — Intent | what **should** happen | `TOPIC consoleIn/outbox`, `ROUTE … …` |
|
||||||
|
|
||||||
|
Past tense is a useful hint for Events. For Intent the test is two questions: does the message report something that happened? No. Something currently true? No. Then it requests behaviour.
|
||||||
|
|
||||||
|
One trap: *publishing* an Intent is naturally something that happened. Classify by what the message says, not by the fact that it exists — otherwise every message becomes an Event and the vocabulary stops being useful.
|
||||||
|
|
||||||
|
Status deserves its own note, because the instinct is to **ask** for it: "what are your subscriptions?" But asking is a call, and a call needs the asker to know the component, to know it is up, and to wait. Status is **published**: ROT13 publishes `ROT13/S/subscriptions` whenever its wiring changes, and anyone interested reads it. The reader then needs a topic, not a component, and ROT13 never learns who audits it. Each kind answers a different question:
|
||||||
|
|
||||||
|
- an Event is only useful if you were listening — our stranded messages, three times over;
|
||||||
|
- a Status is what a newcomer needs: the current value, without replaying history;
|
||||||
|
- an Intent asks for a change.
|
||||||
|
|
||||||
|
And commands are not forbidden. Sending `ROT13/I` with `ACTION Hello` is command-like, and the material's verdict is "Fine." The component performs its capability and publishes its Events and its Status. The flow it endorses is `Intent → component → State + Events`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Trois sortes de messages, nommées seulement après avoir été utilisées :
|
||||||
|
|
||||||
|
| | dit | nos exemples |
|
||||||
|
|---|---|---|
|
||||||
|
| **E** — Event | quelque chose **est arrivé** | `TEXT hello` comme `ConsoleIn/E/text` ; `TEXT uryyb` comme `ROT13/E/crypted` |
|
||||||
|
| **S** — Status/State | quelque chose est **actuellement vrai** | `ROT13/S/subscriptions` — pas encore publié par notre système |
|
||||||
|
| **I** — Intent | ce qui **devrait** arriver | `TOPIC consoleIn/outbox`, `ROUTE … …` |
|
||||||
|
|
||||||
|
Le passé composé est un bon indice pour les Events. Pour l'Intent, le test tient en deux questions : le message rapporte-t-il quelque chose qui est arrivé ? Non. Quelque chose d'actuellement vrai ? Non. Alors il demande un comportement.
|
||||||
|
|
||||||
|
Un piège : *publier* un Intent est bien sûr quelque chose qui est arrivé. Il faut classer d'après ce que dit le message, non d'après son existence — sinon tout devient Event et le vocabulaire ne sert plus à rien.
|
||||||
|
|
||||||
|
Le Status mérite une note, car l'instinct est de le **demander** : « quels sont tes abonnements ? » Mais demander, c'est appeler, et un appel exige que le demandeur connaisse le composant, le sache en vie, et attende. Le Status se **publie** : ROT13 publie `ROT13/S/subscriptions` dès que son câblage change, et quiconque s'y intéresse le lit. Le lecteur a alors besoin d'un sujet, pas d'un composant, et ROT13 n'apprend jamais qui l'audite. Chaque sorte répond à une question différente :
|
||||||
|
|
||||||
|
- un Event n'est utile que si l'on écoutait — nos messages bloqués, trois fois de suite ;
|
||||||
|
- un Status est ce dont un nouveau venu a besoin : la valeur actuelle, sans rejouer l'histoire ;
|
||||||
|
- un Intent demande un changement.
|
||||||
|
|
||||||
|
Et les commandes ne sont pas interdites. Envoyer `ROT13/I` avec `ACTION Hello` ressemble à une commande, et le verdict du matériel est « Fine. » Le composant exerce sa capacité et publie ses Events et son Status. Le flux retenu est `Intent → composant → State + Events`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Drei Nachrichtenarten, benannt erst nach ihrem Gebrauch:
|
||||||
|
|
||||||
|
| | sagt | unsere Beispiele |
|
||||||
|
|---|---|---|
|
||||||
|
| **E** — Event | etwas **ist geschehen** | `TEXT hello` als `ConsoleIn/E/text`; `TEXT uryyb` als `ROT13/E/crypted` |
|
||||||
|
| **S** — Status/State | etwas ist **gerade wahr** | `ROT13/S/subscriptions` — von unserem System noch nicht veröffentlicht |
|
||||||
|
| **I** — Intent | was geschehen **soll** | `TOPIC consoleIn/outbox`, `ROUTE … …` |
|
||||||
|
|
||||||
|
Vergangenheitsform ist ein nützlicher Hinweis für Events. Für Intent lautet der Test zwei Fragen: berichtet die Nachricht etwas Geschehenes? Nein. Etwas gerade Wahres? Nein. Dann verlangt sie Verhalten.
|
||||||
|
|
||||||
|
Eine Falle: einen Intent zu *veröffentlichen* ist natürlich etwas Geschehenes. Eingeordnet wird nach dem, was die Nachricht sagt, nicht nach ihrer Existenz — sonst wird alles zum Event und das Vokabular nützt nichts mehr.
|
||||||
|
|
||||||
|
Status verdient eine eigene Anmerkung, denn der Instinkt ist, ihn zu **erfragen**: „welche Abonnements hast du?" Doch Fragen ist ein Aufruf, und ein Aufruf verlangt, dass der Fragende die Komponente kennt, sie als laufend weiss und wartet. Status wird **veröffentlicht**: ROT13 veröffentlicht `ROT13/S/subscriptions`, sobald sich seine Verdrahtung ändert, und wer will, liest es. Der Leser braucht dann ein Topic, keine Komponente, und ROT13 erfährt nie, wer es prüft. Jede Art beantwortet eine andere Frage:
|
||||||
|
|
||||||
|
- ein Event nützt nur, wenn man zuhörte — unsere liegengebliebenen Nachrichten, dreimal;
|
||||||
|
- ein Status ist, was ein Neuankömmling braucht: der aktuelle Wert, ohne Geschichte nachzuspielen;
|
||||||
|
- ein Intent verlangt eine Änderung.
|
||||||
|
|
||||||
|
Und Kommandos sind nicht verboten. `ROT13/I` mit `ACTION Hello` zu senden ist kommandoartig, und das Urteil des Materials lautet „Fine." Die Komponente übt ihre Fähigkeit aus und veröffentlicht ihre Events und ihren Status. Der empfohlene Fluss ist `Intent → Komponente → State + Events`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The one-writer rule]{.en}[La règle de l'écrivain unique]{.fr}[Die Ein-Schreiber-Regel]{.de} {#sec-one-writer}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
> Every writable resource has exactly one writer authority.
|
||||||
|
|
||||||
|
Do not confuse that with the UUID in a message filename. The UUID prevents two publications from choosing the same physical name; writer authority says which component **owns** a logical Event or Status resource. Two writers never collide on a filename, and that is exactly why the problem is easy to miss.
|
||||||
|
|
||||||
|
What a second writer costs: the mailbox name was the only provenance marker, so `rot13/outbox` stops meaning "ROT13 transformed this" and a subscriber can no longer trust the contract it built on. For Status it is worse — two components each claiming to publish *the current value* of one fact simply contradict each other, with no ordering guarantee across machines to break the tie. For append-only Events many publications coexist by design; the question is semantic ownership, not collision. When two authorities appear, ask why there are two rather than reaching for a lock.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
> Toute ressource écrivable a exactement une autorité d'écriture.
|
||||||
|
|
||||||
|
Ne pas confondre avec l'UUID du nom de fichier. L'UUID empêche deux publications de choisir le même nom physique ; l'autorité d'écriture dit quel composant **possède** une ressource logique d'Event ou de Status. Deux écrivains n'entrent jamais en collision sur un nom de fichier, et c'est précisément pour cela que le problème passe inaperçu.
|
||||||
|
|
||||||
|
Ce que coûte un second écrivain : le nom de la boîte était le seul marqueur de provenance, donc `rot13/outbox` cesse de signifier « ROT13 a transformé ceci » et un abonné ne peut plus faire confiance au contrat sur lequel il s'appuie. Pour le Status c'est pire — deux composants prétendant chacun publier *la valeur actuelle* d'un même fait se contredisent, sans aucune garantie d'ordre entre machines pour trancher. Pour des Events en ajout seul, de nombreuses publications coexistent par construction ; la question est la propriété sémantique, pas la collision. Quand deux autorités apparaissent, demandez pourquoi il y en a deux plutôt que de sortir un verrou.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
> Jede schreibbare Ressource hat genau eine Schreibautorität.
|
||||||
|
|
||||||
|
Nicht zu verwechseln mit der UUID im Dateinamen. Die UUID verhindert, dass zwei Veröffentlichungen denselben physischen Namen wählen; die Schreibautorität sagt, welche Komponente eine logische Event- oder Status-Ressource **besitzt**. Zwei Schreiber kollidieren nie bei einem Dateinamen — genau deshalb wird das Problem leicht übersehen.
|
||||||
|
|
||||||
|
Was ein zweiter Schreiber kostet: der Postfachname war der einzige Herkunftsnachweis, also bedeutet `rot13/outbox` nicht mehr „ROT13 hat dies transformiert", und ein Abonnent kann dem Vertrag nicht mehr trauen, auf dem er aufbaut. Für Status ist es schlimmer — zwei Komponenten, die je *den aktuellen Wert* eines Faktes zu veröffentlichen behaupten, widersprechen sich, ohne Reihenfolgegarantie zwischen Maschinen, die entscheiden könnte. Bei append-only Events koexistieren viele Veröffentlichungen absichtlich; die Frage ist semantischer Besitz, nicht Kollision. Treten zwei Autoritäten auf, frage nach dem Warum, statt zum Lock zu greifen.
|
||||||
|
:::
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# [Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de} {#sec-part-vii}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd. -->
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Two mediators were removed and the gain was measured. Steps 48 to 52 answer the obvious next question: does that make mediation wrong? No — and the distinction that decides it is sharp enough to apply to a design you have never seen.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Deux médiateurs ont été supprimés et le gain mesuré. Les étapes 48 à 52 répondent à la question suivante, évidente : la médiation est-elle pour autant mauvaise ? Non — et la distinction qui tranche est assez nette pour s'appliquer à une conception qu'on n'a jamais vue.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Zwei Vermittler wurden entfernt und der Gewinn gemessen. Die Schritte 48 bis 52 beantworten die naheliegende nächste Frage: ist Vermittlung damit falsch? Nein — und die entscheidende Unterscheidung ist scharf genug, um sie auf einen fremden Entwurf anzuwenden.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [A transformer earns its existence]{.en}[Un transformateur mérite d'exister]{.fr}[Ein Transformator verdient seine Existenz]{.de} {#sec-transformer}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
What was removed was a mediator computing `A → A`: an expensive identity function, in the availability chain, copying every message without adding meaning.
|
||||||
|
|
||||||
|
Now take a producer publishing `{"value":"Hello"}` and a consumer expecting a display structure. A `TextToDisplayTransformer` between them contributes schema transformation, semantic adaptation, possibly unit conversion, possibly aggregation. That is work neither side should own: ROT13 is not meant to decide terminal colours, and the console is not meant to understand ROT13's payload shape.
|
||||||
|
|
||||||
|
The line is drawn by **contract compatibility**, not by whether something is added. A mediator converting Celsius to Fahrenheit changes rather than adds and has earned its place; one appending a timestamp to a message the consumer already understands has added something and is still suspicious. The question is always: could the consumer read the producer's message as it stands?
|
||||||
|
|
||||||
|
> If a consumer semantically understands a producer's publication, direct subscription is often sufficient.
|
||||||
|
> If the contracts are incompatible, introduce a transformer that performs an actual adaptation.
|
||||||
|
>
|
||||||
|
> A mediator that merely forwards compatible data is suspicious. A mediator that adds necessary semantics has earned its existence.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Ce qui a été supprimé, c'est un médiateur calculant `A → A` : une fonction identité coûteuse, dans la chaîne de disponibilité, copiant chaque message sans rien y ajouter.
|
||||||
|
|
||||||
|
Prenons maintenant un producteur publiant `{"value":"Hello"}` et un consommateur attendant une structure d'affichage. Un `TextToDisplayTransformer` entre les deux apporte transformation de schéma, adaptation sémantique, éventuellement conversion d'unités, éventuellement agrégation. C'est un travail qu'aucun des deux ne devrait porter : ROT13 n'a pas à décider des couleurs du terminal, et la console n'a pas à comprendre la forme de la charge utile de ROT13.
|
||||||
|
|
||||||
|
La ligne se trace par la **compatibilité des contrats**, non par le fait d'ajouter quelque chose. Un médiateur convertissant des Celsius en Fahrenheit modifie au lieu d'ajouter et mérite sa place ; un médiateur ajoutant un horodatage à un message que le consommateur comprend déjà a ajouté quelque chose et reste suspect. La question est toujours : le consommateur pourrait-il lire le message du producteur tel quel ?
|
||||||
|
|
||||||
|
> Si un consommateur comprend sémantiquement la publication d'un producteur, l'abonnement direct suffit souvent.
|
||||||
|
> Si les contrats sont incompatibles, introduire un transformateur qui effectue une adaptation réelle.
|
||||||
|
>
|
||||||
|
> Un médiateur qui ne fait que transmettre des données compatibles est suspect. Un médiateur qui ajoute la sémantique nécessaire mérite d'exister.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Entfernt wurde ein Vermittler, der `A → A` berechnete: eine teure Identitätsfunktion in der Verfügbarkeitskette, die jede Nachricht ohne Bedeutungsgewinn kopierte.
|
||||||
|
|
||||||
|
Nun ein Produzent, der `{"value":"Hello"}` veröffentlicht, und ein Konsument, der eine Anzeigestruktur erwartet. Ein `TextToDisplayTransformer` dazwischen leistet Schematransformation, semantische Anpassung, möglicherweise Einheitenumrechnung, möglicherweise Aggregation. Das ist Arbeit, die keine der beiden Seiten besitzen sollte: ROT13 hat nicht über Terminalfarben zu entscheiden, und die Konsole hat die Nutzlastform von ROT13 nicht zu verstehen.
|
||||||
|
|
||||||
|
Die Grenze zieht die **Vertragskompatibilität**, nicht die Frage, ob etwas hinzukommt. Ein Vermittler, der Celsius in Fahrenheit umrechnet, ändert statt hinzuzufügen und hat seinen Platz verdient; einer, der einer schon verstandenen Nachricht einen Zeitstempel anhängt, hat etwas hinzugefügt und bleibt verdächtig. Die Frage ist immer: könnte der Konsument die Nachricht des Produzenten so lesen, wie sie ist?
|
||||||
|
|
||||||
|
> Versteht ein Konsument die Veröffentlichung eines Produzenten semantisch, genügt direktes Abonnieren oft.
|
||||||
|
> Sind die Verträge inkompatibel, führe einen Transformator ein, der eine echte Anpassung leistet.
|
||||||
|
>
|
||||||
|
> Ein Vermittler, der nur kompatible Daten weiterleitet, ist verdächtig. Ein Vermittler, der nötige Semantik hinzufügt, hat seine Existenz verdient.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The transformer is egoistic too]{.en}[Le transformateur est égoïste aussi]{.fr}[Auch der Transformator ist egoistisch]{.de} {#sec-egoistic-transformer}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Inserted into the chain, the transformer subscribes to `rot13/outbox` and publishes to **its own** outbox; ConsoleOut then subscribes to the transformer's outbox instead of ROT13's. Note what that costs in code: **nothing**. ConsoleOut receives a different Intent — `TOPIC display/outbox` rather than `TOPIC rot13/outbox` — and the chain is rewired. ROT13 never learns the transformer exists; the transformer never learns ConsoleOut exists.
|
||||||
|
|
||||||
|
Why not let it publish straight into `consoleOut/inbox`, saving a mailbox? Four reasons:
|
||||||
|
|
||||||
|
- **knowledge** — it would contain ConsoleOut's name, which is topology inside a service, the relapse of step 28;
|
||||||
|
- **ownership** — that inbox is ConsoleOut's control channel, written by the configurator; payload from the transformer would give it two authorities;
|
||||||
|
- **reach** — its own outbox can be read by a logger, a web view or a second display at no cost, while one inbox serves exactly one consumer;
|
||||||
|
- **mutability** — an aggregator can later be inserted after it by sending one different Intent, with no component edited.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Inséré dans la chaîne, le transformateur s'abonne à `rot13/outbox` et publie dans **sa propre** boîte de sortie ; ConsoleOut s'abonne alors à celle du transformateur plutôt qu'à celle de ROT13. Notez ce que cela coûte en code : **rien**. ConsoleOut reçoit un autre Intent — `TOPIC display/outbox` au lieu de `TOPIC rot13/outbox` — et la chaîne est recâblée. ROT13 n'apprend jamais que le transformateur existe ; le transformateur n'apprend jamais que ConsoleOut existe.
|
||||||
|
|
||||||
|
Pourquoi ne pas publier directement dans `consoleOut/inbox`, en économisant une boîte ? Quatre raisons :
|
||||||
|
|
||||||
|
- **connaissance** — il contiendrait le nom de ConsoleOut, c'est-à-dire de la topologie dans un service, la rechute de l'étape 28 ;
|
||||||
|
- **propriété** — cette boîte est le canal de contrôle de ConsoleOut, écrit par le configurateur ; une charge utile venue du transformateur lui donnerait deux autorités ;
|
||||||
|
- **portée** — sa propre boîte peut être lue par un journal, une vue web ou un second affichage sans frais, alors qu'une boîte d'entrée ne sert qu'un consommateur ;
|
||||||
|
- **mutabilité** — un agrégateur peut être inséré ensuite en envoyant un autre Intent, sans modifier aucun composant.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
In die Kette eingefügt, abonniert der Transformator `rot13/outbox` und veröffentlicht in **sein eigenes** Ausgangspostfach; ConsoleOut abonniert dann dieses statt das von ROT13. Was das an Code kostet: **nichts**. ConsoleOut erhält einen anderen Intent — `TOPIC display/outbox` statt `TOPIC rot13/outbox` — und die Kette ist umverdrahtet. ROT13 erfährt nie, dass der Transformator existiert; der Transformator nie, dass ConsoleOut existiert.
|
||||||
|
|
||||||
|
Warum nicht direkt in `consoleOut/inbox` veröffentlichen und ein Postfach sparen? Vier Gründe:
|
||||||
|
|
||||||
|
- **Wissen** — er enthielte ConsoleOuts Namen, also Topologie in einem Dienst, der Rückfall von Schritt 28;
|
||||||
|
- **Besitz** — dieses Postfach ist ConsoleOuts Steuerkanal, geschrieben vom Konfigurator; Nutzlast vom Transformator gäbe ihm zwei Autoritäten;
|
||||||
|
- **Reichweite** — sein eigenes Ausgangspostfach kann ein Logger, eine Webansicht oder ein zweites Display kostenlos lesen, während ein Eingangspostfach genau einen Konsumenten bedient;
|
||||||
|
- **Veränderbarkeit** — ein Aggregator lässt sich danach durch einen anderen Intent einfügen, ohne eine Komponente zu ändern.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The complete filesystem architecture]{.en}[L'architecture complète sur système de fichiers]{.fr}[Die vollständige Dateisystem-Architektur]{.de} {#sec-complete-filesystem}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Every mailbox with exactly one writer:
|
||||||
|
|
||||||
|
| mailbox | single writer |
|
||||||
|
|---|---|
|
||||||
|
| `consoleIn/outbox` | SensorService |
|
||||||
|
| `rot13/outbox` | ProcessorService |
|
||||||
|
| `display/outbox` | the transformer |
|
||||||
|
| every control inbox | the configurator — the one designated Intent authority |
|
||||||
|
| the terminal | ActuatorService, which writes no mailbox at all |
|
||||||
|
|
||||||
|
Egoistic capabilities, Intent from one authority, a transformer only where contracts differ, one writer per resource, and the topology nowhere in the capabilities. That is the design the filesystem was good enough to teach — and the next part asks what the filesystem itself is no longer good enough for.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Chaque boîte avec exactement un écrivain :
|
||||||
|
|
||||||
|
| boîte | écrivain unique |
|
||||||
|
|---|---|
|
||||||
|
| `consoleIn/outbox` | SensorService |
|
||||||
|
| `rot13/outbox` | ProcessorService |
|
||||||
|
| `display/outbox` | le transformateur |
|
||||||
|
| chaque boîte de contrôle | le configurateur — l'unique autorité d'Intent désignée |
|
||||||
|
| le terminal | ActuatorService, qui n'écrit aucune boîte |
|
||||||
|
|
||||||
|
Des capacités égoïstes, l'Intent venant d'une seule autorité, un transformateur seulement là où les contrats diffèrent, un écrivain par ressource, et la topologie nulle part dans les capacités. C'est la conception que le système de fichiers a suffi à enseigner — et la partie suivante demande à quoi le système de fichiers, lui, ne suffit plus.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Jedes Postfach mit genau einem Schreiber:
|
||||||
|
|
||||||
|
| Postfach | einziger Schreiber |
|
||||||
|
|---|---|
|
||||||
|
| `consoleIn/outbox` | SensorService |
|
||||||
|
| `rot13/outbox` | ProcessorService |
|
||||||
|
| `display/outbox` | der Transformator |
|
||||||
|
| jedes Steuerpostfach | der Konfigurator — die eine bestimmte Intent-Autorität |
|
||||||
|
| das Terminal | ActuatorService, der kein Postfach schreibt |
|
||||||
|
|
||||||
|
Egoistische Fähigkeiten, Intent aus einer Autorität, ein Transformator nur dort, wo Verträge sich unterscheiden, ein Schreiber pro Ressource, und die Topologie nirgends in den Fähigkeiten. Das ist der Entwurf, den das Dateisystem gut genug war zu lehren — und der nächste Teil fragt, wofür das Dateisystem selbst nicht mehr gut genug ist.
|
||||||
|
:::
|
||||||
@@ -0,0 +1,464 @@
|
|||||||
|
# [Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de} {#sec-part-ix}
|
||||||
|
|
||||||
|
<!-- MULTILINGUAL: see the comment at the top of index.qmd.
|
||||||
|
Part VIII (step 53) is one step and opens this chapter rather than
|
||||||
|
standing alone. -->
|
||||||
|
|
||||||
|
## [What the filesystem taught, and what it is not for]{.en}[Ce que le système de fichiers a enseigné, et ce pour quoi il n'est pas fait]{.fr}[Was das Dateisystem gelehrt hat und wofür es nicht taugt]{.de} {#sec-filesystem-verdict}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The filesystem taught publication boundaries, directories as addresses, observation, independent processes, independent languages, synchronisation latency, runtime wiring, State, Intent, Events, mediator costs, service ownership and transformer services. It was a good teacher and it is not an elegant message broker: by the end the architecture was clean and the transport was a pile of `.tmp` files, atomic moves, rescanning, shared paths and replication delay.
|
||||||
|
|
||||||
|
The conclusion is **not** "files bad, MQTT good". The filesystem has an advantage MQTT cannot match — it routinely stores gigabytes or terabytes, while brokers and clients are built for small messages, and chunking a huge payload over MQTT means inventing a file-transfer protocol inside a message protocol. So:
|
||||||
|
|
||||||
|
> Use messages for coordination and events. Use an appropriate file or object store for large data. A message can carry the **location, identity and metadata** of that data instead of the terabytes themselves.
|
||||||
|
|
||||||
|
A replicated filesystem also gives every machine a local copy, which is a genuine strength — though replication is not a backup: deletion and corruption replicate too, unless versioning preserves older copies.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Le système de fichiers a enseigné les frontières de publication, les répertoires comme adresses, l'observation, des processus indépendants, des langages indépendants, la latence de synchronisation, le câblage à l'exécution, le State, l'Intent, les Events, le coût des médiateurs, la propriété des services et les services transformateurs. Ce fut un bon professeur, et ce n'est pas un courtier de messages élégant : à la fin, l'architecture était propre et le transport était un amas de fichiers `.tmp`, de déplacements atomiques, de rescans, de chemins partagés et de délais de réplication.
|
||||||
|
|
||||||
|
La conclusion n'est **pas** « fichiers mauvais, MQTT bon ». Le système de fichiers a un avantage que MQTT ne peut égaler — il stocke couramment des gigaoctets ou des téraoctets, alors que courtiers et clients sont conçus pour de petits messages, et découper une charge énorme sur MQTT revient à inventer un protocole de transfert de fichiers dans un protocole de messages. Donc :
|
||||||
|
|
||||||
|
> Utilisez les messages pour la coordination et les événements. Utilisez un stockage de fichiers ou d'objets adapté pour les grandes données. Un message peut porter l'**emplacement, l'identité et les métadonnées** de ces données au lieu des téraoctets eux-mêmes.
|
||||||
|
|
||||||
|
Un système de fichiers répliqué donne aussi à chaque machine une copie locale, ce qui est une vraie force — mais la réplication n'est pas une sauvegarde : suppressions et corruptions se répliquent aussi, à moins qu'un versionnement conserve les copies antérieures.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Das Dateisystem lehrte Veröffentlichungsgrenzen, Verzeichnisse als Adressen, Beobachtung, unabhängige Prozesse, unabhängige Sprachen, Synchronisationslatenz, Verdrahtung zur Laufzeit, State, Intent, Events, Vermittlerkosten, Dienstbesitz und Transformatordienste. Es war ein guter Lehrer und ist kein eleganter Nachrichten-Broker: am Ende war die Architektur sauber und der Transport ein Haufen `.tmp`-Dateien, atomarer Verschiebungen, erneuter Scans, geteilter Pfade und Replikationsverzögerung.
|
||||||
|
|
||||||
|
Die Schlussfolgerung ist **nicht** „Dateien schlecht, MQTT gut". Das Dateisystem hat einen Vorteil, den MQTT nicht erreicht — es speichert routinemässig Gigabytes bis Terabytes, während Broker und Clients für kleine Nachrichten gebaut sind, und das Stückeln einer riesigen Nutzlast über MQTT heisst, ein Dateitransferprotokoll in einem Nachrichtenprotokoll zu erfinden. Also:
|
||||||
|
|
||||||
|
> Nachrichten für Koordination und Ereignisse. Für grosse Daten ein passender Datei- oder Objektspeicher. Eine Nachricht kann **Ort, Identität und Metadaten** dieser Daten tragen statt der Terabytes selbst.
|
||||||
|
|
||||||
|
Ein repliziertes Dateisystem gibt zudem jeder Maschine eine lokale Kopie, eine echte Stärke — doch Replikation ist kein Backup: Löschungen und Beschädigungen replizieren mit, sofern nicht eine Versionierung ältere Kopien bewahrt.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [MQTT should look familiar]{.en}[MQTT devrait sembler familier]{.fr}[MQTT sollte vertraut wirken]{.de} {#sec-mqtt-mapping}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
| filesystem / Syncthing | MQTT |
|
||||||
|
|---|---|
|
||||||
|
| synchronised message-board root | broker / namespace |
|
||||||
|
| directory path | topic |
|
||||||
|
| `.msg` file | publication |
|
||||||
|
| file contents | payload |
|
||||||
|
| `WatchService` | subscription |
|
||||||
|
| dynamic directory | topic / filter |
|
||||||
|
| control directory | `I` |
|
||||||
|
| state directory | `S/…` |
|
||||||
|
| event directory | `E/…` |
|
||||||
|
|
||||||
|
The reaction the material is after: *"Oh. We already know this architecture."* MQTT is a transport change, not an architectural claim.
|
||||||
|
|
||||||
|
Two things a directory could not do, both visible in a minute at the command line. A publication made **before** a subscriber exists never reaches it — the stranded-message problem for the third time, now with an answer the filesystem never had. And a filter like `test/#` matches `test/a` and `test/a/b/c` but not `testing/x`, because `#` works on **levels**, not string prefixes; `test/+` would match only one level down.
|
||||||
|
|
||||||
|
The deeper correction: **a topic is not a container.** There is no object called `test/a` on the broker. A topic is a routing key carried by each publication and matched against the filters of whoever is subscribed at that instant. Directories *hold* messages; topics *match* them. One subscription therefore covers topics that do not exist yet — where a message board needed a new directory and a new registration.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
| système de fichiers / Syncthing | MQTT |
|
||||||
|
|---|---|
|
||||||
|
| racine du tableau de messages synchronisé | courtier / espace de noms |
|
||||||
|
| chemin de répertoire | sujet (*topic*) |
|
||||||
|
| fichier `.msg` | publication |
|
||||||
|
| contenu du fichier | charge utile |
|
||||||
|
| `WatchService` | abonnement |
|
||||||
|
| répertoire dynamique | sujet / filtre |
|
||||||
|
| répertoire de contrôle | `I` |
|
||||||
|
| répertoire d'état | `S/…` |
|
||||||
|
| répertoire d'événements | `E/…` |
|
||||||
|
|
||||||
|
La réaction visée par le matériel : « Ah. Nous connaissons déjà cette architecture. » MQTT est un changement de transport, pas une affirmation architecturale.
|
||||||
|
|
||||||
|
Deux choses qu'un répertoire ne pouvait pas faire, visibles en une minute en ligne de commande. Une publication faite **avant** l'existence d'un abonné ne lui parvient jamais — le constat des messages bloqués, pour la troisième fois, mais avec une réponse que le système de fichiers n'avait pas. Et un filtre comme `test/#` correspond à `test/a` et `test/a/b/c` mais pas à `testing/x`, car `#` travaille par **niveaux** et non par préfixes de chaîne ; `test/+` ne correspondrait qu'à un seul niveau.
|
||||||
|
|
||||||
|
La correction plus profonde : **un sujet n'est pas un conteneur.** Il n'existe aucun objet nommé `test/a` sur le courtier. Un sujet est une clé de routage portée par chaque publication et confrontée aux filtres de qui est abonné à cet instant. Les répertoires *contiennent* les messages ; les sujets les *filtrent*. Un seul abonnement couvre donc des sujets qui n'existent pas encore — là où un tableau de messages exigeait un nouveau répertoire et un nouvel enregistrement.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
| Dateisystem / Syncthing | MQTT |
|
||||||
|
|---|---|
|
||||||
|
| Wurzel des synchronisierten Nachrichtenbretts | Broker / Namensraum |
|
||||||
|
| Verzeichnispfad | Topic |
|
||||||
|
| `.msg`-Datei | Veröffentlichung |
|
||||||
|
| Dateiinhalt | Nutzlast |
|
||||||
|
| `WatchService` | Abonnement |
|
||||||
|
| dynamisches Verzeichnis | Topic / Filter |
|
||||||
|
| Steuerverzeichnis | `I` |
|
||||||
|
| Zustandsverzeichnis | `S/…` |
|
||||||
|
| Ereignisverzeichnis | `E/…` |
|
||||||
|
|
||||||
|
Die gewünschte Reaktion des Materials: „Ach. Diese Architektur kennen wir schon." MQTT ist ein Transportwechsel, keine architektonische Aussage.
|
||||||
|
|
||||||
|
Zwei Dinge, die ein Verzeichnis nicht konnte, in einer Minute auf der Kommandozeile sichtbar. Eine Veröffentlichung **vor** der Existenz eines Abonnenten erreicht ihn nie — die Lehre der liegengebliebenen Nachrichten zum dritten Mal, nun mit einer Antwort, die das Dateisystem nie hatte. Und ein Filter wie `test/#` passt auf `test/a` und `test/a/b/c`, nicht aber auf `testing/x`, weil `#` auf **Ebenen** arbeitet, nicht auf Zeichenpräfixen; `test/+` passte nur eine Ebene tief.
|
||||||
|
|
||||||
|
Die tiefere Korrektur: **ein Topic ist kein Behälter.** Es gibt kein Objekt namens `test/a` auf dem Broker. Ein Topic ist ein Routing-Schlüssel, den jede Veröffentlichung trägt und der gegen die Filter derjenigen geprüft wird, die in diesem Moment abonniert haben. Verzeichnisse *halten* Nachrichten; Topics *vergleichen* sie. Ein Abonnement deckt daher Topics ab, die noch nicht existieren — wo ein Nachrichtenbrett ein neues Verzeichnis und eine neue Registrierung brauchte.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The library, the client id and the broker address]{.en}[La bibliothèque, l'identifiant client et l'adresse du courtier]{.fr}[Die Bibliothek, die Client-ID und die Broker-Adresse]{.de} {#sec-paho}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Java has no MQTT client in its standard library, so Paho arrives now — after the need, like the mediator in step 7 and Jackson in step 64. Four things are needed from it: connect, publish, subscribe, callback. Connecting is deliberately anticlimactic: *"Nothing architectural happened here. We merely attached our process to the transport."*
|
||||||
|
|
||||||
|
Two details of connecting carry weight:
|
||||||
|
|
||||||
|
- **the client id** is not merely a uniqueness token. The broker recognises a returning client by it and keeps session state for it: subscriptions, messages queued at QoS > 0, and the association with its Last Will. A directory never knew who was watching, which is exactly why a restarted watcher's backlog was never replayed.
|
||||||
|
- **the broker address** is deployment configuration: every runnable reads `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. It is also the one piece of configuration that cannot arrive as Intent, because Intent travels *through* the broker. Topology can be published; the address of the thing that publishes it cannot.
|
||||||
|
|
||||||
|
Subscribing costs one packet, and **the broker keeps the subscription list**. There is no standard way to ask it what another client subscribed to — which is why `S/subscriptions` exists: a component's own declaration of its wiring, published so the architecture can know what the transport keeps private. Only its owner may publish it, by the one-writer rule, because only its owner knows what it accepted.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Java n'a pas de client MQTT dans sa bibliothèque standard ; Paho arrive donc maintenant — après le besoin, comme le médiateur à l'étape 7 et Jackson à l'étape 64. Quatre choses suffisent : se connecter, publier, s'abonner, rappeler. La connexion est volontairement anticlimatique : « Rien d'architectural ne s'est produit ici. Nous avons simplement attaché notre processus au transport. »
|
||||||
|
|
||||||
|
Deux détails de la connexion comptent :
|
||||||
|
|
||||||
|
- **l'identifiant client** n'est pas qu'un jeton d'unicité. Le courtier reconnaît par lui un client qui revient et conserve son état de session : abonnements, messages en file en QoS > 0, et l'association à sa dernière volonté. Un répertoire ne savait jamais qui l'observait, et c'est précisément pour cela qu'un observateur redémarré ne rejouait rien.
|
||||||
|
- **l'adresse du courtier** est de la configuration de déploiement : chaque programme lit `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. C'est aussi la seule configuration qui ne peut pas arriver par Intent, puisque l'Intent passe *par* le courtier. La topologie se publie ; l'adresse de ce qui la publie, non.
|
||||||
|
|
||||||
|
S'abonner coûte un paquet, et **le courtier détient la liste des abonnements**. Il n'existe aucun moyen standard de lui demander à quoi un autre client s'est abonné — d'où `S/subscriptions` : la déclaration par un composant de son propre câblage, publiée pour que l'architecture sache ce que le transport garde privé. Seul son propriétaire peut la publier, par la règle de l'écrivain unique, car seul lui sait ce qu'il a accepté.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Java hat keinen MQTT-Client in der Standardbibliothek, also kommt Paho jetzt — nach dem Bedarf, wie der Vermittler in Schritt 7 und Jackson in Schritt 64. Vier Dinge braucht man: verbinden, veröffentlichen, abonnieren, Rückruf. Das Verbinden ist absichtlich unspektakulär: „Hier ist architektonisch nichts geschehen. Wir haben unseren Prozess nur an den Transport angeschlossen."
|
||||||
|
|
||||||
|
Zwei Details des Verbindens haben Gewicht:
|
||||||
|
|
||||||
|
- **die Client-ID** ist nicht bloss ein Eindeutigkeitsmerkmal. Der Broker erkennt daran einen zurückkehrenden Client und hält Sitzungszustand für ihn: Abonnements, bei QoS > 0 eingereihte Nachrichten und die Verknüpfung mit seinem Last Will. Ein Verzeichnis wusste nie, wer es beobachtete — genau deshalb spielte ein neu gestarteter Beobachter nichts nach.
|
||||||
|
- **die Broker-Adresse** ist Deployment-Konfiguration: jedes Programm liest `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. Sie ist auch die einzige Konfiguration, die nicht als Intent kommen kann, denn Intent reist *durch* den Broker. Topologie lässt sich veröffentlichen; die Adresse des Veröffentlichenden nicht.
|
||||||
|
|
||||||
|
Abonnieren kostet ein Paket, und **der Broker führt die Abonnementliste**. Es gibt keinen Standardweg, ihn zu fragen, was ein anderer Client abonniert hat — daher `S/subscriptions`: die eigene Erklärung einer Komponente über ihre Verdrahtung, veröffentlicht, damit die Architektur weiss, was der Transport privat hält. Nur ihr Eigentümer darf sie veröffentlichen, nach der Ein-Schreiber-Regel, denn nur er weiss, was er angenommen hat.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [Structured Intent, and two object mappers]{.en}[Intent structuré, et deux mappeurs]{.fr}[Strukturierter Intent und zwei Mapper]{.de} {#sec-structured-intent}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
`TOPIC some/path` has one field and one meaning. It cannot say which *kind* of Intent this is, carry a second parameter, nest, or be extended; and there is nothing for a receiver to validate against. Richer Intent wants structure:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
subscribe:
|
||||||
|
topic: Demo/ConsoleIn/U/alice/E/text
|
||||||
|
```
|
||||||
|
|
||||||
|
Only then does a serialisation library have a clear job. `JsonTools` keeps **two** mappers, and the asymmetry is deliberate:
|
||||||
|
|
||||||
|
- reading uses a **YAML** factory with `FAIL_ON_UNKNOWN_PROPERTIES` off — JSON is a subset of YAML, so hand-typed Intent is accepted, and a newer configurator can send fields an older service ignores;
|
||||||
|
- writing uses plain **JSON** with `INDENT_OUTPUT` on, so published payloads are strict and readable.
|
||||||
|
|
||||||
|
Tolerant in, strict out. A single shared mapper would have to give up one of those.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
`TOPIC some/path` a un champ et un sens. Il ne peut pas dire de quel *type* d'Intent il s'agit, porter un second paramètre, s'imbriquer ou s'étendre ; et un récepteur n'a rien contre quoi valider. Un Intent plus riche demande une structure :
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
subscribe:
|
||||||
|
topic: Demo/ConsoleIn/U/alice/E/text
|
||||||
|
```
|
||||||
|
|
||||||
|
C'est seulement là qu'une bibliothèque de sérialisation a une tâche claire. `JsonTools` garde **deux** mappeurs, et l'asymétrie est voulue :
|
||||||
|
|
||||||
|
- en entrée, une fabrique **YAML** avec `FAIL_ON_UNKNOWN_PROPERTIES` désactivé — JSON étant un sous-ensemble de YAML, un Intent tapé à la main est accepté, et un configurateur plus récent peut envoyer des champs qu'un service plus ancien ignore ;
|
||||||
|
- l'écriture utilise du **JSON** strict avec `INDENT_OUTPUT` activé, donc les charges publiées sont strictes et lisibles.
|
||||||
|
|
||||||
|
Tolérant en entrée, strict en sortie. Un mappeur unique devrait renoncer à l'un des deux.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
`TOPIC some/path` hat ein Feld und eine Bedeutung. Es kann nicht sagen, welche *Art* Intent vorliegt, keinen zweiten Parameter tragen, nicht verschachteln, nicht erweitert werden; und ein Empfänger hat nichts, wogegen er prüfen könnte. Reicherer Intent braucht Struktur:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
subscribe:
|
||||||
|
topic: Demo/ConsoleIn/U/alice/E/text
|
||||||
|
```
|
||||||
|
|
||||||
|
Erst dann hat eine Serialisierungsbibliothek eine klare Aufgabe. `JsonTools` hält **zwei** Mapper, und die Asymmetrie ist Absicht:
|
||||||
|
|
||||||
|
- das Lesen nutzt eine **YAML**-Factory mit abgeschaltetem `FAIL_ON_UNKNOWN_PROPERTIES` — JSON ist eine Teilmenge von YAML, handgetippter Intent wird akzeptiert, und ein neuerer Konfigurator darf Felder senden, die ein älterer Dienst ignoriert;
|
||||||
|
- das Schreiben nutzt strenges **JSON** mit `INDENT_OUTPUT`, die veröffentlichten Nutzlasten sind also streng und lesbar.
|
||||||
|
|
||||||
|
Tolerant hinein, streng hinaus. Ein einziger Mapper müsste auf eines davon verzichten.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [DUISE, and rewiring a running system]{.en}[DUISE, et recâbler un système en marche]{.fr}[DUISE und das Umverdrahten im Betrieb]{.de} {#sec-duise}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The naming scheme finally gets its name: **D**escription (what contracts this service understands and publishes), **U**nit (which instance), **I**ntent (requested behaviour), **S**tatus (what is true now), **E**vent (what happened).
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted}
|
||||||
|
```
|
||||||
|
|
||||||
|
`U/<unit>` is what the filesystem never needed: each machine had its own replica of the same relative path, so instance identity was implicit. MQTT has one shared namespace, so a topic must say *which* copy. Hard-coding `U/alice` in a capability is therefore worse than hard-coding `consoleIn.outbox` ever was: it binds the build to one deployment. Configured by Intent, **one build serves everyone** — which is why `MqttConfigure` takes three unit names as arguments. The unit names *are* the topology.
|
||||||
|
|
||||||
|
Rewiring, observed on a running system: publish a new Intent naming a different source topic, and the service unsubscribes from the old one, subscribes to the new one, and republishes `S/subscriptions` to match. No restart, no edit. Send an invalid filter instead — `Demo/#/E/text`, where `#` is not the last level — and `MqttTools.isValidFilter` rejects it; the old subscription stands and the Status still tells the truth.
|
||||||
|
|
||||||
|
That rejection exposes a real gap, worth naming rather than hiding: it is logged locally only. The configurator cannot tell whether its Intent was applied or refused, and a monitor cannot distinguish "refused" from "not yet processed". In this design a sender learns the outcome by reading Status and comparing it with what it asked for. Publishing refusals as an Event, or a last-error Status, would close that gap; neither is in the material, so it is a design decision to justify.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Le schéma de nommage reçoit enfin son nom : **D**escription (quels contrats ce service comprend et publie), **U**nit (quelle instance), **I**ntent (comportement demandé), **S**tatus (ce qui est vrai maintenant), **E**vent (ce qui est arrivé).
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted}
|
||||||
|
```
|
||||||
|
|
||||||
|
`U/<unit>` est ce dont le système de fichiers n'avait pas besoin : chaque machine avait sa réplique du même chemin relatif, l'identité d'instance était implicite. MQTT a un espace de noms partagé : un sujet doit donc dire *quelle* copie. Coder en dur `U/alice` dans une capacité est donc pire que de coder en dur `consoleIn.outbox` : cela lie la compilation à un déploiement. Configuré par Intent, **une seule compilation sert tout le monde** — d'où les trois noms d'unité en arguments de `MqttConfigure`. Les noms d'unité *sont* la topologie.
|
||||||
|
|
||||||
|
Recâblage observé sur un système en marche : publiez un nouvel Intent nommant une autre source, et le service se désabonne de l'ancienne, s'abonne à la nouvelle et republie `S/subscriptions` en conséquence. Sans redémarrage, sans édition. Envoyez au contraire un filtre invalide — `Demo/#/E/text`, où `#` n'est pas le dernier niveau — et `MqttTools.isValidFilter` le rejette ; l'ancien abonnement demeure et le Status continue de dire vrai.
|
||||||
|
|
||||||
|
Ce rejet révèle une vraie lacune, à nommer plutôt qu'à cacher : il n'est journalisé que localement. Le configurateur ne peut savoir si son Intent a été appliqué ou refusé, et un moniteur ne peut distinguer « refusé » de « pas encore traité ». Dans cette conception, l'émetteur apprend le résultat en lisant le Status et en le comparant à sa demande. Publier les refus comme Event, ou un Status de dernière erreur, combleraient la lacune ; ni l'un ni l'autre n'est dans le matériel : c'est une décision de conception à justifier.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Das Namensschema erhält endlich seinen Namen: **D**escription (welche Verträge dieser Dienst versteht und veröffentlicht), **U**nit (welche Instanz), **I**ntent (gewünschtes Verhalten), **S**tatus (was jetzt gilt), **E**vent (was geschehen ist).
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted}
|
||||||
|
```
|
||||||
|
|
||||||
|
`U/<unit>` brauchte das Dateisystem nie: jede Maschine hatte ihr eigenes Replikat desselben relativen Pfades, Instanzidentität war implizit. MQTT hat einen gemeinsamen Namensraum, ein Topic muss also sagen, *welche* Kopie. `U/alice` in einer Fähigkeit festzuschreiben ist daher schlimmer, als `consoleIn.outbox` es je war: es bindet das Build an ein Deployment. Per Intent konfiguriert, **dient ein Build allen** — daher die drei Unit-Namen als Argumente von `MqttConfigure`. Die Unit-Namen *sind* die Topologie.
|
||||||
|
|
||||||
|
Umverdrahten, am laufenden System beobachtet: einen neuen Intent mit anderer Quelle veröffentlichen, und der Dienst kündigt die alte, abonniert die neue und veröffentlicht `S/subscriptions` passend neu. Kein Neustart, keine Änderung. Schickt man stattdessen einen ungültigen Filter — `Demo/#/E/text`, wo `#` nicht die letzte Ebene ist — weist `MqttTools.isValidFilter` ihn ab; das alte Abonnement bleibt, und der Status sagt weiter die Wahrheit.
|
||||||
|
|
||||||
|
Diese Abweisung legt eine echte Lücke offen, die man benennen und nicht verstecken sollte: sie wird nur lokal protokolliert. Der Konfigurator erfährt nicht, ob sein Intent angewandt oder abgelehnt wurde, und ein Monitor kann „abgelehnt" nicht von „noch nicht verarbeitet" unterscheiden. In diesem Entwurf erfährt ein Sender das Ergebnis, indem er den Status liest und mit seiner Anfrage vergleicht. Abweisungen als Event zu veröffentlichen oder ein Letzter-Fehler-Status würden die Lücke schliessen; beides steht nicht im Material — es ist eine zu begründende Entwurfsentscheidung.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What a new subscriber learns, and what a dead one admits]{.en}[Ce qu'un nouvel abonné apprend, et ce qu'un mort avoue]{.fr}[Was ein neuer Abonnent erfährt und was ein Toter zugibt]{.de} {#sec-retained-and-will}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
Subscribing to `Demo/#` for three seconds, with nothing being published, returns this:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ROT13/U/nitro5/S/subscriptions/text "Demo/ConsoleIn/U/nitro5/E/text"
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/subscriptions/text "Demo/ROT13/U/nitro5/E/crypted"
|
||||||
|
```
|
||||||
|
|
||||||
|
A late arrival learns the entire current wiring of the system, instantly, without asking anyone and without any component knowing a monitor exists. That is retained **Status**. No Events arrive, because Events are published non-retained — "retained State, non-retained Events". It is also the proper answer to the instinct of *asking* a service what it is doing: nobody asks; the service states it, once, and the broker keeps it for whoever turns up.
|
||||||
|
|
||||||
|
Retained Status alone would lie, though. Kill a service with `Ctrl+C` and its `S/online = true` stays on the broker forever. Hence the **Last Will**, registered at connect time:
|
||||||
|
|
||||||
|
```java
|
||||||
|
var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties());
|
||||||
|
options.setWill(lastWillTopic, will);
|
||||||
|
```
|
||||||
|
|
||||||
|
The will is **retained**, so when the broker publishes it on the client's behalf it replaces the stale `true`. The component that fails is not the component that reports the failure — which is the only arrangement that can work. One caveat: a clean DISCONNECT does **not** trigger a will, so a well-behaved service publishes `online=false` itself on the way out, and the will covers the ugly deaths.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
S'abonner à `Demo/#` pendant trois secondes, sans que rien ne soit publié, renvoie ceci :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ROT13/U/nitro5/S/subscriptions/text "Demo/ConsoleIn/U/nitro5/E/text"
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/subscriptions/text "Demo/ROT13/U/nitro5/E/crypted"
|
||||||
|
```
|
||||||
|
|
||||||
|
Un arrivant tardif apprend instantanément tout le câblage actuel du système, sans rien demander et sans qu'aucun composant sache qu'un moniteur existe. C'est le **Status** retenu. Aucun Event n'arrive, car les Events sont publiés non retenus — « State retenu, Events non retenus ». C'est aussi la bonne réponse à l'instinct de *demander* à un service ce qu'il fait : personne ne demande ; le service le déclare, une fois, et le courtier le garde pour quiconque se présente.
|
||||||
|
|
||||||
|
Le Status retenu seul mentirait pourtant. Tuez un service par `Ctrl+C` et son `S/online = true` reste sur le courtier à jamais. D'où la **dernière volonté**, enregistrée au moment de la connexion :
|
||||||
|
|
||||||
|
```java
|
||||||
|
var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties());
|
||||||
|
options.setWill(lastWillTopic, will);
|
||||||
|
```
|
||||||
|
|
||||||
|
Elle est **retenue** : quand le courtier la publie au nom du client, elle remplace le `true` périmé. Le composant qui échoue n'est pas celui qui signale l'échec — seul arrangement qui puisse fonctionner. Une réserve : une déconnexion propre ne déclenche **pas** la dernière volonté ; un service bien élevé publie donc `online=false` lui-même en partant, la volonté couvrant les morts brutales.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Drei Sekunden `Demo/#` abonnieren, ohne dass etwas veröffentlicht wird, ergibt dies:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Demo/ROT13/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ROT13/U/nitro5/S/subscriptions/text "Demo/ConsoleIn/U/nitro5/E/text"
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/online {"value":true}
|
||||||
|
Demo/ConsoleOut/U/nitro5/S/subscriptions/text "Demo/ROT13/U/nitro5/E/crypted"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ein Spätankömmling erfährt augenblicklich die gesamte aktuelle Verdrahtung des Systems, ohne jemanden zu fragen und ohne dass eine Komponente von einem Monitor weiss. Das ist retained **Status**. Keine Events kommen an, denn Events werden nicht retained veröffentlicht — „retained State, nicht retained Events". Es ist auch die richtige Antwort auf den Reflex, einen Dienst zu *fragen*, was er tut: niemand fragt; der Dienst erklärt es einmal, und der Broker bewahrt es für jeden, der kommt.
|
||||||
|
|
||||||
|
Retained Status allein würde allerdings lügen. Beendet man einen Dienst mit `Ctrl+C`, bleibt sein `S/online = true` für immer beim Broker. Daher der **Last Will**, bei der Verbindung registriert:
|
||||||
|
|
||||||
|
```java
|
||||||
|
var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties());
|
||||||
|
options.setWill(lastWillTopic, will);
|
||||||
|
```
|
||||||
|
|
||||||
|
Der Will ist **retained**, ersetzt also beim Veröffentlichen durch den Broker das veraltete `true`. Die Komponente, die ausfällt, ist nicht die, die den Ausfall meldet — die einzige Anordnung, die funktionieren kann. Ein Vorbehalt: ein sauberes DISCONNECT löst **keinen** Will aus; ein gut erzogener Dienst veröffentlicht daher beim Beenden selbst `online=false`, und der Will deckt die hässlichen Tode.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [What survived the transport, and what coupling remains]{.en}[Ce qui a survécu au transport, et le couplage restant]{.fr}[Was den Transport überlebte und welche Kopplung bleibt]{.de} {#sec-coupling-remains}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The lower half of the filesystem→MQTT table is the point: `I`, `S`, `E`, egoistic services, runtime topology and "transformer if needed" are **unchanged**. The architecture survived the transport replacement, and that is the strongest available evidence that the architecture was never about the transport.
|
||||||
|
|
||||||
|
Loose coupling does not mean nothing knows anything. What remains, necessarily, is agreement on: message syntax, message semantics, topic contracts, Intent, ownership, the meaning of State and the meaning of Events. The goal is not to eliminate coupling but to **eliminate unnecessary knowledge**. Concretely, in this system each service must understand exactly one foreign Event contract — ROT13 understands ConsoleIn's `E/text`, ConsoleOut understands ROT13's `E/crypted` — plus the Intent schema it accepts on its own `I`. That list is the irreducible minimum.
|
||||||
|
|
||||||
|
Separately, the broker is a shared infrastructure dependency: everyone needs its address and nothing works without it. Real, but a different kind of thing from one component knowing another.
|
||||||
|
|
||||||
|
The step-78 checklist is the tool to keep. Twelve questions, of which these six carry the argument for this system:
|
||||||
|
|
||||||
|
| question | answer here |
|
||||||
|
|---|---|
|
||||||
|
| does a capability contain a hard-coded producer identity? | no — it arrives as Intent |
|
||||||
|
| which foreign contracts must it understand? | one Event contract each, plus its own Intent schema |
|
||||||
|
| where is topology defined? | in the configurator, outside the data path |
|
||||||
|
| can topology change without recompiling? | yes — demonstrated on a running system |
|
||||||
|
| could the transport be replaced? | yes — demonstrated, filesystem then MQTT |
|
||||||
|
| does every mediator do something that needs mediation? | yes, vacuously: `TEXT → TEXT` needs none, and none exists |
|
||||||
|
|
||||||
|
The material's own caution applies: the answers need not all be "no". They need to be **intentional**.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
La moitié inférieure du tableau système de fichiers→MQTT est l'essentiel : `I`, `S`, `E`, les services égoïstes, la topologie à l'exécution et « transformateur si nécessaire » sont **inchangés**. L'architecture a survécu au remplacement du transport, et c'est la meilleure preuve disponible qu'elle n'a jamais dépendu du transport.
|
||||||
|
|
||||||
|
Un couplage faible ne signifie pas que rien ne sait rien. Ce qui reste, nécessairement, est l'accord sur : la syntaxe des messages, leur sémantique, les contrats de sujets, l'Intent, la propriété, le sens du State et celui des Events. Le but n'est pas d'éliminer le couplage mais d'**éliminer la connaissance inutile**. Concrètement, chaque service ici doit comprendre exactement un contrat d'Event étranger — ROT13 comprend `E/text` de ConsoleIn, ConsoleOut comprend `E/crypted` de ROT13 — plus le schéma d'Intent qu'il accepte sur son propre `I`. Cette liste est le minimum irréductible.
|
||||||
|
|
||||||
|
Par ailleurs, le courtier est une dépendance d'infrastructure partagée : tout le monde a besoin de son adresse et rien ne marche sans lui. Réel, mais d'une autre nature que la connaissance d'un composant par un autre.
|
||||||
|
|
||||||
|
La liste de l'étape 78 est l'outil à garder. Douze questions, dont ces six portent l'argument de ce système :
|
||||||
|
|
||||||
|
| question | réponse ici |
|
||||||
|
|---|---|
|
||||||
|
| une capacité contient-elle l'identité d'un producteur en dur ? | non — elle arrive par Intent |
|
||||||
|
| quels contrats étrangers doit-elle comprendre ? | un contrat d'Event chacun, plus son propre schéma d'Intent |
|
||||||
|
| où la topologie est-elle définie ? | dans le configurateur, hors du chemin des données |
|
||||||
|
| la topologie peut-elle changer sans recompiler ? | oui — démontré sur un système en marche |
|
||||||
|
| le transport pourrait-il être remplacé ? | oui — démontré : système de fichiers puis MQTT |
|
||||||
|
| chaque médiateur fait-il quelque chose qui exige une médiation ? | oui, trivialement : `TEXT → TEXT` n'en exige aucune, et il n'y en a aucun |
|
||||||
|
|
||||||
|
La prudence du matériel s'applique : les réponses n'ont pas à être toutes « non ». Elles doivent être **intentionnelles**.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Die untere Hälfte der Tabelle Dateisystem→MQTT ist der Punkt: `I`, `S`, `E`, egoistische Dienste, Topologie zur Laufzeit und „Transformator wenn nötig" sind **unverändert**. Die Architektur überlebte den Transportwechsel, und das ist der stärkste verfügbare Beleg, dass sie nie am Transport hing.
|
||||||
|
|
||||||
|
Lose Kopplung heisst nicht, dass nichts etwas weiss. Notwendig bleibt die Einigkeit über: Nachrichtensyntax, Nachrichtensemantik, Topic-Verträge, Intent, Besitz, Bedeutung von State und Bedeutung von Events. Ziel ist nicht, Kopplung zu beseitigen, sondern **unnötiges Wissen** zu beseitigen. Konkret muss hier jeder Dienst genau einen fremden Event-Vertrag verstehen — ROT13 den `E/text` von ConsoleIn, ConsoleOut den `E/crypted` von ROT13 — plus das Intent-Schema, das er auf seinem eigenen `I` annimmt. Diese Liste ist das unverzichtbare Minimum.
|
||||||
|
|
||||||
|
Davon getrennt: der Broker ist eine geteilte Infrastrukturabhängigkeit; alle brauchen seine Adresse, und ohne ihn läuft nichts. Real, aber anderer Art als das Wissen einer Komponente über eine andere.
|
||||||
|
|
||||||
|
Die Prüfliste aus Schritt 78 ist das Werkzeug, das bleibt. Zwölf Fragen, von denen diese sechs das Argument dieses Systems tragen:
|
||||||
|
|
||||||
|
| Frage | Antwort hier |
|
||||||
|
|---|---|
|
||||||
|
| enthält eine Fähigkeit eine festgeschriebene Produzentenidentität? | nein — sie kommt als Intent |
|
||||||
|
| welche fremden Verträge muss sie verstehen? | je einen Event-Vertrag, plus ihr eigenes Intent-Schema |
|
||||||
|
| wo ist die Topologie definiert? | im Konfigurator, ausserhalb des Datenpfads |
|
||||||
|
| kann sich die Topologie ohne Neukompilieren ändern? | ja — am laufenden System gezeigt |
|
||||||
|
| könnte der Transport ersetzt werden? | ja — gezeigt: Dateisystem, dann MQTT |
|
||||||
|
| leistet jeder Vermittler etwas, das Vermittlung braucht? | ja, trivial: `TEXT → TEXT` braucht keine, und es gibt keinen |
|
||||||
|
|
||||||
|
Die Mahnung des Materials gilt: die Antworten müssen nicht alle „nein" lauten. Sie müssen **absichtlich** sein.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The whole journey]{.en}[Le parcours complet]{.fr}[Der ganze Weg]{.de} {#sec-whole-journey}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
The program never changed: a line goes in, the same line comes out rotated by 13 letters. What changed, eleven times, is how the parts are joined and who holds the knowledge of how they are joined.
|
||||||
|
|
||||||
|
| stage | how the parts are joined | where the topology lives | in the data path besides the capabilities |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 procedural | direct calls | inside the capability code | — |
|
||||||
|
| 2 egoistic services | not joined at all | nowhere — that is the problem | — |
|
||||||
|
| 3 static mediation, one JVM | mailboxes, copied by mediators | the mediators, started in `main()` | two mediators |
|
||||||
|
| 4 static mediation, filesystem | directories, copied by mediator processes | the operator's command lines | two mediator processes |
|
||||||
|
| 5 static mediation, Syncthing | replicated directories | the operator's command lines | two mediator processes, plus replication delay |
|
||||||
|
| 6 named, configurable mediators | `ROUTE` Intent from an orchestrator | the orchestrator, outside the path | the mediators, still |
|
||||||
|
| 7 dynamic, one JVM | services listen, told by `TOPIC` Intent | the configurator | nothing |
|
||||||
|
| 8 dynamic, filesystem | the same, over directories | the configurator | nothing |
|
||||||
|
| 9 dynamic, Syncthing | the same, over replicated directories | the configurator | nothing — transport hops only |
|
||||||
|
| 10 contracts | compatible: direct; incompatible: a transformer | the configurator | a transformer, only where contracts differ |
|
||||||
|
| 11 MQTT | topics on a broker | the configurator | nothing — the broker is transport |
|
||||||
|
|
||||||
|
Read the third column from top to bottom: the topology moves outward, one stage at a time, until no capability holds any of it. Read the last one: the price of that move falls to zero at stage 7 and stays there while the transport changes underneath three times. Same architecture, better transport.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
Le programme n'a jamais changé : une ligne entre, la même ressort décalée de 13 lettres. Ce qui a changé, onze fois, c'est la manière dont les parties sont reliées et qui détient la connaissance de ce câblage.
|
||||||
|
|
||||||
|
| étape | comment les parties sont reliées | où vit la topologie | dans le chemin des données, outre les capacités |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 procédural | appels directs | dans le code de la capacité | — |
|
||||||
|
| 2 services égoïstes | pas reliées du tout | nulle part — c'est le problème | — |
|
||||||
|
| 3 médiation statique, une JVM | boîtes, copiées par des médiateurs | les médiateurs, démarrés dans `main()` | deux médiateurs |
|
||||||
|
| 4 médiation statique, système de fichiers | répertoires, copiés par des processus médiateurs | les lignes de commande de l'opérateur | deux processus médiateurs |
|
||||||
|
| 5 médiation statique, Syncthing | répertoires répliqués | les lignes de commande de l'opérateur | deux processus médiateurs, plus le délai de réplication |
|
||||||
|
| 6 médiateurs nommés et configurables | Intent `ROUTE` d'un orchestrateur | l'orchestrateur, hors du chemin | les médiateurs, encore |
|
||||||
|
| 7 dynamique, une JVM | les services écoutent, guidés par un Intent `TOPIC` | le configurateur | rien |
|
||||||
|
| 8 dynamique, système de fichiers | idem, sur des répertoires | le configurateur | rien |
|
||||||
|
| 9 dynamique, Syncthing | idem, sur des répertoires répliqués | le configurateur | rien — seulement des sauts de transport |
|
||||||
|
| 10 contrats | compatibles : direct ; incompatibles : un transformateur | le configurateur | un transformateur, seulement là où les contrats diffèrent |
|
||||||
|
| 11 MQTT | des sujets sur un courtier | le configurateur | rien — le courtier est du transport |
|
||||||
|
|
||||||
|
Lisez la troisième colonne de haut en bas : la topologie s'éloigne, une étape après l'autre, jusqu'à ce qu'aucune capacité n'en détienne plus rien. Lisez la dernière : le prix de ce déplacement tombe à zéro à l'étape 7 et y reste pendant que le transport change trois fois en dessous. Même architecture, meilleur transport.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
Das Programm hat sich nie geändert: eine Zeile geht hinein, dieselbe kommt um 13 Buchstaben verschoben heraus. Geändert hat sich, elfmal, wie die Teile verbunden sind und wer das Wissen über diese Verbindung hält.
|
||||||
|
|
||||||
|
| Stufe | wie die Teile verbunden sind | wo die Topologie liegt | im Datenpfad ausser den Fähigkeiten |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 prozedural | direkte Aufrufe | im Code der Fähigkeit | — |
|
||||||
|
| 2 egoistische Dienste | gar nicht verbunden | nirgends — das ist das Problem | — |
|
||||||
|
| 3 statische Vermittlung, eine JVM | Postfächer, von Vermittlern kopiert | die Vermittler, gestartet in `main()` | zwei Vermittler |
|
||||||
|
| 4 statische Vermittlung, Dateisystem | Verzeichnisse, von Vermittlerprozessen kopiert | die Befehlszeilen des Bedieners | zwei Vermittlerprozesse |
|
||||||
|
| 5 statische Vermittlung, Syncthing | replizierte Verzeichnisse | die Befehlszeilen des Bedieners | zwei Vermittlerprozesse, dazu Replikationsverzögerung |
|
||||||
|
| 6 benannte, konfigurierbare Vermittler | `ROUTE`-Intent von einem Orchestrator | der Orchestrator, ausserhalb des Pfads | weiterhin die Vermittler |
|
||||||
|
| 7 dynamisch, eine JVM | die Dienste hören selbst, gesteuert durch `TOPIC`-Intent | der Konfigurator | nichts |
|
||||||
|
| 8 dynamisch, Dateisystem | dasselbe, über Verzeichnisse | der Konfigurator | nichts |
|
||||||
|
| 9 dynamisch, Syncthing | dasselbe, über replizierte Verzeichnisse | der Konfigurator | nichts — nur Transportsprünge |
|
||||||
|
| 10 Verträge | kompatibel: direkt; inkompatibel: ein Transformator | der Konfigurator | ein Transformator, nur wo Verträge sich unterscheiden |
|
||||||
|
| 11 MQTT | Topics auf einem Broker | der Konfigurator | nichts — der Broker ist Transport |
|
||||||
|
|
||||||
|
Die dritte Spalte von oben nach unten gelesen: die Topologie wandert nach aussen, Stufe um Stufe, bis keine Fähigkeit mehr etwas davon hält. Die letzte gelesen: der Preis dieser Wanderung fällt in Stufe 7 auf null und bleibt dort, während darunter dreimal der Transport wechselt. Dieselbe Architektur, besserer Transport.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## [The sentences to remember]{.en}[Les phrases à retenir]{.fr}[Die Sätze, die man behalten sollte]{.de} {#sec-sentences}
|
||||||
|
|
||||||
|
::: {.en}
|
||||||
|
- **Event-driven describes how information and control flow.**
|
||||||
|
- **Loose coupling describes how much participants need to know about one another.**
|
||||||
|
- **Publish what happened.**
|
||||||
|
- **Declare what you want.**
|
||||||
|
- **Publish your own State.**
|
||||||
|
- **Keep capabilities egoistic.**
|
||||||
|
- **Keep topology out of capabilities.**
|
||||||
|
- **Do not pay for a mediator unless it actually mediates something.**
|
||||||
|
|
||||||
|
And whenever an architecture becomes confusing, go back to the first question of this book: **who knows whom?**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.fr}
|
||||||
|
- **« Event-driven » décrit comment circulent l'information et le contrôle.**
|
||||||
|
- **Le couplage faible décrit ce que les participants doivent savoir les uns des autres.**
|
||||||
|
- **Publiez ce qui est arrivé.**
|
||||||
|
- **Déclarez ce que vous voulez.**
|
||||||
|
- **Publiez votre propre état.**
|
||||||
|
- **Gardez les capacités égoïstes.**
|
||||||
|
- **Gardez la topologie hors des capacités.**
|
||||||
|
- **Ne payez pas un médiateur qui ne fait pas réellement de médiation.**
|
||||||
|
|
||||||
|
Et chaque fois qu'une architecture devient confuse, revenez à la première question de ce livre : **qui connaît qui ?**
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: {.de}
|
||||||
|
- **„Event-driven" beschreibt, wie Information und Steuerung fliessen.**
|
||||||
|
- **Lose Kopplung beschreibt, wie viel die Beteiligten voneinander wissen müssen.**
|
||||||
|
- **Veröffentliche, was geschehen ist.**
|
||||||
|
- **Erkläre, was du willst.**
|
||||||
|
- **Veröffentliche deinen eigenen Zustand.**
|
||||||
|
- **Halte Fähigkeiten egoistisch.**
|
||||||
|
- **Halte die Topologie aus den Fähigkeiten heraus.**
|
||||||
|
- **Bezahle keinen Vermittler, der nicht wirklich vermittelt.**
|
||||||
|
|
||||||
|
Und wann immer eine Architektur verwirrend wird, zurück zur ersten Frage dieses Buches: **wer kennt wen?**
|
||||||
|
:::
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
TEXT
|
||||||
|
Hello World
|
||||||
|
TIMESTAMP: 2026-09-22T12:13:47.972234583Z
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
TEXT
|
||||||
|
Uryyb Jbeyq
|
||||||
|
TIMESTAMP: 2026-09-22T12:13:48.038090564Z
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
TEXT
|
||||||
|
Hello World
|
||||||
|
TIMESTAMP: 2026-09-22T12:13:47.972234583Z
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
TEXT
|
||||||
|
Uryyb Jbeyq
|
||||||
|
TIMESTAMP: 2026-09-22T12:13:48.038090564Z
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+3
@@ -0,0 +1,3 @@
|
|||||||
|
artifactId=calling-to-eventing
|
||||||
|
groupId=at.ac.fhstp.sin
|
||||||
|
version=1.0-SNAPSHOT
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
MqttTools.class
|
||||||
|
MqttRot13$Rot13Subscription.class
|
||||||
|
MqttRot13$Rot13Intent.class
|
||||||
|
MqttRot13.class
|
||||||
|
MqttConsoleOut$ConsoleOutSubscription.class
|
||||||
|
MqttConsoleOut.class
|
||||||
|
MqttConfigure.class
|
||||||
|
MqttConsoleIn$ConsoleInMessage.class
|
||||||
|
JsonTools.class
|
||||||
|
MqttConsoleIn.class
|
||||||
|
MqttConsoleOut$ConsoleOutIntent.class
|
||||||
|
MqttConsoleOut$ConsoleOutMessage.class
|
||||||
|
MqttConsoleOut$1.class
|
||||||
|
MqttRot13$1.class
|
||||||
|
MqttRot13$Rot13Message.class
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/JsonTools.java
|
||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/MqttConfigure.java
|
||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/MqttConsoleIn.java
|
||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/MqttConsoleOut.java
|
||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/MqttRot13.java
|
||||||
|
/mnt/data/Documents/GitRepo/Notes/ProcessControl/SIN.04028-From-Calling-to-Eventing/supplemental-java/06-mqtt/src/main/java/MqttTools.java
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -0,0 +1,134 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 230" width="760" height="230"
|
||||||
|
role="img" aria-labelledby="dc-title">
|
||||||
|
<title id="dc-title">Die prozedurale Fassung: in einem einzigen main() wird IO.readln() aufgerufen, dessen Ergebnis an rot13() übergeben und dieses Ergebnis an IO.println(). Ein Thread, ein Prozess, drei direkte Aufrufe.</title>
|
||||||
|
<style><![CDATA[
|
||||||
|
/* figures/diagram.css -- shared look of every built figure.
|
||||||
|
*
|
||||||
|
* build-figures.py drops this file into the style element of every built
|
||||||
|
* svg, so a figure carries its own styling and stays self-contained.
|
||||||
|
* Classes, not per-element fills, do the work: one edit here restyles the
|
||||||
|
* whole book.
|
||||||
|
*
|
||||||
|
* Colours are the extension's tokens (_extensions/notes/theme.css) with a
|
||||||
|
* literal fallback, which covers all three ways a figure is seen:
|
||||||
|
*
|
||||||
|
* - inlined into the page by figures/flow-player.html: the tokens resolve
|
||||||
|
* against the page, so the figure follows light, night and high contrast;
|
||||||
|
* - as a plain <img> (JavaScript off): the fallback applies, and night mode
|
||||||
|
* comes from the extension's invert filter on main img[src$=".svg"];
|
||||||
|
* - in the pdf: librsvg ignores var() and uses the fallback, so print gets
|
||||||
|
* the light palette -- which is what a printed page wants.
|
||||||
|
*
|
||||||
|
* The fallbacks are this book's own light values; the tokens carry the night
|
||||||
|
* and high-contrast ones. Nothing here keys off prefers-color-scheme: the
|
||||||
|
* page's toggle decides, never the reader's system setting.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg {
|
||||||
|
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||||
|
/* the figure sits on the page, not on a white card of its own */
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- surfaces ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; }
|
||||||
|
.box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; }
|
||||||
|
.diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; }
|
||||||
|
|
||||||
|
/* ---- lines ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
.edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; }
|
||||||
|
.edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; }
|
||||||
|
.edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; }
|
||||||
|
.rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; }
|
||||||
|
|
||||||
|
/* ---- text ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
.t { fill: var(--calc-ink, #1b2430); font-size: 13px; }
|
||||||
|
.t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; }
|
||||||
|
.t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; }
|
||||||
|
.t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; }
|
||||||
|
.t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; }
|
||||||
|
.t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px;
|
||||||
|
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
||||||
|
|
||||||
|
.mid { text-anchor: middle; }
|
||||||
|
.end { text-anchor: end; }
|
||||||
|
|
||||||
|
/* ---- interaction ====================================================
|
||||||
|
* A .node groups one box with its labels. Hovering it lifts the whole group
|
||||||
|
* a little, which is enough to follow a path through a busy diagram without
|
||||||
|
* any script. Pointer events stay off the decorative layers so the hover
|
||||||
|
* target is the shape itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.node { transition: opacity .12s ease; }
|
||||||
|
.node:hover .box,
|
||||||
|
.node:hover .box-accent,
|
||||||
|
.node:hover .diamond { stroke-width: 2.6; }
|
||||||
|
.node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
|
||||||
|
svg:hover .node:not(:hover) { opacity: .55; }
|
||||||
|
|
||||||
|
/* a figure that marks no nodes must not dim on hover */
|
||||||
|
svg:not(:has(.node)) .node { opacity: 1; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.node { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- arrowheads ======================================================
|
||||||
|
* marker contents cannot inherit the referencing element's fill, so each
|
||||||
|
* arrowhead is its own class and is themed alongside the line it ends.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.arrow { fill: var(--calc-muted, #5a6879); }
|
||||||
|
.arrow-strong { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
.arrow-warn { fill: var(--calc-accent-b, #D1541F); }
|
||||||
|
|
||||||
|
]]></style>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
||||||
|
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
||||||
|
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- everything happens inside one main(), on one thread -->
|
||||||
|
<rect class="box-plain" x="14" y="16" width="732" height="126" rx="4"/>
|
||||||
|
<text class="t-mut" data-label="frame" x="26" y="36">ein Prozess · ein Thread · ein main()</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="read">
|
||||||
|
<rect class="box" x="40" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="read" x="125" y="90">IO.readln()</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<path class="edge" data-flow="1" data-flow-to="rot" d="M210,84 H298" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent mid" data-label="call1" x="254" y="72">Aufruf</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="rot">
|
||||||
|
<rect class="box" x="300" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="rot" x="385" y="90">rot13(text)</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<path class="edge" data-flow="2" data-flow-to="print" d="M470,84 H558" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent mid" data-label="call2" x="514" y="72">Aufruf</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="print">
|
||||||
|
<rect class="box" x="560" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="print" x="645" y="90">IO.println(…)</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- who knows whom -->
|
||||||
|
<text class="t-sm" data-label="knows" x="14" y="176">main() kennt alle drei: ihre Namen, Argument- und Ergebnistypen und dass sie sofort verfügbar sind.</text>
|
||||||
|
<text class="t-mut" data-label="cost" x="14" y="202">Die Verdrahtung steht im Code selbst — Schritt 1.</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,199 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 620 750" width="620" height="750"
|
||||||
|
role="img" aria-labelledby="fp-title">
|
||||||
|
<title id="fp-title">Dieselbe Kette als fünf getrennte Prozesse auf einem Rechner: SensorService veröffentlicht eine .msg-Datei in consoleIn/outbox, ein Mediator-Prozess beobachtet dieses Verzeichnis und veröffentlicht eine Kopie in rot13/inbox, ProcessorService veröffentlicht sein Ergebnis in rot13/outbox, ein zweiter Mediator-Prozess verschiebt es nach consoleOut/inbox, und ActuatorService gibt es aus. Die vier Verzeichnisse bilden das Nachrichtenbrett auf einem lokalen Dateisystem.</title>
|
||||||
|
<style><![CDATA[
|
||||||
|
/* figures/diagram.css -- shared look of every built figure.
|
||||||
|
*
|
||||||
|
* build-figures.py drops this file into the style element of every built
|
||||||
|
* svg, so a figure carries its own styling and stays self-contained.
|
||||||
|
* Classes, not per-element fills, do the work: one edit here restyles the
|
||||||
|
* whole book.
|
||||||
|
*
|
||||||
|
* Colours are the extension's tokens (_extensions/notes/theme.css) with a
|
||||||
|
* literal fallback, which covers all three ways a figure is seen:
|
||||||
|
*
|
||||||
|
* - inlined into the page by figures/flow-player.html: the tokens resolve
|
||||||
|
* against the page, so the figure follows light, night and high contrast;
|
||||||
|
* - as a plain <img> (JavaScript off): the fallback applies, and night mode
|
||||||
|
* comes from the extension's invert filter on main img[src$=".svg"];
|
||||||
|
* - in the pdf: librsvg ignores var() and uses the fallback, so print gets
|
||||||
|
* the light palette -- which is what a printed page wants.
|
||||||
|
*
|
||||||
|
* The fallbacks are this book's own light values; the tokens carry the night
|
||||||
|
* and high-contrast ones. Nothing here keys off prefers-color-scheme: the
|
||||||
|
* page's toggle decides, never the reader's system setting.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg {
|
||||||
|
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||||
|
/* the figure sits on the page, not on a white card of its own */
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- surfaces ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; }
|
||||||
|
.box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; }
|
||||||
|
.diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; }
|
||||||
|
|
||||||
|
/* ---- lines ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
.edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; }
|
||||||
|
.edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; }
|
||||||
|
.edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; }
|
||||||
|
.rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; }
|
||||||
|
|
||||||
|
/* ---- text ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
.t { fill: var(--calc-ink, #1b2430); font-size: 13px; }
|
||||||
|
.t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; }
|
||||||
|
.t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; }
|
||||||
|
.t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; }
|
||||||
|
.t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; }
|
||||||
|
.t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px;
|
||||||
|
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
||||||
|
|
||||||
|
.mid { text-anchor: middle; }
|
||||||
|
.end { text-anchor: end; }
|
||||||
|
|
||||||
|
/* ---- interaction ====================================================
|
||||||
|
* A .node groups one box with its labels. Hovering it lifts the whole group
|
||||||
|
* a little, which is enough to follow a path through a busy diagram without
|
||||||
|
* any script. Pointer events stay off the decorative layers so the hover
|
||||||
|
* target is the shape itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.node { transition: opacity .12s ease; }
|
||||||
|
.node:hover .box,
|
||||||
|
.node:hover .box-accent,
|
||||||
|
.node:hover .diamond { stroke-width: 2.6; }
|
||||||
|
.node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
|
||||||
|
svg:hover .node:not(:hover) { opacity: .55; }
|
||||||
|
|
||||||
|
/* a figure that marks no nodes must not dim on hover */
|
||||||
|
svg:not(:has(.node)) .node { opacity: 1; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.node { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- arrowheads ======================================================
|
||||||
|
* marker contents cannot inherit the referencing element's fill, so each
|
||||||
|
* arrowhead is its own class and is themed alongside the line it ends.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.arrow { fill: var(--calc-muted, #5a6879); }
|
||||||
|
.arrow-strong { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
.arrow-warn { fill: var(--calc-accent-b, #D1541F); }
|
||||||
|
|
||||||
|
]]>
|
||||||
|
[data-label="mediator1"] { font-size: 11px; }
|
||||||
|
[data-label="mediator2"] { font-size: 11px; }</style>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
||||||
|
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
||||||
|
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- 1. SensorService (terminal 1) ==================================== -->
|
||||||
|
<g class="node" data-flow-node="sensor">
|
||||||
|
<rect class="box" x="120" y="24" width="300" height="46" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="sensor" x="270" y="46">SensorService — ConsoleIn</text>
|
||||||
|
<text class="t-mut mid" data-label="t1" x="270" y="62">Terminal 1</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="1" data-flow-to="outbox1" d="M270,70 V96" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="publish1" x="286" y="88">veröffentlichen (.tmp → .msg)</text>
|
||||||
|
|
||||||
|
<!-- 2. consoleIn/outbox ============================================= -->
|
||||||
|
<g class="node" data-flow-node="outbox1">
|
||||||
|
<rect class="box-plain" x="120" y="98" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="126">consoleIn/outbox/*.msg</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="2" data-flow-to="mediator1" d="M270,142 V168" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="watch1" x="286" y="160">WatchService</text>
|
||||||
|
|
||||||
|
<!-- 3. first mediator process (terminal 2) =========================== -->
|
||||||
|
<g class="node" data-flow-node="mediator1">
|
||||||
|
<rect class="box-accent" x="120" y="170" width="300" height="46" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="mediator1" x="270" y="192">Mediator.java consoleIn/outbox rot13/inbox</text>
|
||||||
|
<text class="t-mut mid" data-label="t2" x="270" y="208">Terminal 2</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="3" data-flow-to="inbox2" d="M270,216 V242" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="publish2" x="286" y="234">veröffentlichen</text>
|
||||||
|
|
||||||
|
<!-- 4. rot13/inbox =================================================== -->
|
||||||
|
<g class="node" data-flow-node="inbox2">
|
||||||
|
<rect class="box-plain" x="120" y="244" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="272">rot13/inbox/*.msg</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="4" data-flow-to="processor" d="M270,288 V314" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="watch2" x="286" y="306">WatchService</text>
|
||||||
|
|
||||||
|
<!-- 5. ProcessorService (terminal 3) ================================= -->
|
||||||
|
<g class="node" data-flow-node="processor">
|
||||||
|
<rect class="box" x="120" y="316" width="300" height="46" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="processor" x="270" y="338">ProcessorService — ROT13</text>
|
||||||
|
<text class="t-mut mid" data-label="t3" x="270" y="354">Terminal 3</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="5" data-flow-to="outbox2" d="M270,362 V388" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="publish3" x="286" y="380">veröffentlichen</text>
|
||||||
|
|
||||||
|
<!-- 6. rot13/outbox ================================================== -->
|
||||||
|
<g class="node" data-flow-node="outbox2">
|
||||||
|
<rect class="box-plain" x="120" y="390" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="418">rot13/outbox/*.msg</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="6" data-flow-to="mediator2" d="M270,434 V460" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="watch3" x="286" y="452">WatchService</text>
|
||||||
|
|
||||||
|
<!-- 7. second mediator process (terminal 4) ========================== -->
|
||||||
|
<g class="node" data-flow-node="mediator2">
|
||||||
|
<rect class="box-accent" x="120" y="462" width="300" height="46" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="mediator2" x="270" y="484">Mediator.java rot13/outbox consoleOut/inbox</text>
|
||||||
|
<text class="t-mut mid" data-label="t4" x="270" y="500">Terminal 4</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="7" data-flow-to="inbox3" d="M270,508 V534" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="publish4" x="286" y="526">veröffentlichen</text>
|
||||||
|
|
||||||
|
<!-- 8. consoleOut/inbox ============================================== -->
|
||||||
|
<g class="node" data-flow-node="inbox3">
|
||||||
|
<rect class="box-plain" x="120" y="536" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="564">consoleOut/inbox/*.msg</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="8" data-flow-to="actuator" d="M270,580 V606" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="watch4" x="286" y="598">WatchService</text>
|
||||||
|
|
||||||
|
<!-- 9. ActuatorService (terminal 5) ================================== -->
|
||||||
|
<g class="node" data-flow-node="actuator">
|
||||||
|
<rect class="box" x="120" y="608" width="300" height="46" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="actuator" x="270" y="630">ActuatorService — ConsoleOut</text>
|
||||||
|
<text class="t-mut mid" data-label="t5" x="270" y="646">Terminal 5</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- the four directories belong to one message board on one filesystem -->
|
||||||
|
<path class="edge-dash" d="M436,98 H452 V580 H436"/>
|
||||||
|
<text class="t-mono" x="460" y="330">messageBoard/</text>
|
||||||
|
<!-- two lines: one line of this label ran past the 620-wide viewBox in
|
||||||
|
German and French, where an svg root clips rather than overflows =
|
||||||
|
a truncated label at phone width. -->
|
||||||
|
<text class="t-mut" data-label="board" x="460" y="348">Verzeichnis = Postfach</text>
|
||||||
|
<text class="t-mut" data-label="board2" x="460" y="363">Datei = Nachricht</text>
|
||||||
|
|
||||||
|
<!-- the five processes are started by hand, one terminal each -->
|
||||||
|
<path class="edge-dash" d="M104,24 H88 V654 H104"/>
|
||||||
|
<!-- three lines: one ran well past the viewBox in every language, and an
|
||||||
|
svg root clips rather than overflows. -->
|
||||||
|
<text class="t-warn" data-label="topology" x="14" y="700">Fünf von Hand gestartete Prozesse.</text>
|
||||||
|
<text class="t-warn" data-label="topology2" x="14" y="716">Die Topologie steckt nun in den zwei Mediator-Befehlszeilen —</text>
|
||||||
|
<text class="t-warn" data-label="topology3" x="14" y="732">bei dem, der sie getippt hat.</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,187 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 560 730" width="560" height="730"
|
||||||
|
role="img" aria-labelledby="mj-title">
|
||||||
|
<title id="mj-title">Die vermittelte Fassung in einer JVM: ConsoleIn legt eine Nachricht in consoleIn.outbox, ein Vermittler nimmt sie und legt sie in rot13.inbox, ROT13 nimmt sie und legt sein Ergebnis in rot13.outbox, ein zweiter Vermittler verschiebt es nach consoleOut.inbox, und ConsoleOut nimmt es und gibt es aus.</title>
|
||||||
|
<style><![CDATA[
|
||||||
|
/* figures/diagram.css -- shared look of every built figure.
|
||||||
|
*
|
||||||
|
* build-figures.py drops this file into the style element of every built
|
||||||
|
* svg, so a figure carries its own styling and stays self-contained.
|
||||||
|
* Classes, not per-element fills, do the work: one edit here restyles the
|
||||||
|
* whole book.
|
||||||
|
*
|
||||||
|
* Colours are the extension's tokens (_extensions/notes/theme.css) with a
|
||||||
|
* literal fallback, which covers all three ways a figure is seen:
|
||||||
|
*
|
||||||
|
* - inlined into the page by figures/flow-player.html: the tokens resolve
|
||||||
|
* against the page, so the figure follows light, night and high contrast;
|
||||||
|
* - as a plain <img> (JavaScript off): the fallback applies, and night mode
|
||||||
|
* comes from the extension's invert filter on main img[src$=".svg"];
|
||||||
|
* - in the pdf: librsvg ignores var() and uses the fallback, so print gets
|
||||||
|
* the light palette -- which is what a printed page wants.
|
||||||
|
*
|
||||||
|
* The fallbacks are this book's own light values; the tokens carry the night
|
||||||
|
* and high-contrast ones. Nothing here keys off prefers-color-scheme: the
|
||||||
|
* page's toggle decides, never the reader's system setting.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg {
|
||||||
|
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||||
|
/* the figure sits on the page, not on a white card of its own */
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- surfaces ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; }
|
||||||
|
.box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; }
|
||||||
|
.diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; }
|
||||||
|
|
||||||
|
/* ---- lines ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
.edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; }
|
||||||
|
.edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; }
|
||||||
|
.edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; }
|
||||||
|
.rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; }
|
||||||
|
|
||||||
|
/* ---- text ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
.t { fill: var(--calc-ink, #1b2430); font-size: 13px; }
|
||||||
|
.t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; }
|
||||||
|
.t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; }
|
||||||
|
.t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; }
|
||||||
|
.t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; }
|
||||||
|
.t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px;
|
||||||
|
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
||||||
|
|
||||||
|
.mid { text-anchor: middle; }
|
||||||
|
.end { text-anchor: end; }
|
||||||
|
|
||||||
|
/* ---- interaction ====================================================
|
||||||
|
* A .node groups one box with its labels. Hovering it lifts the whole group
|
||||||
|
* a little, which is enough to follow a path through a busy diagram without
|
||||||
|
* any script. Pointer events stay off the decorative layers so the hover
|
||||||
|
* target is the shape itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.node { transition: opacity .12s ease; }
|
||||||
|
.node:hover .box,
|
||||||
|
.node:hover .box-accent,
|
||||||
|
.node:hover .diamond { stroke-width: 2.6; }
|
||||||
|
.node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
|
||||||
|
svg:hover .node:not(:hover) { opacity: .55; }
|
||||||
|
|
||||||
|
/* a figure that marks no nodes must not dim on hover */
|
||||||
|
svg:not(:has(.node)) .node { opacity: 1; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.node { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- arrowheads ======================================================
|
||||||
|
* marker contents cannot inherit the referencing element's fill, so each
|
||||||
|
* arrowhead is its own class and is themed alongside the line it ends.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.arrow { fill: var(--calc-muted, #5a6879); }
|
||||||
|
.arrow-strong { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
.arrow-warn { fill: var(--calc-accent-b, #D1541F); }
|
||||||
|
|
||||||
|
]]></style>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
||||||
|
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
||||||
|
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- one JVM, five virtual threads: the frame the whole chain lives in -->
|
||||||
|
<rect class="box-plain" x="10" y="10" width="540" height="676" rx="4"/>
|
||||||
|
<text class="t-mut" data-label="frame" x="22" y="30">eine JVM · fünf virtuelle Threads · BlockingQueue-Postfächer</text>
|
||||||
|
|
||||||
|
<!-- 1. ConsoleIn ==================================================== -->
|
||||||
|
<g class="node" data-flow-node="consolein">
|
||||||
|
<rect class="box" x="120" y="44" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="consolein" x="270" y="72">ConsoleIn — „ich lese“</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="1" data-flow-to="outbox1" d="M270,88 V114" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="put1" x="286" y="106">put</text>
|
||||||
|
|
||||||
|
<!-- 2. consoleIn.outbox ============================================= -->
|
||||||
|
<g class="node" data-flow-node="outbox1">
|
||||||
|
<rect class="box-plain" x="120" y="116" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="144">consoleIn.outbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="2" data-flow-to="mediator1" d="M270,160 V186" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="take1" x="286" y="178">take</text>
|
||||||
|
|
||||||
|
<!-- 3. first mediator =============================================== -->
|
||||||
|
<g class="node" data-flow-node="mediator1">
|
||||||
|
<rect class="box-accent" x="120" y="188" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="mediator1" x="270" y="211">Vermittler</text>
|
||||||
|
<text class="t-mut mid" data-label="route1" x="270" y="226">consoleIn.outbox → rot13.inbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="3" data-flow-to="inbox2" d="M270,232 V258" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="put2" x="286" y="250">put</text>
|
||||||
|
|
||||||
|
<!-- 4. rot13.inbox =================================================== -->
|
||||||
|
<g class="node" data-flow-node="inbox2">
|
||||||
|
<rect class="box-plain" x="120" y="260" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="288">rot13.inbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="4" data-flow-to="rot13" d="M270,304 V330" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="take2" x="286" y="322">take</text>
|
||||||
|
|
||||||
|
<!-- 5. ROT13 ========================================================= -->
|
||||||
|
<g class="node" data-flow-node="rot13">
|
||||||
|
<rect class="box" x="120" y="332" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="rot13" x="270" y="360">ROT13 — „ich rotiere“</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="5" data-flow-to="outbox2" d="M270,376 V402" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="put3" x="286" y="394">put</text>
|
||||||
|
|
||||||
|
<!-- 6. rot13.outbox ================================================== -->
|
||||||
|
<g class="node" data-flow-node="outbox2">
|
||||||
|
<rect class="box-plain" x="120" y="404" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="432">rot13.outbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="6" data-flow-to="mediator2" d="M270,448 V474" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="take3" x="286" y="466">take</text>
|
||||||
|
|
||||||
|
<!-- 7. second mediator =============================================== -->
|
||||||
|
<g class="node" data-flow-node="mediator2">
|
||||||
|
<rect class="box-accent" x="120" y="476" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="mediator2" x="270" y="499">Vermittler</text>
|
||||||
|
<text class="t-mut mid" data-label="route2" x="270" y="514">rot13.outbox → consoleOut.inbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="7" data-flow-to="inbox3" d="M270,520 V546" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="put4" x="286" y="538">put</text>
|
||||||
|
|
||||||
|
<!-- 8. consoleOut.inbox ============================================== -->
|
||||||
|
<g class="node" data-flow-node="inbox3">
|
||||||
|
<rect class="box-plain" x="120" y="548" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-mono mid" x="270" y="576">consoleOut.inbox</text>
|
||||||
|
</g>
|
||||||
|
<path class="edge" data-flow="8" data-flow-to="consoleout" d="M270,592 V618" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent" data-label="take4" x="286" y="610">take</text>
|
||||||
|
|
||||||
|
<!-- 9. ConsoleOut ==================================================== -->
|
||||||
|
<g class="node" data-flow-node="consoleout">
|
||||||
|
<rect class="box" x="120" y="620" width="300" height="44" rx="3"/>
|
||||||
|
<text class="t-lead mid" data-label="consoleout" x="270" y="648">ConsoleOut — „ich gebe aus“</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- side note: who holds the topology. Two lines, and below the frame:
|
||||||
|
one line ran past the viewBox in German and French, and an svg root
|
||||||
|
clips instead of overflowing, which truncated the label. -->
|
||||||
|
<text class="t-warn" data-label="topology" x="14" y="702">Keine Fähigkeit nennt eine andere.</text>
|
||||||
|
<text class="t-warn" data-label="topology2" x="14" y="718">Die Topologie steckt nur in den zwei Vermittlern, gestartet in main().</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 10 KiB |
File diff suppressed because it is too large.
Load diff
+1307
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,573 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"objectID": "index.html",
|
||||||
|
"href": "index.html",
|
||||||
|
"title": "Prozesssteuerung",
|
||||||
|
"section": "",
|
||||||
|
"text": "Über diese Notizen\nDiese Notizen verfolgen ein kleines Programm durch eine lange Reihe von Neubauten, vom direkten Methodenaufruf bis zu einer ereignisgetriebenen Architektur über MQTT. Jeder Neubau lässt das Programm genau das tun, was es vorher tat, und ändert, wer von wem weiss.\nDas gebaute Programm ändert sich nie: Sie tippen eine Zeile, sie kommt um 13 Buchstaben verschoben zurück.\nWas sich ändert, ist alles ringsherum. Dasselbe System wird immer wieder neu gebaut, und jeder Neubau stellt drei Fragen, in dieser Reihenfolge:\nJedes Mal, wenn ein Schritt fertig ist, kommt hier eine Zusammenfassung hinzu; das Buch wächst also im Tempo der Arbeit. Jede Zusammenfassung sagt, was der Schritt getan hat, was beim Ausführen beobachtet wurde und was sich architektonisch verschoben hat — meist ein Stück Wissen, das den Besitzer gewechselt hat.\nNach Material von Reto Konig, Universität Freiburg.",
|
||||||
|
"crumbs": [
|
||||||
|
"[About these notes]{.en}[À propos de ces notes]{.fr}[Über diese Notizen]{.de}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "index.html#sec-diagrams",
|
||||||
|
"href": "index.html#sec-diagrams",
|
||||||
|
"title": "Prozesssteuerung",
|
||||||
|
"section": "Wie die Abbildungen zu lesen sind",
|
||||||
|
"text": "Wie die Abbildungen zu lesen sind\nJede Abbildung existiert einmal als Zeichnung und dreimal als Sprache. In der Webfassung hat eine Abbildung mit Nachrichtenfluss eine kleine Leiste darunter: Abspielen schickt eine Nachricht durch die ganze Kette, Ein Sprung rückt einen einzigen Schritt vor, Zurücksetzen stellt alles zurück. Kästen leuchten auf, wenn die Nachricht sie erreicht; so ist zu sehen, welche Komponente wartet und welche arbeitet.\nIm PDF und in einem Browser ohne JavaScript ist dasselbe Bild da — nur unbewegt. Nichts in diesen Notizen hängt von der Animation ab.",
|
||||||
|
"crumbs": [
|
||||||
|
"[About these notes]{.en}[À propos de ces notes]{.fr}[Über diese Notizen]{.de}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "00-orientation.html",
|
||||||
|
"href": "00-orientation.html",
|
||||||
|
"title": "1 Schritt 0 — Worum es geht",
|
||||||
|
"section": "",
|
||||||
|
"text": "1.1 Die drei Fragen\nSchritt 0 enthält keinen Code. Er nennt das Thema: nicht ROT13, sondern die Architektur darum herum. Die Funktionalität bleibt über 81 Schritte fast unverändert — genau das macht die Veränderungen ringsherum sichtbar.\nZwei Regeln werden hier gesetzt und gelten bis zum Schluss:\nDeshalb beginnt der Aufbau nicht mit MQTT und auch nicht mit dynamischen Abonnements. Zuerst entsteht ein System mit absichtlich unbequemen Vermittlern, wird in Betrieb genommen, und erst dann wird gefragt, ob sie ihren Platz verdient haben.\nDie zweite Regel betrifft das Vokabular: Intent, Status/State und Event werden erst benannt, nachdem sie benutzt wurden. Sie erscheinen etwa ab Schritt 42, nicht früher.\nDie geplante Route, von Schritt 0 an:\nDer Wortlaut der drei Fragen ist wichtig, und man ersetzt ihn leicht durch eine schwächere Fassung:\n„Kennen“ ist nicht „kommunizieren“: zwei Komponenten können den ganzen Tag Nachrichten austauschen, ohne dass eine die andere nennt. „Über die Verdrahtung entscheiden“ ist nicht „verbinden“: der Teil, der Nachrichten weiterleitet, muss nicht der Teil sein, der die Route gewählt hat. Beide Unterscheidungen werden später konkret — die erste schon in Schritt 1, die zweite in Teil III.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>1</span> <span class='chapter-title'>[Step 0 — What this is about]{.en}[Étape 0 — De quoi il s'agit]{.fr}[Schritt 0 — Worum es geht]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "00-orientation.html#sec-three-questions",
|
||||||
|
"href": "00-orientation.html#sec-three-questions",
|
||||||
|
"title": "1 Schritt 0 — Worum es geht",
|
||||||
|
"section": "",
|
||||||
|
"text": "So gefragt\nEine schwächere Fassung\n\n\n\n\nWer kennt wen?\nwer mit wem kommuniziert\n\n\nWer besitzt was?\nwelche Daten jeder Teil hält\n\n\nWer entscheidet über die Verdrahtung?\nwelcher Teil alles verbindet",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>1</span> <span class='chapter-title'>[Step 0 — What this is about]{.en}[Étape 0 — De quoi il s'agit]{.fr}[Schritt 0 — Worum es geht]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html",
|
||||||
|
"href": "01-part-i-calls.html",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "",
|
||||||
|
"text": "2.1 Schritt 1 — Ganz unten: einfach aufrufen\nDie Schritte 1 bis 10 bleiben in einer JVM. Das System wird dreimal gebaut: als direkte Aufrufe, als drei Fähigkeiten, die einander nicht kennen wollen, und als dieselben Fähigkeiten, von Vermittlern zusammengeklebt. Nichts ist bisher verteilt, und genau das ist der Punkt: das Einzige, was sich ändert, ist wer wen kennt.\nProceduralRot13.java ist das ganze System in einer kompakten Quelldatei: eine Schleife, die eine Zeile liest, und eine Anweisung, die den rotierten Text ausgibt.\nIO.readln() steht in einer eigenen Zeile, rot13(text) aber ist kein eigener Schritt: es wird innerhalb des Arguments von IO.println aufgerufen. Weder rot13 noch IO.println weiss etwas vom anderen. Wer beide kennt, ist main(): es nennt sie und legt ihre Reihenfolge fest.\nWas main() über rot13 weiss: dass es existiert, wie man es aufruft (ein blosser Name, beide liegen in derselben implizit erzeugten Klasse), welches Argument es nimmt, was es zurückgibt, dass es jetzt sofort verfügbar ist und dass die Ausführung nach der Rückkehr weiterläuft. Nicht bekannt ist, wie rot13 implementiert ist — das Einzige, was es ignorieren darf.\nDie Verfügbarkeitsgarantie lohnt eine eigene Erwähnung, denn sie verschwindet später: main() und rot13 sind zwei Methoden einer bereits geladenen Klasse, aufgerufen im selben Thread, im selben Prozess. Nichts muss zuerst starten, keine Nachricht reist irgendwohin, kein Empfänger muss abonniert sein.\nBeobachtet: eine getippte Zeile erscheint rotiert; Ctrl+D beendet das Programm still, weil IO.readln() null zurückgibt und main() zurückkehrt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-1",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-1",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "",
|
||||||
|
"text": "void main() {\n while (true) {\n var text = IO.readln();\n\n if (text == null)\n return;\n\n IO.println(rot13(text));\n }\n}\n\n\n\n\n\n\n\n\n\n\nAbbildung 2.1: Die prozedurale Fassung. Die Verdrahtung steht im Code: main() nennt alle drei Teile und legt ihre Reihenfolge fest.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-2",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-2",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.2 Schritt 2 — Drei egoistische Fähigkeiten",
|
||||||
|
"text": "2.2 Schritt 2 — Drei egoistische Fähigkeiten\nEine egoistische Komponente sagt: ich weiss, was ich kann, welche Daten ich annehme und welche ich erzeuge — und den Geschäftsprozess um mich herum möchte ich lieber nicht kennen. Konkret: ConsoleIn darf kein rot13(...) enthalten, und ROT13 kein consoleOut(...).\nDas Entfernen dieser Aufrufe schafft sofort ein Problem, das sich als Frage stellen lässt: wenn niemand niemanden kennt, wer macht daraus ein System? Zu beachten ist, was die Frage nicht sagt: das Wissen ist nicht verschwunden, es muss woandershin. Es fehlen zwei Verbindungen, nicht eine — ConsoleIn ↔︎ ROT13 und ROT13 ↔︎ ConsoleOut.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-3",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-3",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.3 Schritt 3 — Jeder Fähigkeit ein Postfach geben",
|
||||||
|
"text": "2.3 Schritt 3 — Jeder Fähigkeit ein Postfach geben\nDer kleinste Mechanismus für die fehlenden Verbindungen: eine Nachricht und eine benannte Warteschlange.\nrecord Message(String type, String value) {}\n\nMap<String, BlockingQueue<Message>> mailboxes = new ConcurrentHashMap<>();\n\nBlockingQueue<Message> mailbox(String name) {\n return mailboxes.computeIfAbsent(name, _ -> new LinkedBlockingQueue<>());\n}\nDas sind bewusst Postfächer (mailboxes) und keine Topics, und der Unterschied ist wichtig: rufen zwei Leser take() auf demselben Postfach auf, konkurrieren sie — jede Nachricht geht an genau einen von ihnen und wird nicht an beide kopiert. Ein Topic in Publish/Subscribe gäbe jedem Abonnenten seine eigene Kopie. Ein Leser pro Nachricht genügt vorläufig, und die Einschränkung bleibt absichtlich bestehen: sie macht später sichtbar, was Publish/Subscribe wirklich hinzufügt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-steps-4-6",
|
||||||
|
"href": "01-part-i-calls.html#sec-steps-4-6",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.4 Schritte 4–6 — Die drei Fähigkeiten werden egoistisch",
|
||||||
|
"text": "2.4 Schritte 4–6 — Die drei Fähigkeiten werden egoistisch\nJede Fähigkeit berührt nur noch ihre eigenen Postfachnamen:\n\n\n\nFähigkeit\nliest\nschreibt\n\n\n\n\nConsoleIn\ndie Tastatur\nconsoleIn.outbox\n\n\nROT13\nrot13.inbox\nrot13.outbox\n\n\nConsoleOut\nconsoleOut.inbox\ndie Konsole\n\n\n\nKeine Fähigkeit enthält den Namen einer anderen, und genau das ist das Ergebnis: drei schön isolierte Fähigkeiten, die zusammen absolut nichts tun. Nichts bewegt eine Nachricht von consoleIn.outbox nach rot13.inbox oder von rot13.outbox nach consoleOut.inbox.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-7",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-7",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.5 Schritt 7 — Auftritt des Vermittlers",
|
||||||
|
"text": "2.5 Schritt 7 — Auftritt des Vermittlers\nDer kleinstmögliche Klebstoff: eine Schleife, die aus einem Postfach nimmt und in ein anderes legt, ohne etwas über das Durchlaufende zu wissen.\nvoid mediate(String from, String to) {\n while (true)\n mailbox(to).put(mailbox(from).take());\n}\nmain() startet fünf virtuelle Threads: die drei Fähigkeiten plus zwei Vermittler, deren Routen als Argumente übergeben werden — consoleIn.outbox → rot13.inbox und rot13.outbox → consoleOut.inbox.\nBeobachtet: Hello World hinein, Uryyb Jbeyq heraus, genau wie in Schritt 1. Aber Ctrl+D beendet das Programm nicht mehr. Der Thread von ConsoleIn kehrt zurück (er schleift nicht), und die vier anderen Threads hängen blockiert in take() an leeren Postfächern, ohne CPU zu verbrauchen. Am Leben hält den Prozess tatsächlich die letzte Zeile von main(), Thread.currentThread().join(): der Haupt-Thread wartet auf sich selbst, was nie enden kann. Virtuelle Threads sind Daemon-Threads; die vier wartenden Threads allein hätten die JVM also nicht am Laufen gehalten.\n\n\n\n\n\n\nAbbildung 2.2: Die vermittelte Fassung in einer JVM. In der Webfassung schickt Abspielen eine Nachricht durch alle acht Sprünge.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-8",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-8",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.6 Schritt 8 — Nochmals fragen: wer kennt wen?",
|
||||||
|
"text": "2.6 Schritt 8 — Nochmals fragen: wer kennt wen?\nKennt ConsoleIn ROT13? Nein. Kennt ROT13 ConsoleIn oder ConsoleOut? Nein. Ist die Topologie verschwunden? Nein — sie steckt in den zwei mediate(...)-Aufrufen innerhalb von main().\nDas ist das erste grosse Ergebnis:\n\nEntkopplung lässt Wissen oft nicht verschwinden. Sie verschiebt Wissen dorthin, wo es hingehört.\n\nDie Fähigkeit „ROT13 transformiert Text” gehört zu ROT13. Die Topologie ConsoleIn → ROT13 → ConsoleOut gehört zur Systemkomposition. Geändert hat sich seit Schritt 1 nicht, dass die Verdrahtung main() verlassen hat — sie ist noch dort —, sondern dass sie nicht mehr innerhalb einer Fähigkeit steht. Sie ist jetzt Daten: zwei Paare von Postfachnamen. Umverdrahten berührt diese zwei Zeilen und keine einzige Fähigkeit.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-9",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-9",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.7 Schritt 9 — Warum virtuelle Threads?",
|
||||||
|
"text": "2.7 Schritt 9 — Warum virtuelle Threads?\nFünf Schleifen warten nun unbegrenzt: die Tastatur, rot13.inbox, consoleOut.inbox und die Quellen der zwei Vermittler. Virtuelle Threads sind einfach der billige Java-Weg, fünf Wartevorgänge gleichzeitig in einer JVM laufen zu lassen.\nSie sind eine Implementierungsbequemlichkeit, keine Architektur. Die Architektur — wer wen kennt und wo die Verdrahtung liegt — steckt in den Postfachnamen, nicht in den Threads. Der Beleg für die Trennung: dieselbe Architektur läuft in Schritt 11 als getrennte Prozesse, ohne geteilte Threads zwischen den Teilen.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-step-10",
|
||||||
|
"href": "01-part-i-calls.html#sec-step-10",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.8 Schritt 10 — Die Dienste egoistisch halten",
|
||||||
|
"text": "2.8 Schritt 10 — Die Dienste egoistisch halten\nDie naheliegende Abkürzung: der erste Vermittler kopiert Nachrichten nur unverändert — warum ihn also nicht löschen und ROT13 direkt take() auf consoleIn.outbox machen lassen?\nWeil ROT13 dann den Namen consoleIn.outbox enthielte, also wüsste, dass ConsoleIn existiert und wohin es veröffentlicht. Die Topologie wanderte in ROT13 hinein, und ROT13 wäre keine egoistische Fähigkeit mehr. Der Test, der das konkret macht: die Eingabe komme künftig von einer neuen Fähigkeit FileIn, die in fileIn.outbox veröffentlicht.\n\n\n\n\n\n\n\n\n\nmit Vermittler\nmit der Abkürzung\n\n\n\n\nwas sich ändert\nein Argument des Vermittlers\nrunRot13 selbst\n\n\nwer berührt wird\nkeine Fähigkeit\nROT13, dessen Aufgabe unverändert blieb\n\n\n\nDer Preis gehört klar gesagt: dieses Design mag indirekt wirken — sogar etwas eigenartig. Es gibt einen anderen Weg, Dienste egoistisch zu halten, ohne Vermittler im Pfad jeder Nachricht; er kommt später.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "01-part-i-calls.html#sec-part-i-result",
|
||||||
|
"href": "01-part-i-calls.html#sec-part-i-result",
|
||||||
|
"title": "2 Teil I — Mit dem beginnen, was man schon kennt",
|
||||||
|
"section": "2.9 Was Teil I verschoben hat",
|
||||||
|
"text": "2.9 Was Teil I verschoben hat\n\n\n\n\n\n\n\n\nStufe\nwo die Topologie liegt\nwer umverdrahten kann\n\n\n\n\nSchritt 1\nim Code der Fähigkeit (IO.println(rot13(text)))\nwer diesen Code ändert\n\n\nSchritte 7–8\nin main(), als Paare von Postfachnamen\nwer main() ändert\n\n\n\nFunktionalität: unverändert. Codezeilen: mehr. Teile, die einander kennen: keine. Das ist der Tauschhandel, den alles Folgende immer wieder prüft.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>2</span> <span class='chapter-title'>[Part I — Start with what you already know]{.en}[Partie I — Commencer par ce que l'on connaît déjà]{.fr}[Teil I — Mit dem beginnen, was man schon kennt]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html",
|
||||||
|
"href": "02-part-ii-processes.html",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "",
|
||||||
|
"text": "3.1 Schritt 11 — Die Komponenten trennen\nDie Schritte 11 bis 18 nehmen die Architektur aus Teil I und verteilen sie auf fünf Betriebssystemprozesse auf einem Rechner. Die Fähigkeiten behalten ihre Postfachnamen; nur der Transport darunter wechselt, von Java-Objekten zu Dateien in Verzeichnissen. Das erste wirklich verteilte Problem tritt hier auf, und es hat nichts mit ROT13 zu tun.\nDrei Prozesse können keine BlockingQueue teilen: jeder java-Befehl startet seine eigene JVM mit eigenem Speicher, die mailboxes-Map existierte also dreimal, und jede Kopie sähe nur ihre eigenen Nachrichten. Ein externer Transport ist nötig.\nTCP würde gehen, MQTT würde gehen. Absichtlich fällt die Wahl auf die primitivste Möglichkeit, das Dateisystem, mit einer einzeiligen Begründung: weil man es sehen kann. Nachrichten werden Dateien, die man mit ls auflisten und mit cat lesen kann, während das System läuft. Primitiv heisst hier nicht schlechter; Teil VIII kommt darauf zurück, was das Dateisystem wirklich gut und wirklich schlecht kann.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-steps-12-13",
|
||||||
|
"href": "02-part-ii-processes.html#sec-steps-12-13",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.2 Schritte 12–13 — Ein Verzeichnis wird zum Postfach",
|
||||||
|
"text": "3.2 Schritte 12–13 — Ein Verzeichnis wird zum Postfach\nDie Zuordnung ist eine Zeile lang:\ndirectory = mailbox file = message\npublish = create file receive = watch directory\nmessageBoard/\n├── consoleIn/outbox/\n├── rot13/inbox/\n├── rot13/outbox/\n└── consoleOut/inbox/\nDer Message-Record erhält einen optionalen Zeitstempel, und das Dateiformat bleibt zwei Zeilen plus eine optionale dritte:\nTEXT\nHello World\nTIMESTAMP: 2026-09-22T10:42:12.123Z\nEine handgeschriebene Nachricht darf den Zeitstempel weglassen. Die Marke TIMESTAMP: verhindert, dass eine Inhaltszeile, die zufällig wie ein Datum aussieht, für Metadaten gehalten wird; in diesem winzigen Format ist eine letzte Zeile, die mit TIMESTAMP: beginnt, reserviert.\nJackson könnte hier eingeführt werden und wird es absichtlich nicht. Der Sinn eines lächerlich einfachen Formats ist, dass fast nichts die Architektur verdeckt — die ganze Nachricht ist in jedem Texteditor lesbar, was die Aufmerksamkeit darauf hält, wer mit wem spricht.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-step-14",
|
||||||
|
"href": "02-part-ii-processes.html#sec-step-14",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.3 Schritt 14 — Das erste Problem verteilter Systeme: die Veröffentlichung",
|
||||||
|
"text": "3.3 Schritt 14 — Das erste Problem verteilter Systeme: die Veröffentlichung\nEin Leser, der ein Verzeichnis beobachtet, kann eine Datei entdecken, bevor der Schreiber sie fertig geschrieben hat. Daher ein Veröffentlichungsprotokoll:\n\neine private temporäre Datei erzeugen;\ndie vollständige Nachricht schreiben;\nsie schliessen;\nsie atomar auf ihren endgültigen .msg-Namen umbenennen;\nKonsumenten reagieren nur auf endgültige Dateien.\n\nFiles.writeString(temporary, content);\nFiles.move(temporary, published, StandardCopyOption.ATOMIC_MOVE);\nBeide Hälften sind nötig. Das Umbenennen ist atomar — ein Leser sieht entweder keine .msg-Datei oder die vollständige —, aber es schützt nichts, wenn Leser auch .tmp-Dateien aufgreifen. .tmp und .msg bleiben im selben Verzeichnis, damit der Verschiebevorgang kein Dateisystem überschreitet, wo die Atomarität verloren ginge.\n\nSchreiben und Veröffentlichen sind nicht dieselbe Operation.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-step-15",
|
||||||
|
"href": "02-part-ii-processes.html#sec-step-15",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.4 Schritt 15 — Ein Postfach mit WatchService beobachten",
|
||||||
|
"text": "3.4 Schritt 15 — Ein Postfach mit WatchService beobachten\nJavas eigener Dateisystem-Beobachter liefert die Konsumentenhälfte: ein Verzeichnis für ENTRY_CREATE registrieren, in watcher.take() blockieren und jeden Dateinamen ignorieren, der nicht auf .msg endet.\nDas ergibt auch ein sehr einfaches Einspeisewerkzeug. Mit ActuatorService als laufendem Konsumenten:\nprintf 'TEXT\\nHello from a file' > messageBoard/consoleOut/inbox/manual.tmp\nmv messageBoard/consoleOut/inbox/manual.tmp messageBoard/consoleOut/inbox/manual.msg\nBeobachtet: beim Auftauchen der .tmp-Datei geschieht nichts; die Zeile erscheint in dem Moment, in dem das Umbenennen den .msg-Namen erzeugt. Beide erlaubten Formate funktionieren, mit und ohne abschliessenden Zeitstempel.\nDie architektonische Lehre lautet producer → filesystem → consumer: der Konsument konnte einen Menschen, der mv tippt, nicht von einem echten Dienst unterscheiden. Er kennt sein eigenes Eingangspostfach, nicht den, der hineinschreibt. Der Egoismus hat die Prozessgrenze überlebt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-steps-16-17",
|
||||||
|
"href": "02-part-ii-processes.html#sec-steps-16-17",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.5 Schritte 16–17 — Dienste und Vermittler werden Prozesse",
|
||||||
|
"text": "3.5 Schritte 16–17 — Dienste und Vermittler werden Prozesse\nDie drei Fähigkeiten werden drei Programme, und der Vermittler eine vierte Art Programm:\n\n\n\n\n\n\n\n\n\nProgramm\nspielt\nliest\nschreibt\n\n\n\n\nSensorService.java\nConsoleIn\ndie Tastatur\nconsoleIn/outbox\n\n\nProcessorService.java\nROT13\nrot13/inbox\nrot13/outbox\n\n\nActuatorService.java\nConsoleOut\nconsoleOut/inbox\ndie Konsole\n\n\nMediator.java <from> <to>\nder Klebstoff\n<from>\n<to>\n\n\n\nDer Vermittler ist generisch: seine Route ist nicht einkompiliert, sie kommt als zwei Startargumente. Doch eine Asymmetrie sollte man im Kopf behalten: die drei Fähigkeiten erhalten ihre Arbeit als Nachrichten in einem Postfach, der Vermittler dagegen seine Route als Startkonfiguration — und er hat keinen Namen und kein eigenes Steuerpostfach, in das jemand schreiben könnte.\nPraktische Folge: Argumente werden einmal gelesen, das Ändern der Route eines laufenden Vermittlers heisst also: anhalten und neu starten. Eine Konfigurationsdatei wäre nicht anders — auch sie wird beim Start gelesen. Dieser Punkt bleibt absichtlich offen, bis die Kosten der verteilten Vermittler zu spüren waren.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-step-18",
|
||||||
|
"href": "02-part-ii-processes.html#sec-step-18",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.6 Schritt 18 — Die vollständig externe lokale Fassung ausführen",
|
||||||
|
"text": "3.6 Schritt 18 — Die vollständig externe lokale Fassung ausführen\nFünf Terminals, fünf Prozesse, ein lokales Dateisystem dazwischen:\njava SensorService.java # terminal 1\njava Mediator.java consoleIn/outbox rot13/inbox # terminal 2\njava ProcessorService.java # terminal 3\njava Mediator.java rot13/outbox consoleOut/inbox # terminal 4\njava ActuatorService.java # terminal 5\nBeobachtet: Hello World, in Terminal 1 getippt, erschien als Uryyb Jbeyq in Terminal 5. Die drei mittleren Terminals zeigten nichts Neues — jeder Vermittler gibt beim Start eine Zeile „Mediating: …” aus, und ProcessorService gibt überhaupt nichts aus. Danach enthielt jedes der vier Postfachverzeichnisse eine .msg-Datei: dieselbe Zeile, entlang der Kette kopiert.\nNachzählen: fünf Prozesse für das, was Schritt 1 in einer Anweisung tat. Jetzt ist nicht der Moment zu optimieren: bequem soll es noch nicht sein.\n\n\n\n\n\n\nAbbildung 3.1: Die fünf Prozesse und die vier Postfachverzeichnisse. In der Webfassung folgt Abspielen einer Textzeile von der Tastatur zur Konsole.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "02-part-ii-processes.html#sec-part-ii-result",
|
||||||
|
"href": "02-part-ii-processes.html#sec-part-ii-result",
|
||||||
|
"title": "3 Teil II — Die Prozessgrenze überschreiten",
|
||||||
|
"section": "3.7 Was Teil II verschoben hat",
|
||||||
|
"text": "3.7 Was Teil II verschoben hat\n\n\n\n\n\n\n\n\nStufe\nwo die Topologie liegt\nwer umverdrahten kann\n\n\n\n\nSchritt 1\nim Code der Fähigkeit\nwer diesen Code ändert\n\n\nSchritte 7–8\nin main(), als Postfachnamen\nwer main() ändert\n\n\nSchritt 18\nin den zwei Befehlszeilen Mediator.java <from> <to>\nwer die Prozesse startet\n\n\n\nDie Topologie hat den Quellcode nun ganz verlassen: keine .java-Datei enthält die Route. Sie steckt in dem, was der Bediener getippt hat — damit ist derzeit ein Mensch der Orchestrator. Was die Fünf-Prozess-Fassung einbringt, ist echt: die Verdrahtung kann sich ändern, ohne ein Programm anzufassen. Was sie kostet, ist ebenso echt: fünf Prozesse, vier Kopien jeder Nachricht und ein Programm, das bei Ctrl+D nicht mehr stehen bleibt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>3</span> <span class='chapter-title'>[Part II — Cross the process boundary]{.en}[Partie II — Franchir la frontière de processus]{.fr}[Teil II — Die Prozessgrenze überschreiten]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html",
|
||||||
|
"href": "03-part-iii-distributed.html",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "",
|
||||||
|
"text": "4.1 Syncthing repliziert; es liefert nicht aus\nFünf Prozesse auf einem Rechner teilen immer noch ein Dateisystem. Die Schritte 19 bis 27 verteilen sie auf zwei Maschinen, replizieren das Nachrichtenbrett mit Syncthing zwischen ihnen, messen die Kosten und zerbrechen dann absichtlich einen Vermittler. Am Ende ist der Preis der Vermittler eine Zahl und keine Meinung.\nSyncthing hält ein Verzeichnis zwischen Maschinen repliziert. Mehr wird hier nicht verlangt. Es weiss nichts von Intent, Status, Event, ROT13 oder Vermittlern, und es kennt keinen Konsumenten: keine Abonnements, keine Topics, keine Lieferzusagen, keine Vorstellung davon, dass jemand wartet.\nDer Auslöser bleibt unser eigener. Jeder Dienst betreibt seinen eigenen WatchService auf einem lokalen Verzeichnis; Syncthing lässt die Dateien dort nur erscheinen. Deshalb musste keiner der drei Dienste eine Zeile ändern, als das System verteilt wurde.\nDaraus folgen zwei Dinge, die später als Beobachtung und nicht als Warnung auftreten:",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-syncthing-not-a-broker",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-syncthing-not-a-broker",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "",
|
||||||
|
"text": "Replikation ist asynchron — das Umbenennen .tmp → .msg ist auf jeder Maschine einzeln atomar, und nichts verspricht Reihenfolge oder Atomarität zwischen Maschinen;\ndas Dateisystem ist ein ernstzunehmender Transport mit eigenen Stärken: Dateien dürfen gross sein, Replikate überleben einen Neustart, und jede Nachricht lässt sich mit cat lesen.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-one-layer",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-one-layer",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "4.2 Eine Schicht auf einmal prüfen",
|
||||||
|
"text": "4.2 Eine Schicht auf einmal prüfen\nBevor irgendein Java-Programm den replizierten Ordner berührte, lief der langweiligste denkbare Test: hello.txt auf einer Maschine schreiben, prüfen, dass es auf der anderen erscheint, es löschen, prüfen, dass die Löschung zurückkommt. Beide Richtungen funktionierten.\nDiese Reihenfolge ist wichtig. Als der verteilte Lauf später scheiterte, war die Frage „Replikation oder mein Programm?” für den Transport schon beantwortet, und die Suche konnte eine Schicht höher beginnen.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-keystroke-cost",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-keystroke-cost",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "4.3 Was ein Tastendruck kostet",
|
||||||
|
"text": "4.3 Was ein Tastendruck kostet\nMit dem Sensor auf einer Maschine und den Vermittlern, ROT13 und dem Aktor auf der anderen erzeugte eine getippte Zeile vier .msg-Dateien, eine pro Postfach:\n\n\n\nPostfach\nInhalt\nZeitstempel darin\n\n\n\n\nconsoleIn/outbox\nHello World\n23:02:05.315\n\n\nrot13/inbox\nHello World\n23:02:05.315\n\n\nrot13/outbox\nUryyb Jbeyq\n23:02:13.471\n\n\nconsoleOut/inbox\nUryyb Jbeyq\n23:02:13.471\n\n\n\nDie wiederholten Zeitstempel belegen, dass zwei dieser vier Veröffentlichungen reine Kopien sind: die Vermittler veröffentlichen die Nachricht unverändert erneut, Zeitstempel eingeschlossen. Sie berechnen identity(x) = x, als eigene verteilte Prozesse.\nDie Zeiten, gemessen an den Änderungszeiten der vier Dateien auf einer Maschine, damit keine Uhrendifferenz hineinspielt: die Datei des Sensors erscheint um 01:02:05.432, die drei anderen um 01:02:13.460, .504 und .532 — 8,10 s später und innerhalb von 72 ms zueinander. Die eigentliche Arbeit der Kette dauerte also Millisekunden; die acht Sekunden sind Syncthings Verbreitung. Dieselbe Kette, vollständig auf einer Maschine, braucht etwa 24 ms.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-break-a-mediator",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-break-a-mediator",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "4.4 Einen Vermittler zerbrechen",
|
||||||
|
"text": "4.4 Einen Vermittler zerbrechen\nHalten Sie den ersten Vermittler an und tippen Sie zwei Zeilen. ConsoleIn lebt, ROT13 lebt, ConsoleOut lebt, Syncthing lebt — und der Geschäftsfluss ist tot. Die zwei Zeilen stapeln sich in consoleIn/outbox; weiter kommt nichts. Die Vermittler gehören zur Verfügbarkeitskette.\nStarten Sie den Vermittler neu. Nichts wird ausgeliefert. FileMessageBoard.watch registriert ein Verzeichnis für ENTRY_CREATE und blockiert in watcher.take(); es listet nie, was schon da ist. Die zwei Dateien liegen weiter auf der Platte, in beiden Replikaten — es ging also nichts verloren. Kein Gedächtnis hat das Abonnement.\nDiese Unterscheidung lohnt sich: die Nachrichten überlebten, die Auslieferung nicht. Ein Broker antwortet darauf mit Sitzungszustand und retained messages; im eigenen Code wäre es eine Zeile — die vorhandenen .msg-Dateien auflisten, bevor die Beobachtungsschleife beginnt — die das Material bewusst noch nicht schreibt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-configurable-mediator",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-configurable-mediator",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "4.5 Der Vermittler wird ein gewöhnlicher Dienst",
|
||||||
|
"text": "4.5 Der Vermittler wird ein gewöhnlicher Dienst\nBevor die Vermittler verschwinden, fällt eine Asymmetrie weg: die Dienste erhalten ihre Arbeit als Nachrichten, der Vermittler erhielt seine Route als Shell-Argumente. Er bekommt daher nur einen Namen, ConfigurableMediator mediator1, aus dem er ein dauerhaftes Steuerpostfach ableitet, mediators/mediator1/inbox, und die Route kommt als Nachricht:\nROUTE\nconsoleIn/outbox\nrot13/inbox\nfrom und to reisen absichtlich in einer Nachricht: als zwei hielte der Vermittler kurz eine neue Quelle mit dem alten Ziel und leitete an die falsche Stelle weiter. Eine Route ist ein Fakt, und ein Fakt gehört in eine Nachricht.\nEin kurzlebiger Orchestrator veröffentlicht beide Routen und endet, damit die Topologie an einer Stelle sichtbar ist und nicht im Datenpfad liegt. Startet man ihn nach den Diensten und hat vorher eine Zeile getippt, zeigen sich beide Hälften auf einmal: die frühe Zeile bleibt liegen, die späte läuft durch.\nWas besser wird: der Vermittler hat eine Identität, nimmt Konfiguration über sein eigenes Postfach, behält eine generische Fähigkeit und bezieht seine Topologie von einem Orchestrator. Was nicht besser wird: der Datenpfad. Er bleibt event → Vermittler → kopiertes event, weiter ein Prozess in der Verfügbarkeitskette, der jede Nachricht ohne Bedeutungsgewinn kopiert. Und diese Fassung nimmt genau eine Route an: waitForRoute(...) kehrt zurück, dann betritt der Vermittler watch(route.from(), …) und liest sein Steuerpostfach nie wieder. Umverdrahten im Betrieb wird nicht versprochen, weil ein blockierendes watch nicht gleichzeitig ein Steuerpostfach und eine Quelle bedienen kann — der Grund für die Abonnement-Hilfe später.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "03-part-iii-distributed.html#sec-part-iii-result",
|
||||||
|
"href": "03-part-iii-distributed.html#sec-part-iii-result",
|
||||||
|
"title": "4 Teil III — Es wirklich verteilen",
|
||||||
|
"section": "4.6 Was Teil III verschoben hat",
|
||||||
|
"text": "4.6 Was Teil III verschoben hat\n\n\n\n\n\n\n\n\nStufe\nwo die Topologie liegt\nim Datenpfad?\n\n\n\n\nSchritt 18\ndie Befehlszeilen des Bedieners\ndie Vermittler sind es\n\n\nSchritt 27\nein Orchestrator, als Intent veröffentlicht\ndie Vermittler sind es weiterhin\n\n\n\nDie Frage, mit der der Teil schliesst, ist daher scharf und nicht rhetorisch: warum kann der Dienst, der sich für die Daten interessiert, sie nicht selbst hören?",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>4</span> <span class='chapter-title'>[Part III — Make it actually distributed]{.en}[Partie III — Le rendre réellement distribué]{.fr}[Teil III — Es wirklich verteilen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "04-part-iv-rewind.html",
|
||||||
|
"href": "04-part-iv-rewind.html",
|
||||||
|
"title": "5 Teil IV — Zurückspulen",
|
||||||
|
"section": "",
|
||||||
|
"text": "5.1 Die naheliegende Abkürzung und ihre Falle\nDie Schritte 28 bis 34 kehren absichtlich zu einer JVM zurück. Ohne Replikationsverzögerung und ohne fünf Terminals kann sich nur ändern, wer wen kennt — die Idee lässt sich also in Sekunden ausprobieren statt in einer verteilten Fehlersuche.\nWenn der erste Vermittler nur Nachrichten kopiert: löschen wir ihn und lassen ROT13 die Quelle selbst lesen:\nDer Vermittler ist weg. Doch die wiederkehrende Frage: ROT13 enthält jetzt den Namen von ConsoleIns Postfach. Die Topologie ist aus dem Vermittler in den Dienst gewandert. Im Wortlaut des Materials: „Wir haben den Vermittler entfernt … und die Topologie zurück in den Dienst gelegt. Hoppla.”",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>5</span> <span class='chapter-title'>[Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "04-part-iv-rewind.html#sec-the-trap",
|
||||||
|
"href": "04-part-iv-rewind.html#sec-the-trap",
|
||||||
|
"title": "5 Teil IV — Zurückspulen",
|
||||||
|
"section": "",
|
||||||
|
"text": "listen(\"consoleIn.outbox\");",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>5</span> <span class='chapter-title'>[Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "04-part-iv-rewind.html#sec-capability-vs-topology",
|
||||||
|
"href": "04-part-iv-rewind.html#sec-capability-vs-topology",
|
||||||
|
"title": "5 Teil IV — Zurückspulen",
|
||||||
|
"section": "5.2 Fähigkeit ist nicht Topologie",
|
||||||
|
"text": "5.2 Fähigkeit ist nicht Topologie\nROT13 darf zwei Dinge wissen: ich kann Text transformieren und ich kann auf kompatible Textnachrichten hören. Es darf nicht wissen: meine Eingabe kommt immer aus consoleIn.outbox — das ist Deployment-Topologie.\nDer Name ist daher nicht einkompiliert, er kommt zur Laufzeit:\nTOPIC consoleIn.outbox\nROT13 lernt seine Verdrahtung aus Daten. Wer sie sendet, ist wichtig: in DynamicQueueRot13.java veröffentlicht main() beide TOPIC-Nachrichten — ein Konfigurator ausserhalb des Datenpfads, in der Rolle des früheren Orchestrators. ConsoleIn kann es nicht sein: sagte ConsoleIn ROT13, was es abonnieren soll, müsste es wissen, dass ROT13 existiert — die Topologie wäre nur in eine andere Fähigkeit gewandert.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>5</span> <span class='chapter-title'>[Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "04-part-iv-rewind.html#sec-dynamic-mechanics",
|
||||||
|
"href": "04-part-iv-rewind.html#sec-dynamic-mechanics",
|
||||||
|
"title": "5 Teil IV — Zurückspulen",
|
||||||
|
"section": "5.3 Was sich im Code ändert",
|
||||||
|
"text": "5.3 Was sich im Code ändert\nlisten(...) ist nichts Exotisches: ein virtueller Thread, der wiederholt take() auf einer derselben Warteschlangen aufruft. subscribe(...) startet einen solchen Thread pro abonniertem Namen. Die Folge ist in den Postfächern sichtbar:\n\nROT13 nimmt direkt aus consoleIn.outbox — dem Namen, den es erhalten hat;\nrot13.inbox ist kein Nutzlast-Postfach mehr. Es trägt Steuernachrichten, und ROT13s Schleife liest es, um zu entscheiden, ob eine Nachricht ein anzuwendendes TOPIC ist.\n\nNichts schreibt mehr in rot13.inbox, um Daten zu bewegen. Das Postfach verschwand nicht; es wechselte die Aufgabe, von Nutzlast zu Intent.\nEine Beobachtung aus dem Lauf: nach Ctrl+D endet die Ausgabe, das Programm bleibt aber am Leben. Unterbrochen wurde nichts — runConsoleIn kehrt am Eingabeende zurück, der Produzent ist also weg, während beide Abonnenten-Threads in take() auf Quellen warten, die nie wieder veröffentlichen. Die JVM lebt weiter, weil main mit Thread.currentThread().join() endet. „Der Fluss stoppte” muss immer darauf zurückgeführt werden, welcher Beteiligte stoppte.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>5</span> <span class='chapter-title'>[Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "04-part-iv-rewind.html#sec-route-topic-intent",
|
||||||
|
"href": "04-part-iv-rewind.html#sec-route-topic-intent",
|
||||||
|
"title": "5 Teil IV — Zurückspulen",
|
||||||
|
"section": "5.4 ROUTE und TOPIC sind Intent",
|
||||||
|
"text": "5.4 ROUTE und TOPIC sind Intent\nZwei Tests für TOPIC consoleIn.outbox. Beschreibt es etwas, das geschehen ist? Nein. Etwas, das gerade gilt? Nein. Es sagt beginne hier zu hören — gewünschtes Verhalten, also Intent. Das ROUTE des Vermittlers ist dieselbe Art Nachricht: leite von hier nach dort weiter.\nEine Falle, die benannt gehört, weil sie in einer Verteidigung verlockt: ein Intent zu veröffentlichen ist natürlich etwas, das geschehen ist. Die Einordnung folgt dem, was die Nachricht sagt, nicht ihrer Existenz.\nUnd eine Bedingung, die wiederkommt: die dynamische Fassung ist nicht automatisch besser. Sie ergibt nur Sinn, wenn der Konsument den Nachrichtenvertrag des Produzenten wirklich versteht.\nSTATISCH VERMITTELT DYNAMISCH DIREKT\nProduzent → Vermittler → Konsument Intent → (Produzent ──► Konsument)",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>5</span> <span class='chapter-title'>[Part IV — Rewind]{.en}[Partie IV — Rembobinage]{.fr}[Teil IV — Zurückspulen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "05-part-v-subscriptions.html",
|
||||||
|
"href": "05-part-v-subscriptions.html",
|
||||||
|
"title": "6 Teil V — Die dynamische Idee über Prozesse hinweg wiederholen",
|
||||||
|
"section": "",
|
||||||
|
"text": "6.1 Ein blockierendes watch genügt nicht\nDie Schritte 35 bis 38 holen die Abonnement-Idee aus der einzelnen JVM heraus. Die Dienste werden wieder getrennte Programme, aber anstelle von Vermittlern, die Dateien kopieren, beobachtet jeder Dienst das Postfach, das ihm gesagt wurde. Eine Annahme des ersten Dateisystem-Helfers übersteht den Umzug nicht, und genau deren Korrektur ist das Thema dieses Teils.\nFileMessageBoard.watch(topic, receiver) registriert ein Verzeichnis und blockiert für immer. Das genügte, solange jeder Prozess ein festes Postfach beobachtete. Ein dynamisch verdrahteter Dienst braucht mehr:\nDie alte Signatur kann das nicht ausdrücken, und die Folge war schon vorher sichtbar: der konfigurierbare Vermittler nahm genau eine ROUTE an, denn sobald er seine Quelle beobachtete, wurde er für sein eigenes Steuerpostfach taub. Die Grenze war nie, wessen Verzeichnis es ist — sondern eines, festes, für immer.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>6</span> <span class='chapter-title'>[Part V — Replay the dynamic idea across processes]{.en}[Partie V — Rejouer l'idée dynamique entre processus]{.fr}[Teil V — Die dynamische Idee über Prozesse hinweg wiederholen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "05-part-v-subscriptions.html#sec-watch-limit",
|
||||||
|
"href": "05-part-v-subscriptions.html#sec-watch-limit",
|
||||||
|
"title": "6 Teil V — Die dynamische Idee über Prozesse hinweg wiederholen",
|
||||||
|
"section": "",
|
||||||
|
"text": "dauerhaft das eigene Steuerpostfach beobachten\nUND\nzur Laufzeit ein beobachtetes Verzeichnis hinzufügen\nUND\nes möglicherweise später entfernen",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>6</span> <span class='chapter-title'>[Part V — Replay the dynamic idea across processes]{.en}[Partie V — Rejouer l'idée dynamique entre processus]{.fr}[Teil V — Die dynamische Idee über Prozesse hinweg wiederholen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "05-part-v-subscriptions.html#sec-filesubscriptions",
|
||||||
|
"href": "05-part-v-subscriptions.html#sec-filesubscriptions",
|
||||||
|
"title": "6 Teil V — Die dynamische Idee über Prozesse hinweg wiederholen",
|
||||||
|
"section": "6.2 Der Helfer: FileSubscriptions",
|
||||||
|
"text": "6.2 Der Helfer: FileSubscriptions\nEin WatchService kann viele Verzeichnisse bedienen. register(...) gibt einen WatchKey zurück, der eines davon bezeichnet, watcher.take() liefert den Schlüssel mit Ereignissen, und key.cancel() meldet ihn ab. Der Helfer hält beide Richtungen, Name → Schlüssel und Schlüssel → Name, damit ein Ereignis auf das Postfach zurückgeführt werden kann, aus dem es kam.\nEreignisse erreichen keinen Callback direkt. Sie gehen in eine Warteschlange, gelesen mit take(), und tragen\nrecord IncomingMessage(String mailbox, Message message) {}\nDafür zwei Gründe; die Ankunftsreihenfolge ist nur der dritte. Erstens muss der beobachtende Thread für jedes abonnierte Verzeichnis ansprechbar bleiben: ein Callback, der transformiert, veröffentlicht oder blockiert, hielte die Beobachtung aller anderen auf. Zweitens reist der Postfachname mit der Nachricht, sodass eine Schleife im Dienst deren Bedeutung bestimmen kann — Steuerpostfach, also ein anzuwendender Intent; abonnierte Quelle, also zu transformierende Daten — und dieselbe Schleife darf Abonnements hinzufügen oder entfernen, weil sie nicht in einem Callback feststeckt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>6</span> <span class='chapter-title'>[Part V — Replay the dynamic idea across processes]{.en}[Partie V — Rejouer l'idée dynamique entre processus]{.fr}[Teil V — Die dynamische Idee über Prozesse hinweg wiederholen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "05-part-v-subscriptions.html#sec-two-publications",
|
||||||
|
"href": "05-part-v-subscriptions.html#sec-two-publications",
|
||||||
|
"title": "6 Teil V — Die dynamische Idee über Prozesse hinweg wiederholen",
|
||||||
|
"section": "6.3 Zwei Veröffentlichungen statt vier",
|
||||||
|
"text": "6.3 Zwei Veröffentlichungen statt vier\nStarten Sie SensorService, DynamicProcessorService und DynamicActuatorService — ohne Vermittler — und lassen Sie dann Configure.java die zwei TOPIC-Nachrichten veröffentlichen. Eine danach getippte Zeile hinterlässt genau zwei Anwendungsveröffentlichungen im Brett:\n\n\n\n\n\n\n\n\nPostfach\nInhalt\nwas es ist\n\n\n\n\nconsoleIn/outbox\nTEXT hello\ndie Eingabe\n\n\nrot13/outbox\nTEXT uryyb\ndas Ergebnis\n\n\nrot13/inbox\nTOPIC consoleIn/outbox\nIntent, einmal veröffentlicht\n\n\nconsoleOut/inbox\nTOPIC rot13/outbox\nIntent, einmal veröffentlicht\n\n\n\nconsoleOut/inbox enthält keine Nutzlast: ConsoleOut nimmt direkt aus rot13/outbox. Sein Postfach wechselte die Aufgabe, von Nachrichten zu Verdrahtung.\nEine Zeile, die vor dem Lauf von Configure.java getippt wurde, bleibt für immer in consoleIn/outbox. Ein Abonnement, das noch nicht existiert, verpasst, was ihm vorausging — dieselbe Lehre wie beim neu gestarteten Vermittler, der nichts auslieferte.\n\n\n\nFassung\nAnwendungsveröffentlichungen\nProzesse im Datenpfad\n\n\n\n\nvermittelt (Schritt 18)\n4\n5\n\n\nkonfigurierbarer Vermittler (Schritt 27)\n4\n5\n\n\ndynamisch (Schritt 38)\n2\n3",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>6</span> <span class='chapter-title'>[Part V — Replay the dynamic idea across processes]{.en}[Partie V — Rejouer l'idée dynamique entre processus]{.fr}[Teil V — Die dynamische Idee über Prozesse hinweg wiederholen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "06-part-vi-vocabulary.html",
|
||||||
|
"href": "06-part-vi-vocabulary.html",
|
||||||
|
"title": "7 Teil VI — Über Syncthing wiederholen und die Nachrichten benennen",
|
||||||
|
"section": "",
|
||||||
|
"text": "7.1 Der verteilte dynamische Lauf\nDie Schritte 39 bis 47 verteilen die dynamische Fassung auf zwei Maschinen, sagen genau, was „direkt” bedeutet, und geben dann — erst jetzt, nachdem die Ideen benutzt wurden — den drei Nachrichtenarten ihre Namen: Intent, Status, Event.\nSensor auf einer Maschine, ROT13 und der Aktor auf der anderen, nirgends ein Vermittler. Nachdem die zwei TOPIC-Intents repliziert waren, erzeugte eine getippte Zeile das Ergebnis auf der anderen Maschine — und das Brett zeigt die Kosten:\nSpannend war die Zeit. Die Eingabe wurde um 02:35:12 veröffentlicht, die Ergebnisse erschienen auf der ersten Maschine um 04:11:28,797 und ,893 — 96 ms auseinander, lange nach der Eingabe. Syncthing war über Nacht überlastet; der Stapel kam, als die Warteschlange abfloss. Die Kette war durchgehend korrekt; die Latenz des Transports steuert die Architektur nicht. Zum Vergleich: 24 ms für dieselbe Kette auf einer Maschine.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>7</span> <span class='chapter-title'>[Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "06-part-vi-vocabulary.html#sec-distributed-dynamic",
|
||||||
|
"href": "06-part-vi-vocabulary.html#sec-distributed-dynamic",
|
||||||
|
"title": "7 Teil VI — Über Syncthing wiederholen und die Nachrichten benennen",
|
||||||
|
"section": "",
|
||||||
|
"text": "consoleIn/outbox: die Eingabe;\nrot13/outbox: das Ergebnis, geschrieben von dem Dienst, der es erzeugt hat;\nconsoleOut/inbox: nur Intent, wo die vermittelte Fassung eine vollständige Kopie jeder Nachricht hielt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>7</span> <span class='chapter-title'>[Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "06-part-vi-vocabulary.html#sec-direct-precisely",
|
||||||
|
"href": "06-part-vi-vocabulary.html#sec-direct-precisely",
|
||||||
|
"title": "7 Teil VI — Über Syncthing wiederholen und die Nachrichten benennen",
|
||||||
|
"section": "7.2 Was „direkt” genau bedeutet",
|
||||||
|
"text": "7.2 Was „direkt” genau bedeutet\nZwei Sprünge, die gleich aussehen, sind architektonisch Gegensätze:\n\nein Transportsprung — Syncthing auf jeder Seite, möglicherweise ein Relay dazwischen — fügt keinen Beteiligten hinzu, der die Topologie kennt, und nichts reagiert darauf. Liefen die Pakete über einen anderen Kontinent, widerspräche das keiner Aussage hier.\nein architektonischer Sprung — ein Vermittler, der consoleIn/outbox → rot13/inbox kopiert — fügt eine Komponente hinzu, die beide Namen kennen muss, in der Verfügbarkeitskette steht und die Nachricht erneut veröffentlicht.\n\nDie vertretbare Aussage lautet daher: ROT13 reagiert auf ConsoleIns Veröffentlichung, ohne eine unserer Komponenten dazwischen und ohne ConsoleIns Identität zu enthalten. Nicht: die Daten gehen direkt von A nach B. Die Architektur bestimmt, auf welche Nachrichten ein Dienst reagiert, nicht die Wegewahl des Transports.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>7</span> <span class='chapter-title'>[Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "06-part-vi-vocabulary.html#sec-ise",
|
||||||
|
"href": "06-part-vi-vocabulary.html#sec-ise",
|
||||||
|
"title": "7 Teil VI — Über Syncthing wiederholen und die Nachrichten benennen",
|
||||||
|
"section": "7.3 Intent, Status, Event",
|
||||||
|
"text": "7.3 Intent, Status, Event\nDrei Nachrichtenarten, benannt erst nach ihrem Gebrauch:\n\n\n\n\n\n\n\n\n\nsagt\nunsere Beispiele\n\n\n\n\nE — Event\netwas ist geschehen\nTEXT hello als ConsoleIn/E/text; TEXT uryyb als ROT13/E/crypted\n\n\nS — Status/State\netwas ist gerade wahr\nROT13/S/subscriptions — von unserem System noch nicht veröffentlicht\n\n\nI — Intent\nwas geschehen soll\nTOPIC consoleIn/outbox, ROUTE … …\n\n\n\nVergangenheitsform ist ein nützlicher Hinweis für Events. Für Intent lautet der Test zwei Fragen: berichtet die Nachricht etwas Geschehenes? Nein. Etwas gerade Wahres? Nein. Dann verlangt sie Verhalten.\nEine Falle: einen Intent zu veröffentlichen ist natürlich etwas Geschehenes. Eingeordnet wird nach dem, was die Nachricht sagt, nicht nach ihrer Existenz — sonst wird alles zum Event und das Vokabular nützt nichts mehr.\nStatus verdient eine eigene Anmerkung, denn der Instinkt ist, ihn zu erfragen: „welche Abonnements hast du?” Doch Fragen ist ein Aufruf, und ein Aufruf verlangt, dass der Fragende die Komponente kennt, sie als laufend weiss und wartet. Status wird veröffentlicht: ROT13 veröffentlicht ROT13/S/subscriptions, sobald sich seine Verdrahtung ändert, und wer will, liest es. Der Leser braucht dann ein Topic, keine Komponente, und ROT13 erfährt nie, wer es prüft. Jede Art beantwortet eine andere Frage:\n\nein Event nützt nur, wenn man zuhörte — unsere liegengebliebenen Nachrichten, dreimal;\nein Status ist, was ein Neuankömmling braucht: der aktuelle Wert, ohne Geschichte nachzuspielen;\nein Intent verlangt eine Änderung.\n\nUnd Kommandos sind nicht verboten. ROT13/I mit ACTION Hello zu senden ist kommandoartig, und das Urteil des Materials lautet „Fine.” Die Komponente übt ihre Fähigkeit aus und veröffentlicht ihre Events und ihren Status. Der empfohlene Fluss ist Intent → Komponente → State + Events.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>7</span> <span class='chapter-title'>[Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "06-part-vi-vocabulary.html#sec-one-writer",
|
||||||
|
"href": "06-part-vi-vocabulary.html#sec-one-writer",
|
||||||
|
"title": "7 Teil VI — Über Syncthing wiederholen und die Nachrichten benennen",
|
||||||
|
"section": "7.4 Die Ein-Schreiber-Regel",
|
||||||
|
"text": "7.4 Die Ein-Schreiber-Regel\n\nJede schreibbare Ressource hat genau eine Schreibautorität.\n\nNicht zu verwechseln mit der UUID im Dateinamen. Die UUID verhindert, dass zwei Veröffentlichungen denselben physischen Namen wählen; die Schreibautorität sagt, welche Komponente eine logische Event- oder Status-Ressource besitzt. Zwei Schreiber kollidieren nie bei einem Dateinamen — genau deshalb wird das Problem leicht übersehen.\nWas ein zweiter Schreiber kostet: der Postfachname war der einzige Herkunftsnachweis, also bedeutet rot13/outbox nicht mehr „ROT13 hat dies transformiert”, und ein Abonnent kann dem Vertrag nicht mehr trauen, auf dem er aufbaut. Für Status ist es schlimmer — zwei Komponenten, die je den aktuellen Wert eines Faktes zu veröffentlichen behaupten, widersprechen sich, ohne Reihenfolgegarantie zwischen Maschinen, die entscheiden könnte. Bei append-only Events koexistieren viele Veröffentlichungen absichtlich; die Frage ist semantischer Besitz, nicht Kollision. Treten zwei Autoritäten auf, frage nach dem Warum, statt zum Lock zu greifen.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>7</span> <span class='chapter-title'>[Part VI — Replay it over Syncthing, and name the messages]{.en}[Partie VI — Rejouer sur Syncthing, et nommer les messages]{.fr}[Teil VI — Über Syncthing wiederholen und die Nachrichten benennen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "07-part-vii-mediation.html",
|
||||||
|
"href": "07-part-vii-mediation.html",
|
||||||
|
"title": "8 Teil VII — Die zwei architektonischen Ideen zusammenführen",
|
||||||
|
"section": "",
|
||||||
|
"text": "8.1 Ein Transformator verdient seine Existenz\nZwei Vermittler wurden entfernt und der Gewinn gemessen. Die Schritte 48 bis 52 beantworten die naheliegende nächste Frage: ist Vermittlung damit falsch? Nein — und die entscheidende Unterscheidung ist scharf genug, um sie auf einen fremden Entwurf anzuwenden.\nEntfernt wurde ein Vermittler, der A → A berechnete: eine teure Identitätsfunktion in der Verfügbarkeitskette, die jede Nachricht ohne Bedeutungsgewinn kopierte.\nNun ein Produzent, der {\"value\":\"Hello\"} veröffentlicht, und ein Konsument, der eine Anzeigestruktur erwartet. Ein TextToDisplayTransformer dazwischen leistet Schematransformation, semantische Anpassung, möglicherweise Einheitenumrechnung, möglicherweise Aggregation. Das ist Arbeit, die keine der beiden Seiten besitzen sollte: ROT13 hat nicht über Terminalfarben zu entscheiden, und die Konsole hat die Nutzlastform von ROT13 nicht zu verstehen.\nDie Grenze zieht die Vertragskompatibilität, nicht die Frage, ob etwas hinzukommt. Ein Vermittler, der Celsius in Fahrenheit umrechnet, ändert statt hinzuzufügen und hat seinen Platz verdient; einer, der einer schon verstandenen Nachricht einen Zeitstempel anhängt, hat etwas hinzugefügt und bleibt verdächtig. Die Frage ist immer: könnte der Konsument die Nachricht des Produzenten so lesen, wie sie ist?",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>8</span> <span class='chapter-title'>[Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "07-part-vii-mediation.html#sec-transformer",
|
||||||
|
"href": "07-part-vii-mediation.html#sec-transformer",
|
||||||
|
"title": "8 Teil VII — Die zwei architektonischen Ideen zusammenführen",
|
||||||
|
"section": "",
|
||||||
|
"text": "Versteht ein Konsument die Veröffentlichung eines Produzenten semantisch, genügt direktes Abonnieren oft. Sind die Verträge inkompatibel, führe einen Transformator ein, der eine echte Anpassung leistet.\nEin Vermittler, der nur kompatible Daten weiterleitet, ist verdächtig. Ein Vermittler, der nötige Semantik hinzufügt, hat seine Existenz verdient.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>8</span> <span class='chapter-title'>[Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "07-part-vii-mediation.html#sec-egoistic-transformer",
|
||||||
|
"href": "07-part-vii-mediation.html#sec-egoistic-transformer",
|
||||||
|
"title": "8 Teil VII — Die zwei architektonischen Ideen zusammenführen",
|
||||||
|
"section": "8.2 Auch der Transformator ist egoistisch",
|
||||||
|
"text": "8.2 Auch der Transformator ist egoistisch\nIn die Kette eingefügt, abonniert der Transformator rot13/outbox und veröffentlicht in sein eigenes Ausgangspostfach; ConsoleOut abonniert dann dieses statt das von ROT13. Was das an Code kostet: nichts. ConsoleOut erhält einen anderen Intent — TOPIC display/outbox statt TOPIC rot13/outbox — und die Kette ist umverdrahtet. ROT13 erfährt nie, dass der Transformator existiert; der Transformator nie, dass ConsoleOut existiert.\nWarum nicht direkt in consoleOut/inbox veröffentlichen und ein Postfach sparen? Vier Gründe:\n\nWissen — er enthielte ConsoleOuts Namen, also Topologie in einem Dienst, der Rückfall von Schritt 28;\nBesitz — dieses Postfach ist ConsoleOuts Steuerkanal, geschrieben vom Konfigurator; Nutzlast vom Transformator gäbe ihm zwei Autoritäten;\nReichweite — sein eigenes Ausgangspostfach kann ein Logger, eine Webansicht oder ein zweites Display kostenlos lesen, während ein Eingangspostfach genau einen Konsumenten bedient;\nVeränderbarkeit — ein Aggregator lässt sich danach durch einen anderen Intent einfügen, ohne eine Komponente zu ändern.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>8</span> <span class='chapter-title'>[Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "07-part-vii-mediation.html#sec-complete-filesystem",
|
||||||
|
"href": "07-part-vii-mediation.html#sec-complete-filesystem",
|
||||||
|
"title": "8 Teil VII — Die zwei architektonischen Ideen zusammenführen",
|
||||||
|
"section": "8.3 Die vollständige Dateisystem-Architektur",
|
||||||
|
"text": "8.3 Die vollständige Dateisystem-Architektur\nJedes Postfach mit genau einem Schreiber:\n\n\n\n\n\n\n\nPostfach\neinziger Schreiber\n\n\n\n\nconsoleIn/outbox\nSensorService\n\n\nrot13/outbox\nProcessorService\n\n\ndisplay/outbox\nder Transformator\n\n\njedes Steuerpostfach\nder Konfigurator — die eine bestimmte Intent-Autorität\n\n\ndas Terminal\nActuatorService, der kein Postfach schreibt\n\n\n\nEgoistische Fähigkeiten, Intent aus einer Autorität, ein Transformator nur dort, wo Verträge sich unterscheiden, ein Schreiber pro Ressource, und die Topologie nirgends in den Fähigkeiten. Das ist der Entwurf, den das Dateisystem gut genug war zu lehren — und der nächste Teil fragt, wofür das Dateisystem selbst nicht mehr gut genug ist.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>8</span> <span class='chapter-title'>[Part VII — Now merge the two architectural ideas]{.en}[Partie VII — Fusionner les deux idées architecturales]{.fr}[Teil VII — Die zwei architektonischen Ideen zusammenführen]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html",
|
||||||
|
"href": "08-part-ix-mqtt.html",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "",
|
||||||
|
"text": "9.1 Was das Dateisystem gelehrt hat und wofür es nicht taugt\nDas Dateisystem lehrte Veröffentlichungsgrenzen, Verzeichnisse als Adressen, Beobachtung, unabhängige Prozesse, unabhängige Sprachen, Synchronisationslatenz, Verdrahtung zur Laufzeit, State, Intent, Events, Vermittlerkosten, Dienstbesitz und Transformatordienste. Es war ein guter Lehrer und ist kein eleganter Nachrichten-Broker: am Ende war die Architektur sauber und der Transport ein Haufen .tmp-Dateien, atomarer Verschiebungen, erneuter Scans, geteilter Pfade und Replikationsverzögerung.\nDie Schlussfolgerung ist nicht „Dateien schlecht, MQTT gut”. Das Dateisystem hat einen Vorteil, den MQTT nicht erreicht — es speichert routinemässig Gigabytes bis Terabytes, während Broker und Clients für kleine Nachrichten gebaut sind, und das Stückeln einer riesigen Nutzlast über MQTT heisst, ein Dateitransferprotokoll in einem Nachrichtenprotokoll zu erfinden. Also:\nEin repliziertes Dateisystem gibt zudem jeder Maschine eine lokale Kopie, eine echte Stärke — doch Replikation ist kein Backup: Löschungen und Beschädigungen replizieren mit, sofern nicht eine Versionierung ältere Kopien bewahrt.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-filesystem-verdict",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-filesystem-verdict",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "",
|
||||||
|
"text": "Nachrichten für Koordination und Ereignisse. Für grosse Daten ein passender Datei- oder Objektspeicher. Eine Nachricht kann Ort, Identität und Metadaten dieser Daten tragen statt der Terabytes selbst.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-mqtt-mapping",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-mqtt-mapping",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.2 MQTT sollte vertraut wirken",
|
||||||
|
"text": "9.2 MQTT sollte vertraut wirken\n\n\n\nDateisystem / Syncthing\nMQTT\n\n\n\n\nWurzel des synchronisierten Nachrichtenbretts\nBroker / Namensraum\n\n\nVerzeichnispfad\nTopic\n\n\n.msg-Datei\nVeröffentlichung\n\n\nDateiinhalt\nNutzlast\n\n\nWatchService\nAbonnement\n\n\ndynamisches Verzeichnis\nTopic / Filter\n\n\nSteuerverzeichnis\nI\n\n\nZustandsverzeichnis\nS/…\n\n\nEreignisverzeichnis\nE/…\n\n\n\nDie gewünschte Reaktion des Materials: „Ach. Diese Architektur kennen wir schon.” MQTT ist ein Transportwechsel, keine architektonische Aussage.\nZwei Dinge, die ein Verzeichnis nicht konnte, in einer Minute auf der Kommandozeile sichtbar. Eine Veröffentlichung vor der Existenz eines Abonnenten erreicht ihn nie — die Lehre der liegengebliebenen Nachrichten zum dritten Mal, nun mit einer Antwort, die das Dateisystem nie hatte. Und ein Filter wie test/# passt auf test/a und test/a/b/c, nicht aber auf testing/x, weil # auf Ebenen arbeitet, nicht auf Zeichenpräfixen; test/+ passte nur eine Ebene tief.\nDie tiefere Korrektur: ein Topic ist kein Behälter. Es gibt kein Objekt namens test/a auf dem Broker. Ein Topic ist ein Routing-Schlüssel, den jede Veröffentlichung trägt und der gegen die Filter derjenigen geprüft wird, die in diesem Moment abonniert haben. Verzeichnisse halten Nachrichten; Topics vergleichen sie. Ein Abonnement deckt daher Topics ab, die noch nicht existieren — wo ein Nachrichtenbrett ein neues Verzeichnis und eine neue Registrierung brauchte.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-paho",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-paho",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.3 Die Bibliothek, die Client-ID und die Broker-Adresse",
|
||||||
|
"text": "9.3 Die Bibliothek, die Client-ID und die Broker-Adresse\nJava hat keinen MQTT-Client in der Standardbibliothek, also kommt Paho jetzt — nach dem Bedarf, wie der Vermittler in Schritt 7 und Jackson in Schritt 64. Vier Dinge braucht man: verbinden, veröffentlichen, abonnieren, Rückruf. Das Verbinden ist absichtlich unspektakulär: „Hier ist architektonisch nichts geschehen. Wir haben unseren Prozess nur an den Transport angeschlossen.”\nZwei Details des Verbindens haben Gewicht:\n\ndie Client-ID ist nicht bloss ein Eindeutigkeitsmerkmal. Der Broker erkennt daran einen zurückkehrenden Client und hält Sitzungszustand für ihn: Abonnements, bei QoS > 0 eingereihte Nachrichten und die Verknüpfung mit seinem Last Will. Ein Verzeichnis wusste nie, wer es beobachtete — genau deshalb spielte ein neu gestarteter Beobachter nichts nach.\ndie Broker-Adresse ist Deployment-Konfiguration: jedes Programm liest System.getProperty(\"mqtt.broker\", \"tcp://localhost:1883\"). Sie ist auch die einzige Konfiguration, die nicht als Intent kommen kann, denn Intent reist durch den Broker. Topologie lässt sich veröffentlichen; die Adresse des Veröffentlichenden nicht.\n\nAbonnieren kostet ein Paket, und der Broker führt die Abonnementliste. Es gibt keinen Standardweg, ihn zu fragen, was ein anderer Client abonniert hat — daher S/subscriptions: die eigene Erklärung einer Komponente über ihre Verdrahtung, veröffentlicht, damit die Architektur weiss, was der Transport privat hält. Nur ihr Eigentümer darf sie veröffentlichen, nach der Ein-Schreiber-Regel, denn nur er weiss, was er angenommen hat.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-structured-intent",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-structured-intent",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.4 Strukturierter Intent und zwei Mapper",
|
||||||
|
"text": "9.4 Strukturierter Intent und zwei Mapper\nTOPIC some/path hat ein Feld und eine Bedeutung. Es kann nicht sagen, welche Art Intent vorliegt, keinen zweiten Parameter tragen, nicht verschachteln, nicht erweitert werden; und ein Empfänger hat nichts, wogegen er prüfen könnte. Reicherer Intent braucht Struktur:\nsubscribe:\n topic: Demo/ConsoleIn/U/alice/E/text\nErst dann hat eine Serialisierungsbibliothek eine klare Aufgabe. JsonTools hält zwei Mapper, und die Asymmetrie ist Absicht:\n\ndas Lesen nutzt eine YAML-Factory mit abgeschaltetem FAIL_ON_UNKNOWN_PROPERTIES — JSON ist eine Teilmenge von YAML, handgetippter Intent wird akzeptiert, und ein neuerer Konfigurator darf Felder senden, die ein älterer Dienst ignoriert;\ndas Schreiben nutzt strenges JSON mit INDENT_OUTPUT, die veröffentlichten Nutzlasten sind also streng und lesbar.\n\nTolerant hinein, streng hinaus. Ein einziger Mapper müsste auf eines davon verzichten.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-duise",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-duise",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.5 DUISE und das Umverdrahten im Betrieb",
|
||||||
|
"text": "9.5 DUISE und das Umverdrahten im Betrieb\nDas Namensschema erhält endlich seinen Namen: Description (welche Verträge dieser Dienst versteht und veröffentlicht), Unit (welche Instanz), Intent (gewünschtes Verhalten), Status (was jetzt gilt), Event (was geschehen ist).\nDemo/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted}\nU/<unit> brauchte das Dateisystem nie: jede Maschine hatte ihr eigenes Replikat desselben relativen Pfades, Instanzidentität war implizit. MQTT hat einen gemeinsamen Namensraum, ein Topic muss also sagen, welche Kopie. U/alice in einer Fähigkeit festzuschreiben ist daher schlimmer, als consoleIn.outbox es je war: es bindet das Build an ein Deployment. Per Intent konfiguriert, dient ein Build allen — daher die drei Unit-Namen als Argumente von MqttConfigure. Die Unit-Namen sind die Topologie.\nUmverdrahten, am laufenden System beobachtet: einen neuen Intent mit anderer Quelle veröffentlichen, und der Dienst kündigt die alte, abonniert die neue und veröffentlicht S/subscriptions passend neu. Kein Neustart, keine Änderung. Schickt man stattdessen einen ungültigen Filter — Demo/#/E/text, wo # nicht die letzte Ebene ist — weist MqttTools.isValidFilter ihn ab; das alte Abonnement bleibt, und der Status sagt weiter die Wahrheit.\nDiese Abweisung legt eine echte Lücke offen, die man benennen und nicht verstecken sollte: sie wird nur lokal protokolliert. Der Konfigurator erfährt nicht, ob sein Intent angewandt oder abgelehnt wurde, und ein Monitor kann „abgelehnt” nicht von „noch nicht verarbeitet” unterscheiden. In diesem Entwurf erfährt ein Sender das Ergebnis, indem er den Status liest und mit seiner Anfrage vergleicht. Abweisungen als Event zu veröffentlichen oder ein Letzter-Fehler-Status würden die Lücke schliessen; beides steht nicht im Material — es ist eine zu begründende Entwurfsentscheidung.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-retained-and-will",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-retained-and-will",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.6 Was ein neuer Abonnent erfährt und was ein Toter zugibt",
|
||||||
|
"text": "9.6 Was ein neuer Abonnent erfährt und was ein Toter zugibt\nDrei Sekunden Demo/# abonnieren, ohne dass etwas veröffentlicht wird, ergibt dies:\nDemo/ROT13/U/nitro5/S/online {\"value\":true}\nDemo/ROT13/U/nitro5/S/subscriptions/text \"Demo/ConsoleIn/U/nitro5/E/text\"\nDemo/ConsoleOut/U/nitro5/S/online {\"value\":true}\nDemo/ConsoleOut/U/nitro5/S/subscriptions/text \"Demo/ROT13/U/nitro5/E/crypted\"\nEin Spätankömmling erfährt augenblicklich die gesamte aktuelle Verdrahtung des Systems, ohne jemanden zu fragen und ohne dass eine Komponente von einem Monitor weiss. Das ist retained Status. Keine Events kommen an, denn Events werden nicht retained veröffentlicht — „retained State, nicht retained Events”. Es ist auch die richtige Antwort auf den Reflex, einen Dienst zu fragen, was er tut: niemand fragt; der Dienst erklärt es einmal, und der Broker bewahrt es für jeden, der kommt.\nRetained Status allein würde allerdings lügen. Beendet man einen Dienst mit Ctrl+C, bleibt sein S/online = true für immer beim Broker. Daher der Last Will, bei der Verbindung registriert:\nvar will = new MqttMessage(\"{\\\"value\\\":false}\".getBytes(UTF_8), 1, true, new MqttProperties());\noptions.setWill(lastWillTopic, will);\nDer Will ist retained, ersetzt also beim Veröffentlichen durch den Broker das veraltete true. Die Komponente, die ausfällt, ist nicht die, die den Ausfall meldet — die einzige Anordnung, die funktionieren kann. Ein Vorbehalt: ein sauberes DISCONNECT löst keinen Will aus; ein gut erzogener Dienst veröffentlicht daher beim Beenden selbst online=false, und der Will deckt die hässlichen Tode.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-coupling-remains",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-coupling-remains",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.7 Was den Transport überlebte und welche Kopplung bleibt",
|
||||||
|
"text": "9.7 Was den Transport überlebte und welche Kopplung bleibt\nDie untere Hälfte der Tabelle Dateisystem→MQTT ist der Punkt: I, S, E, egoistische Dienste, Topologie zur Laufzeit und „Transformator wenn nötig” sind unverändert. Die Architektur überlebte den Transportwechsel, und das ist der stärkste verfügbare Beleg, dass sie nie am Transport hing.\nLose Kopplung heisst nicht, dass nichts etwas weiss. Notwendig bleibt die Einigkeit über: Nachrichtensyntax, Nachrichtensemantik, Topic-Verträge, Intent, Besitz, Bedeutung von State und Bedeutung von Events. Ziel ist nicht, Kopplung zu beseitigen, sondern unnötiges Wissen zu beseitigen. Konkret muss hier jeder Dienst genau einen fremden Event-Vertrag verstehen — ROT13 den E/text von ConsoleIn, ConsoleOut den E/crypted von ROT13 — plus das Intent-Schema, das er auf seinem eigenen I annimmt. Diese Liste ist das unverzichtbare Minimum.\nDavon getrennt: der Broker ist eine geteilte Infrastrukturabhängigkeit; alle brauchen seine Adresse, und ohne ihn läuft nichts. Real, aber anderer Art als das Wissen einer Komponente über eine andere.\nDie Prüfliste aus Schritt 78 ist das Werkzeug, das bleibt. Zwölf Fragen, von denen diese sechs das Argument dieses Systems tragen:\n\n\n\n\n\n\n\nFrage\nAntwort hier\n\n\n\n\nenthält eine Fähigkeit eine festgeschriebene Produzentenidentität?\nnein — sie kommt als Intent\n\n\nwelche fremden Verträge muss sie verstehen?\nje einen Event-Vertrag, plus ihr eigenes Intent-Schema\n\n\nwo ist die Topologie definiert?\nim Konfigurator, ausserhalb des Datenpfads\n\n\nkann sich die Topologie ohne Neukompilieren ändern?\nja — am laufenden System gezeigt\n\n\nkönnte der Transport ersetzt werden?\nja — gezeigt: Dateisystem, dann MQTT\n\n\nleistet jeder Vermittler etwas, das Vermittlung braucht?\nja, trivial: TEXT → TEXT braucht keine, und es gibt keinen\n\n\n\nDie Mahnung des Materials gilt: die Antworten müssen nicht alle „nein” lauten. Sie müssen absichtlich sein.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-whole-journey",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-whole-journey",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.8 Der ganze Weg",
|
||||||
|
"text": "9.8 Der ganze Weg\nDas Programm hat sich nie geändert: eine Zeile geht hinein, dieselbe kommt um 13 Buchstaben verschoben heraus. Geändert hat sich, elfmal, wie die Teile verbunden sind und wer das Wissen über diese Verbindung hält.\n\n\n\n\n\n\n\n\n\nStufe\nwie die Teile verbunden sind\nwo die Topologie liegt\nim Datenpfad ausser den Fähigkeiten\n\n\n\n\n1 prozedural\ndirekte Aufrufe\nim Code der Fähigkeit\n—\n\n\n2 egoistische Dienste\ngar nicht verbunden\nnirgends — das ist das Problem\n—\n\n\n3 statische Vermittlung, eine JVM\nPostfächer, von Vermittlern kopiert\ndie Vermittler, gestartet in main()\nzwei Vermittler\n\n\n4 statische Vermittlung, Dateisystem\nVerzeichnisse, von Vermittlerprozessen kopiert\ndie Befehlszeilen des Bedieners\nzwei Vermittlerprozesse\n\n\n5 statische Vermittlung, Syncthing\nreplizierte Verzeichnisse\ndie Befehlszeilen des Bedieners\nzwei Vermittlerprozesse, dazu Replikationsverzögerung\n\n\n6 benannte, konfigurierbare Vermittler\nROUTE-Intent von einem Orchestrator\nder Orchestrator, ausserhalb des Pfads\nweiterhin die Vermittler\n\n\n7 dynamisch, eine JVM\ndie Dienste hören selbst, gesteuert durch TOPIC-Intent\nder Konfigurator\nnichts\n\n\n8 dynamisch, Dateisystem\ndasselbe, über Verzeichnisse\nder Konfigurator\nnichts\n\n\n9 dynamisch, Syncthing\ndasselbe, über replizierte Verzeichnisse\nder Konfigurator\nnichts — nur Transportsprünge\n\n\n10 Verträge\nkompatibel: direkt; inkompatibel: ein Transformator\nder Konfigurator\nein Transformator, nur wo Verträge sich unterscheiden\n\n\n11 MQTT\nTopics auf einem Broker\nder Konfigurator\nnichts — der Broker ist Transport\n\n\n\nDie dritte Spalte von oben nach unten gelesen: die Topologie wandert nach aussen, Stufe um Stufe, bis keine Fähigkeit mehr etwas davon hält. Die letzte gelesen: der Preis dieser Wanderung fällt in Stufe 7 auf null und bleibt dort, während darunter dreimal der Transport wechselt. Dieselbe Architektur, besserer Transport.",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "08-part-ix-mqtt.html#sec-sentences",
|
||||||
|
"href": "08-part-ix-mqtt.html#sec-sentences",
|
||||||
|
"title": "9 Teil IX — MQTT",
|
||||||
|
"section": "9.9 Die Sätze, die man behalten sollte",
|
||||||
|
"text": "9.9 Die Sätze, die man behalten sollte\n\n„Event-driven” beschreibt, wie Information und Steuerung fliessen.\nLose Kopplung beschreibt, wie viel die Beteiligten voneinander wissen müssen.\nVeröffentliche, was geschehen ist.\nErkläre, was du willst.\nVeröffentliche deinen eigenen Zustand.\nHalte Fähigkeiten egoistisch.\nHalte die Topologie aus den Fähigkeiten heraus.\nBezahle keinen Vermittler, der nicht wirklich vermittelt.\n\nUnd wann immer eine Architektur verwirrend wird, zurück zur ersten Frage dieses Buches: wer kennt wen?",
|
||||||
|
"crumbs": [
|
||||||
|
"<span class='chapter-number'>9</span> <span class='chapter-title'>[Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de}</span>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"objectID": "glossary.html",
|
||||||
|
"href": "glossary.html",
|
||||||
|
"title": "Glossar",
|
||||||
|
"section": "",
|
||||||
|
"text": "Jeder Begriff unten wird dort definiert, wo er zum ersten Mal gebraucht wird, und von jeder späteren Erwähnung aus verlinkt. Der Pfeil eines Eintrags führt dorthin zurück.",
|
||||||
|
"crumbs": [
|
||||||
|
"Anhang",
|
||||||
|
"[Glossary]{.en}[Glossaire]{.fr}[Glossar]{.de}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
/*!
|
||||||
|
* Bootstrap v5.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2023 The Bootstrap Authors
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
*/@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap";:root,[data-bs-theme=light]{--bs-blue: #375a7f;--bs-indigo: #6610f2;--bs-purple: #6f42c1;--bs-pink: #e83e8c;--bs-red: #e74c3c;--bs-orange: #fd7e14;--bs-yellow: #f39c12;--bs-green: #00bc8c;--bs-teal: #20c997;--bs-cyan: #3498db;--bs-black: #000;--bs-white: #fff;--bs-gray: #6c757d;--bs-gray-dark: #343a40;--bs-gray-100: #f8f9fa;--bs-gray-200: #ebebeb;--bs-gray-300: #dee2e6;--bs-gray-400: #ced4da;--bs-gray-500: #adb5bd;--bs-gray-600: #6c757d;--bs-gray-700: #444;--bs-gray-800: #343a40;--bs-gray-900: #222;--bs-default: rgb(67.15, 67.15, 67.15);--bs-primary: #375a7f;--bs-secondary: rgb(67.15, 67.15, 67.15);--bs-success: #00bc8c;--bs-info: #3498db;--bs-warning: #f39c12;--bs-danger: #e74c3c;--bs-light: rgb(111.35, 111.35, 111.35);--bs-dark: rgb(45.05, 45.05, 45.05);--bs-default-rgb: 67, 67, 67;--bs-primary-rgb: 55, 90, 127;--bs-secondary-rgb: 67, 67, 67;--bs-success-rgb: 0, 188, 140;--bs-info-rgb: 52, 152, 219;--bs-warning-rgb: 243, 156, 18;--bs-danger-rgb: 231, 76, 60;--bs-light-rgb: 111, 111, 111;--bs-dark-rgb: 45, 45, 45;--bs-primary-text-emphasis: rgb(22, 36, 50.8);--bs-secondary-text-emphasis: rgb(26.86, 26.86, 26.86);--bs-success-text-emphasis: rgb(0, 75.2, 56);--bs-info-text-emphasis: rgb(20.8, 60.8, 87.6);--bs-warning-text-emphasis: rgb(97.2, 62.4, 7.2);--bs-danger-text-emphasis: rgb(92.4, 30.4, 24);--bs-light-text-emphasis: #444;--bs-dark-text-emphasis: #444;--bs-primary-bg-subtle: rgb(215, 222, 229.4);--bs-secondary-bg-subtle: rgb(217.43, 217.43, 217.43);--bs-success-bg-subtle: rgb(204, 241.6, 232);--bs-info-bg-subtle: rgb(214.4, 234.4, 247.8);--bs-warning-bg-subtle: rgb(252.6, 235.2, 207.6);--bs-danger-bg-subtle: rgb(250.2, 219.2, 216);--bs-light-bg-subtle: rgb(251.5, 252, 252.5);--bs-dark-bg-subtle: #ced4da;--bs-primary-border-subtle: rgb(175, 189, 203.8);--bs-secondary-border-subtle: rgb(179.86, 179.86, 179.86);--bs-success-border-subtle: rgb(153, 228.2, 209);--bs-info-border-subtle: rgb(173.8, 213.8, 240.6);--bs-warning-border-subtle: rgb(250.2, 215.4, 160.2);--bs-danger-border-subtle: rgb(245.4, 183.4, 177);--bs-light-border-subtle: #ebebeb;--bs-dark-border-subtle: #adb5bd;--bs-white-rgb: 255, 255, 255;--bs-black-rgb: 0, 0, 0;--bs-font-sans-serif: "IBM Plex Sans", system-ui, -apple-system, sans-serif;--bs-font-monospace: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-root-font-size: 17px;--bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;--bs-body-font-size:1rem;--bs-body-font-weight: 400;--bs-body-line-height: 1.66;--bs-body-color: #fff;--bs-body-color-rgb: 255, 255, 255;--bs-body-bg: #222;--bs-body-bg-rgb: 34, 34, 34;--bs-emphasis-color: #000;--bs-emphasis-color-rgb: 0, 0, 0;--bs-secondary-color: rgba(255, 255, 255, 0.75);--bs-secondary-color-rgb: 255, 255, 255;--bs-secondary-bg: #ebebeb;--bs-secondary-bg-rgb: 235, 235, 235;--bs-tertiary-color: rgba(255, 255, 255, 0.5);--bs-tertiary-color-rgb: 255, 255, 255;--bs-tertiary-bg: #f8f9fa;--bs-tertiary-bg-rgb: 248, 249, 250;--bs-heading-color: inherit;--bs-link-color: #00bc8c;--bs-link-color-rgb: 0, 188, 140;--bs-link-decoration: underline;--bs-link-hover-color: rgb(0, 150.4, 112);--bs-link-hover-color-rgb: 0, 150, 112;--bs-code-color: inherit;--bs-highlight-bg: rgb(252.6, 235.2, 207.6);--bs-border-width: 1px;--bs-border-style: solid;--bs-border-color: #dee2e6;--bs-border-color-translucent: rgba(0, 0, 0, 0.175);--bs-border-radius: 0.25rem;--bs-border-radius-sm: 0.2em;--bs-border-radius-lg: 0.5rem;--bs-border-radius-xl: 1rem;--bs-border-radius-xxl: 2rem;--bs-border-radius-2xl: var(--bs-border-radius-xxl);--bs-border-radius-pill: 50rem;--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width: 0.25rem;--bs-focus-ring-opacity: 0.25;--bs-focus-ring-color: rgba(55, 90, 127, 0.25);--bs-form-valid-color: #00bc8c;--bs-form-valid-border-color: #00bc8c;--bs-form-invalid-color: #e74c3c;--bs-form-invalid-border-color: #e74c3c}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color: #dee2e6;--bs-body-color-rgb: 222, 226, 230;--bs-body-bg: #222;--bs-body-bg-rgb: 34, 34, 34;--bs-emphasis-color: #fff;--bs-emphasis-color-rgb: 255, 255, 255;--bs-secondary-color: rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb: 222, 226, 230;--bs-secondary-bg: #343a40;--bs-secondary-bg-rgb: 52, 58, 64;--bs-tertiary-color: rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb: 222, 226, 230;--bs-tertiary-bg: #2b2e31;--bs-tertiary-bg-rgb: 43, 46, 49;--bs-primary-text-emphasis: rgb(135, 156, 178.2);--bs-secondary-text-emphasis: rgb(142.29, 142.29, 142.29);--bs-success-text-emphasis: rgb(102, 214.8, 186);-Line truncated
|
||||||
|
*
|
||||||
|
* ansi colors from IPython notebook's
|
||||||
|
*
|
||||||
|
* we also add `bright-[color]-` synonyms for the `-[color]-intense` classes since
|
||||||
|
* that seems to be what ansi_up emits
|
||||||
|
*
|
||||||
|
*/.ansi-black-fg{color:#3e424d}.ansi-black-bg{background-color:#3e424d}.ansi-black-intense-black,.ansi-bright-black-fg{color:#282c36}.ansi-black-intense-black,.ansi-bright-black-bg{background-color:#282c36}.ansi-red-fg{color:#e75c58}.ansi-red-bg{background-color:#e75c58}.ansi-red-intense-red,.ansi-bright-red-fg{color:#b22b31}.ansi-red-intense-red,.ansi-bright-red-bg{background-color:#b22b31}.ansi-green-fg{color:#00a250}.ansi-green-bg{background-color:#00a250}.ansi-green-intense-green,.ansi-bright-green-fg{color:#007427}.ansi-green-intense-green,.ansi-bright-green-bg{background-color:#007427}.ansi-yellow-fg{color:#ddb62b}.ansi-yellow-bg{background-color:#ddb62b}.ansi-yellow-intense-yellow,.ansi-bright-yellow-fg{color:#b27d12}.ansi-yellow-intense-yellow,.ansi-bright-yellow-bg{background-color:#b27d12}.ansi-blue-fg{color:#208ffb}.ansi-blue-bg{background-color:#208ffb}.ansi-blue-intense-blue,.ansi-bright-blue-fg{color:#0065ca}.ansi-blue-intense-blue,.ansi-bright-blue-bg{background-color:#0065ca}.ansi-magenta-fg{color:#d160c4}.ansi-magenta-bg{background-color:#d160c4}.ansi-magenta-intense-magenta,.ansi-bright-magenta-fg{color:#a03196}.ansi-magenta-intense-magenta,.ansi-bright-magenta-bg{background-color:#a03196}.ansi-cyan-fg{color:#60c6c8}.ansi-cyan-bg{background-color:#60c6c8}.ansi-cyan-intense-cyan,.ansi-bright-cyan-fg{color:#258f8f}.ansi-cyan-intense-cyan,.ansi-bright-cyan-bg{background-color:#258f8f}.ansi-white-fg{color:#c5c1b4}.ansi-white-bg{background-color:#c5c1b4}.ansi-white-intense-white,.ansi-bright-white-fg{color:#a1a6b2}.ansi-white-intense-white,.ansi-bright-white-bg{background-color:#a1a6b2}.ansi-default-inverse-fg{color:#fff}.ansi-default-inverse-bg{background-color:#000}.ansi-bold{font-weight:bold}.ansi-underline{text-decoration:underline}:root{--quarto-body-bg: #222;--quarto-body-color: #fff;--quarto-text-muted: #6c757d;--quarto-border-color: rgb(67.15, 67.15, 67.15);--quarto-border-width: 1px;--quarto-border-radius: 0.25rem}table.gt_table{color:var(--quarto-body-color);font-size:1em;width:100%;background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_column_spanner_outer{color:var(--quarto-body-color);background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_col_heading{color:var(--quarto-body-color);font-weight:bold;background-color:rgba(0,0,0,0)}table.gt_table thead.gt_col_headings{border-bottom:1px solid currentColor;border-top-width:inherit;border-top-color:var(--quarto-border-color)}table.gt_table thead.gt_col_headings:not(:first-child){border-top-width:1px;border-top-color:var(--quarto-border-color)}table.gt_table td.gt_row{border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-width:0px}table.gt_table tbody.gt_table_body{border-top-width:1px;border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-color:currentColor}div.columns{display:initial;gap:initial}div.column{display:inline-block;overflow-x:initial;vertical-align:top;width:50%}.code-annotation-tip-content{word-wrap:break-word}.code-annotation-container-hidden{display:none !important}dl.code-annotation-container-grid{display:grid;grid-template-columns:min-content auto}dl.code-annotation-container-grid dt{grid-column:1}dl.code-annotation-container-grid dd{grid-column:2}pre.sourceCode.code-annotation-code{padding-right:0}code.sourceCode .code-annotation-anchor{z-index:100;position:relative;float:right;background-color:rgba(0,0,0,0)}input[type=checkbox]{margin-right:.5ch}:root{--mermaid-bg-color: #222;--mermaid-edge-color: rgb(67.15, 67.15, 67.15);--mermaid-node-fg-color: #fff;--mermaid-fg-color: #fff;--mermaid-fg-color--lighter: white;--mermaid-fg-color--lightest: white;--mermaid-font-family: IBM Plex Sans, system-ui, -apple-system, sans-serif;--mermaid-label-bg-color: #222;--mermaid-label-fg-color: #375a7f;--mermaid-node-bg-color: rgba(55, 90, 127, 0.1);--mermaid-node-fg-color: #fff}@media print{:root{font-size:11pt}#quarto-sidebar,#TOC,.nav-page{display:none}.page-columns .content{grid-column-start:page-start}.fixed-top{position:relative}.panel-caption,.figure-caption,figcaption{color:#666}}body.quarto-light .dark-content{display:none !important}body.quarto-dark .light-content{display:none !important}.code-copy-button{position:absolute;top:0;right:0;border:0;margin-top:5px;margin-right:5px;background-color:rgba(0,0,0,0);z-index:3}.code-copy-button-tooltip{font-size:.75em}.code-copy-button>.bi::before{display:inline-block;height:1rem;width:1rem;content:"";vertical-align:-0.125em;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(212, 208, 171)" viewBox="0 0 16 16"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9.5 1a.5.5 0 0Line truncated
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
/*!
|
||||||
|
* Bootstrap v5.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2023 The Bootstrap Authors
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
*/@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap";:root,[data-bs-theme=light]{--bs-blue: #2780e3;--bs-indigo: #6610f2;--bs-purple: #613d7c;--bs-pink: #e83e8c;--bs-red: #ff0039;--bs-orange: #f0ad4e;--bs-yellow: #ff7518;--bs-green: #3fb618;--bs-teal: #20c997;--bs-cyan: #9954bb;--bs-black: #000;--bs-white: #fff;--bs-gray: #6c757d;--bs-gray-dark: #343a40;--bs-gray-100: #f8f9fa;--bs-gray-200: #e9ecef;--bs-gray-300: #dee2e6;--bs-gray-400: #ced4da;--bs-gray-500: #adb5bd;--bs-gray-600: #6c757d;--bs-gray-700: #495057;--bs-gray-800: #343a40;--bs-gray-900: #212529;--bs-default: #343a40;--bs-primary: #2780e3;--bs-secondary: #343a40;--bs-success: #3fb618;--bs-info: #9954bb;--bs-warning: #ff7518;--bs-danger: #ff0039;--bs-light: #f8f9fa;--bs-dark: #343a40;--bs-default-rgb: 52, 58, 64;--bs-primary-rgb: 39, 128, 227;--bs-secondary-rgb: 52, 58, 64;--bs-success-rgb: 63, 182, 24;--bs-info-rgb: 153, 84, 187;--bs-warning-rgb: 255, 117, 24;--bs-danger-rgb: 255, 0, 57;--bs-light-rgb: 248, 249, 250;--bs-dark-rgb: 52, 58, 64;--bs-primary-text-emphasis: rgb(15.6, 51.2, 90.8);--bs-secondary-text-emphasis: rgb(20.8, 23.2, 25.6);--bs-success-text-emphasis: rgb(25.2, 72.8, 9.6);--bs-info-text-emphasis: rgb(61.2, 33.6, 74.8);--bs-warning-text-emphasis: rgb(102, 46.8, 9.6);--bs-danger-text-emphasis: rgb(102, 0, 22.8);--bs-light-text-emphasis: #495057;--bs-dark-text-emphasis: #495057;--bs-primary-bg-subtle: rgb(211.8, 229.6, 249.4);--bs-secondary-bg-subtle: rgb(214.4, 215.6, 216.8);--bs-success-bg-subtle: rgb(216.6, 240.4, 208.8);--bs-info-bg-subtle: rgb(234.6, 220.8, 241.4);--bs-warning-bg-subtle: rgb(255, 227.4, 208.8);--bs-danger-bg-subtle: rgb(255, 204, 215.4);--bs-light-bg-subtle: rgb(251.5, 252, 252.5);--bs-dark-bg-subtle: #ced4da;--bs-primary-border-subtle: rgb(168.6, 204.2, 243.8);--bs-secondary-border-subtle: rgb(173.8, 176.2, 178.6);--bs-success-border-subtle: rgb(178.2, 225.8, 162.6);--bs-info-border-subtle: rgb(214.2, 186.6, 227.8);--bs-warning-border-subtle: rgb(255, 199.8, 162.6);--bs-danger-border-subtle: rgb(255, 153, 175.8);--bs-light-border-subtle: #e9ecef;--bs-dark-border-subtle: #adb5bd;--bs-white-rgb: 255, 255, 255;--bs-black-rgb: 0, 0, 0;--bs-font-sans-serif: "IBM Plex Sans", system-ui, -apple-system, sans-serif;--bs-font-monospace: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-root-font-size: 17px;--bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;--bs-body-font-size:1rem;--bs-body-font-weight: 400;--bs-body-line-height: 1.66;--bs-body-color: #343a40;--bs-body-color-rgb: 52, 58, 64;--bs-body-bg: #fff;--bs-body-bg-rgb: 255, 255, 255;--bs-emphasis-color: #000;--bs-emphasis-color-rgb: 0, 0, 0;--bs-secondary-color: rgba(52, 58, 64, 0.75);--bs-secondary-color-rgb: 52, 58, 64;--bs-secondary-bg: #e9ecef;--bs-secondary-bg-rgb: 233, 236, 239;--bs-tertiary-color: rgba(52, 58, 64, 0.5);--bs-tertiary-color-rgb: 52, 58, 64;--bs-tertiary-bg: #f8f9fa;--bs-tertiary-bg-rgb: 248, 249, 250;--bs-heading-color: inherit;--bs-link-color: #2761e3;--bs-link-color-rgb: 39, 97, 227;--bs-link-decoration: underline;--bs-link-hover-color: rgb(31.2, 77.6, 181.6);--bs-link-hover-color-rgb: 31, 78, 182;--bs-code-color: #7d12ba;--bs-highlight-bg: rgb(255, 227.4, 208.8);--bs-border-width: 1px;--bs-border-style: solid;--bs-border-color: #dee2e6;--bs-border-color-translucent: rgba(0, 0, 0, 0.175);--bs-border-radius: 0.25rem;--bs-border-radius-sm: 0.2em;--bs-border-radius-lg: 0.5rem;--bs-border-radius-xl: 1rem;--bs-border-radius-xxl: 2rem;--bs-border-radius-2xl: var(--bs-border-radius-xxl);--bs-border-radius-pill: 50rem;--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width: 0.25rem;--bs-focus-ring-opacity: 0.25;--bs-focus-ring-color: rgba(39, 128, 227, 0.25);--bs-form-valid-color: #3fb618;--bs-form-valid-border-color: #3fb618;--bs-form-invalid-color: #ff0039;--bs-form-invalid-border-color: #ff0039}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color: #dee2e6;--bs-body-color-rgb: 222, 226, 230;--bs-body-bg: #212529;--bs-body-bg-rgb: 33, 37, 41;--bs-emphasis-color: #fff;--bs-emphasis-color-rgb: 255, 255, 255;--bs-secondary-color: rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb: 222, 226, 230;--bs-secondary-bg: #343a40;--bs-secondary-bg-rgb: 52, 58, 64;--bs-tertiary-color: rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb: 222, 226, 230;--bs-tertiary-bg: rgb(42.5, 47.5, 52.5);--bs-tertiary-bg-rgb: 43, 48, 53;--bs-primary-text-emphasis: rgb(125.4, 178.8, 238.2);--bs-secondary-text-emphasis: rgb(133.2, 136.8, 140.4);--bs-success-text-emphasis: rgb(139.8, 211.2, 116.4);--bs-info-text-emphasis: rgb(193.8, 152.Line truncated
|
||||||
|
*
|
||||||
|
* ansi colors from IPython notebook's
|
||||||
|
*
|
||||||
|
* we also add `bright-[color]-` synonyms for the `-[color]-intense` classes since
|
||||||
|
* that seems to be what ansi_up emits
|
||||||
|
*
|
||||||
|
*/.ansi-black-fg{color:#3e424d}.ansi-black-bg{background-color:#3e424d}.ansi-black-intense-black,.ansi-bright-black-fg{color:#282c36}.ansi-black-intense-black,.ansi-bright-black-bg{background-color:#282c36}.ansi-red-fg{color:#e75c58}.ansi-red-bg{background-color:#e75c58}.ansi-red-intense-red,.ansi-bright-red-fg{color:#b22b31}.ansi-red-intense-red,.ansi-bright-red-bg{background-color:#b22b31}.ansi-green-fg{color:#00a250}.ansi-green-bg{background-color:#00a250}.ansi-green-intense-green,.ansi-bright-green-fg{color:#007427}.ansi-green-intense-green,.ansi-bright-green-bg{background-color:#007427}.ansi-yellow-fg{color:#ddb62b}.ansi-yellow-bg{background-color:#ddb62b}.ansi-yellow-intense-yellow,.ansi-bright-yellow-fg{color:#b27d12}.ansi-yellow-intense-yellow,.ansi-bright-yellow-bg{background-color:#b27d12}.ansi-blue-fg{color:#208ffb}.ansi-blue-bg{background-color:#208ffb}.ansi-blue-intense-blue,.ansi-bright-blue-fg{color:#0065ca}.ansi-blue-intense-blue,.ansi-bright-blue-bg{background-color:#0065ca}.ansi-magenta-fg{color:#d160c4}.ansi-magenta-bg{background-color:#d160c4}.ansi-magenta-intense-magenta,.ansi-bright-magenta-fg{color:#a03196}.ansi-magenta-intense-magenta,.ansi-bright-magenta-bg{background-color:#a03196}.ansi-cyan-fg{color:#60c6c8}.ansi-cyan-bg{background-color:#60c6c8}.ansi-cyan-intense-cyan,.ansi-bright-cyan-fg{color:#258f8f}.ansi-cyan-intense-cyan,.ansi-bright-cyan-bg{background-color:#258f8f}.ansi-white-fg{color:#c5c1b4}.ansi-white-bg{background-color:#c5c1b4}.ansi-white-intense-white,.ansi-bright-white-fg{color:#a1a6b2}.ansi-white-intense-white,.ansi-bright-white-bg{background-color:#a1a6b2}.ansi-default-inverse-fg{color:#fff}.ansi-default-inverse-bg{background-color:#000}.ansi-bold{font-weight:bold}.ansi-underline{text-decoration:underline}:root{--quarto-body-bg: #fff;--quarto-body-color: #343a40;--quarto-text-muted: #6c757d;--quarto-border-color: #dee2e6;--quarto-border-width: 1px}table.gt_table{color:var(--quarto-body-color);font-size:1em;width:100%;background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_column_spanner_outer{color:var(--quarto-body-color);background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_col_heading{color:var(--quarto-body-color);font-weight:bold;background-color:rgba(0,0,0,0)}table.gt_table thead.gt_col_headings{border-bottom:1px solid currentColor;border-top-width:inherit;border-top-color:var(--quarto-border-color)}table.gt_table thead.gt_col_headings:not(:first-child){border-top-width:1px;border-top-color:var(--quarto-border-color)}table.gt_table td.gt_row{border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-width:0px}table.gt_table tbody.gt_table_body{border-top-width:1px;border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-color:currentColor}div.columns{display:initial;gap:initial}div.column{display:inline-block;overflow-x:initial;vertical-align:top;width:50%}.code-annotation-tip-content{word-wrap:break-word}.code-annotation-container-hidden{display:none !important}dl.code-annotation-container-grid{display:grid;grid-template-columns:min-content auto}dl.code-annotation-container-grid dt{grid-column:1}dl.code-annotation-container-grid dd{grid-column:2}pre.sourceCode.code-annotation-code{padding-right:0}code.sourceCode .code-annotation-anchor{z-index:100;position:relative;float:right;background-color:rgba(0,0,0,0)}input[type=checkbox]{margin-right:.5ch}:root{--mermaid-bg-color: #fff;--mermaid-edge-color: #343a40;--mermaid-node-fg-color: #343a40;--mermaid-fg-color: #343a40;--mermaid-fg-color--lighter: rgb(74.8620689655, 83.5, 92.1379310345);--mermaid-fg-color--lightest: rgb(97.724137931, 109, 120.275862069);--mermaid-font-family: IBM Plex Sans, system-ui, -apple-system, sans-serif;--mermaid-label-bg-color: #fff;--mermaid-label-fg-color: #2780e3;--mermaid-node-bg-color: rgba(39, 128, 227, 0.1);--mermaid-node-fg-color: #343a40}@media print{:root{font-size:11pt}#quarto-sidebar,#TOC,.nav-page{display:none}.page-columns .content{grid-column-start:page-start}.fixed-top{position:relative}.panel-caption,.figure-caption,figcaption{color:#666}}body.quarto-light .dark-content{display:none !important}body.quarto-dark .light-content{display:none !important}.code-copy-button{position:absolute;top:0;right:0;border:0;margin-top:5px;margin-right:5px;background-color:rgba(0,0,0,0);z-index:3}.code-copy-button-tooltip{font-size:.75em}.code-copy-button>.bi::before{display:inline-block;height:1rem;width:1rem;content:"";vertical-align:-0.125em;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(105, 105, 105)" viewBox="0 0 16 16"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9Line truncated
|
||||||
+2106
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
/*!
|
||||||
|
* Bootstrap v5.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
*/
|
||||||
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";const t=new Map,e={set(e,i,n){t.has(e)||t.set(e,new Map);const s=t.get(e);s.has(i)||0===s.size?s.set(i,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,i)=>t.has(e)&&t.get(e).get(i)||null,remove(e,i){if(!t.has(e))return;const n=t.get(e);n.delete(i),0===n.size&&t.delete(e)}},i="transitionend",n=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,((t,e)=>`#${CSS.escape(e)}`))),t),s=t=>{t.dispatchEvent(new Event(i))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(n(t)):null,a=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},l=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),c=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?c(t.parentNode):null},h=()=>{},d=t=>{t.offsetHeight},u=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,f=[],p=()=>"rtl"===document.documentElement.dir,m=t=>{var e;e=()=>{const e=u();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(f.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of f)t()})),f.push(e)):e()},g=(t,e=[],i=t)=>"function"==typeof t?t(...e):i,_=(t,e,n=!0)=>{if(!n)return void g(t);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let r=!1;const a=({target:n})=>{n===e&&(r=!0,e.removeEventListener(i,a),g(t))};e.addEventListener(i,a),setTimeout((()=>{r||s(e)}),o)},b=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},v=/[^.]*(?=\..*)\.|.*/,y=/\..*/,w=/::\d+$/,A={};let E=1;const T={mouseenter:"mouseover",mouseleave:"mouseout"},C=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function O(t,e){return e&&`${e}::${E++}`||t.uidEvent||E++}function x(t){const e=O(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function k(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function L(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=I(t);return C.has(o)||(o=t),[n,s,o]}function S(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=L(e,i,n);if(e in T){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=x(t),c=l[a]||(l[a]={}),h=k(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=O(r,e.replace(v,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return P(s,{delegateTarget:r}),n.oneOff&&N.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return P(n,{delegateTarget:t}),i.oneOff&&N.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function D(t,e,i,n,s){const o=k(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function $(t,e,i,n){const s=e[i]||{};for(const[o,r]of Object.entries(s))o.includes(n)&&D(t,e,i,r.callable,r.delegationSelector)}function I(t){return t=t.replace(y,""),T[t]||t}const N={on(t,e,i,n){S(t,e,i,n,!1)},one(t,e,i,n){S(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=L(e,i,n),a=r!==e,l=x(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))$(t,l,i,e.slLine truncated
|
||||||
|
//# sourceMappingURL=bootstrap.bundle.min.js.map
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/*!
|
||||||
|
* clipboard.js v2.0.11
|
||||||
|
* https://clipboardjs.com/
|
||||||
|
*
|
||||||
|
* Licensed MIT © Zeno Rocha
|
||||||
|
*/
|
||||||
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=o(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=o(t.value,e):(n=r()(t),c("copy")),n};function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,o=t.container,e=t.target,t=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==e){if(!e||"object"!==l(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return t?f(t,{container:o}):e?"cut"===n?a(e):f(e,{container:o}):void 0};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(n){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=v(n);return t=o?(t=v(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),e=this,!(t=t)||"object"!==p(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){t="data-clipboard-".concat(t);if(e.hasAttribute(t))return e.getAttribute(t)}var b=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(r,i());var t,e,n,o=h(r);function r(t,e){var n;return function(t){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this),(n=o.call(this)).resolveOptions(e),n.listenClick(t),n}return t=r,n=[{key:"copy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(t,e)}},{key:"cut",value:function(t){return a(t)}},{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof t?[t]:t,e=!!document.queryCommandSupported;return t.forEach(function(t){e=e&&!!document.queryCommandSupported(t)}),e}}],(e=[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===p(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=u()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",t=s({action:n,container:thLine truncated
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/* exo — exercise cards, hint folds (sequential unlock), solution fold */
|
||||||
|
|
||||||
|
.exo {
|
||||||
|
margin: 1.2rem 0;
|
||||||
|
padding: 0.6rem 0.9rem;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 35%, transparent);
|
||||||
|
border-left: 3px solid var(--calc-notecolor, #B45309);
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
scroll-margin-top: 5rem;
|
||||||
|
}
|
||||||
|
/* keep wide content inside the card: display math (and tables/code) scroll
|
||||||
|
on their own rather than spilling past the border. overflow-y stays hidden
|
||||||
|
so Firefox doesn't add a phantom vertical bar, as in .calc */
|
||||||
|
.exo mjx-container[display="true"],
|
||||||
|
.exo .katex-display {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 0.35em; /* keep descenders clear of a horizontal bar */
|
||||||
|
/* a centred overflowing box clips its left side out of reach, so centre
|
||||||
|
only while the formula fits (browsers without `safe` keep plain centring) */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
justify-content: safe center;
|
||||||
|
}
|
||||||
|
.exo .math.display { display: block; max-width: 100%; }
|
||||||
|
.exo :is(pre, table) { max-width: 100%; overflow-x: auto; }
|
||||||
|
.exo img, .exo svg { max-width: 100%; }
|
||||||
|
|
||||||
|
.exo-head p { margin: 0 0 0.4rem; }
|
||||||
|
.exo-head strong { color: var(--calc-notecolor, #B45309); }
|
||||||
|
|
||||||
|
.exo details {
|
||||||
|
margin: 0.45rem 0;
|
||||||
|
border-radius: 0.3rem;
|
||||||
|
}
|
||||||
|
.exo details > summary {
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
user-select: none;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.exo details > summary::-webkit-details-marker { display: none; }
|
||||||
|
.exo details > summary::before { content: "▸ "; }
|
||||||
|
.exo details[open] > summary::before { content: "▾ "; }
|
||||||
|
|
||||||
|
/* hints: small highlight boxes */
|
||||||
|
.exo-hint {
|
||||||
|
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 6%, transparent);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 30%, transparent);
|
||||||
|
padding: 0.25rem 0.6rem;
|
||||||
|
}
|
||||||
|
.exo-hint > summary { color: var(--calc-notecolor, #B45309); }
|
||||||
|
|
||||||
|
/* locked hints: unlock one by one */
|
||||||
|
.exo-hint.exo-locked > summary {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
.exo-hint.exo-locked > summary::before { content: "🔒 "; }
|
||||||
|
|
||||||
|
/* solution: closed by default, visually separated */
|
||||||
|
.exo-sol {
|
||||||
|
border-top: 1px dashed color-mix(in srgb, var(--calc-notecolor, #B45309) 40%, transparent);
|
||||||
|
padding: 0.35rem 0.1rem 0.1rem;
|
||||||
|
scroll-margin-top: 5rem;
|
||||||
|
}
|
||||||
|
/* Quarto greys every summary (#6c757d): 3.4:1 on darkly */
|
||||||
|
.exo-sol > summary { color: var(--calc-muted, #57606a); }
|
||||||
|
/* in a numbered part, the fold lines up with the part's text */
|
||||||
|
.exo li > details { margin-left: 0; }
|
||||||
|
|
||||||
|
/* hand-in extracts (handin.sh, html output) */
|
||||||
|
.exo-handin-sol, .exo-handin-hint {
|
||||||
|
margin: 0.6rem 0;
|
||||||
|
padding: 0.2rem 0 0.2rem 0.8rem;
|
||||||
|
border-left: 2px solid var(--calc-notecolor, #B45309);
|
||||||
|
}
|
||||||
|
|
||||||
|
.exo-fold-body { margin-top: 0.3rem; }
|
||||||
|
.exo-fold-body > p:first-child { margin-top: 0; }
|
||||||
|
.exo-fold-body > p:last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.exo details > summary::before { content: ""; }
|
||||||
|
.exo-hint.exo-locked > summary { opacity: 1; cursor: default; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// exo — hints unlock one by one within a part; everything unfolds for printing
|
||||||
|
(function () {
|
||||||
|
// block opening a locked hint
|
||||||
|
document.addEventListener("click", function (e) {
|
||||||
|
var s = e.target.closest ? e.target.closest("details.exo-hint.exo-locked > summary") : null;
|
||||||
|
if (s) e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
// opening hint n of a part unlocks hint n+1 of the same part, wherever it
|
||||||
|
// sits in the exercise (toggle doesn't bubble: use capture)
|
||||||
|
document.addEventListener("toggle", function (e) {
|
||||||
|
var d = e.target;
|
||||||
|
if (!d.classList || !d.classList.contains("exo-hint") || !d.open) return;
|
||||||
|
var chain = d.getAttribute("data-exo-chain");
|
||||||
|
var n = parseInt(d.getAttribute("data-exo-hint"), 10);
|
||||||
|
if (!chain || isNaN(n)) return;
|
||||||
|
var hints = document.querySelectorAll("details.exo-hint[data-exo-chain]");
|
||||||
|
for (var i = 0; i < hints.length; i++) {
|
||||||
|
if (hints[i].getAttribute("data-exo-chain") === chain &&
|
||||||
|
parseInt(hints[i].getAttribute("data-exo-hint"), 10) === n + 1) {
|
||||||
|
hints[i].classList.remove("exo-locked");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
// print: open all hints/solutions, restore afterwards
|
||||||
|
window.addEventListener("beforeprint", function () {
|
||||||
|
document.querySelectorAll(".exo details").forEach(function (d) {
|
||||||
|
d.dataset.exoWasOpen = d.open ? "1" : "0";
|
||||||
|
d.open = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
window.addEventListener("afterprint", function () {
|
||||||
|
document.querySelectorAll(".exo details").forEach(function (d) {
|
||||||
|
d.open = d.dataset.exoWasOpen === "1";
|
||||||
|
delete d.dataset.exoWasOpen;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/* further — "to go further" notes: optional material, set apart in purple */
|
||||||
|
|
||||||
|
.further {
|
||||||
|
margin: 1.1rem 0;
|
||||||
|
padding: 0.5rem 0.9rem 0.6rem;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-furthercolor, #6B3FA0) 30%, transparent);
|
||||||
|
border-left: 3px solid var(--calc-furthercolor, #6B3FA0);
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
background: color-mix(in srgb, var(--calc-furthercolor, #6B3FA0) 4%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.further-head {
|
||||||
|
color: var(--calc-furthercolor, #6B3FA0);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.92em;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.further-body > p:first-child { margin-top: 0; }
|
||||||
|
.further-body > p:last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
/* keep wide content inside the box, as .calc and .exo do */
|
||||||
|
.further mjx-container[display="true"],
|
||||||
|
.further .katex-display {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 0.35em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
justify-content: safe center;
|
||||||
|
}
|
||||||
|
.further :is(pre, table) { max-width: 100%; overflow-x: auto; }
|
||||||
|
.further img, .further svg { max-width: 100%; }
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/* glossary — usages, entries, hover tooltip */
|
||||||
|
|
||||||
|
/* usages: dotted underline, keep math color */
|
||||||
|
a.gls-sym,
|
||||||
|
mjx-container a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.gls-sym {
|
||||||
|
border-bottom: 1px dotted currentColor;
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* rendered glossary list */
|
||||||
|
.glossary .gls-entry {
|
||||||
|
margin: 0.8rem 0;
|
||||||
|
padding: 0.35rem 0.7rem;
|
||||||
|
border-left: 3px solid var(--calc-notecolor, #B45309);
|
||||||
|
scroll-margin-top: 5rem; /* don't hide behind Quarto's sticky header */
|
||||||
|
}
|
||||||
|
.glossary .gls-entry p { margin: 0 0 0.2rem; }
|
||||||
|
.glossary .gls-entry:target {
|
||||||
|
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 10%, transparent);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* floating hover tooltip (filled by glossary.js) */
|
||||||
|
.gls-float {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000;
|
||||||
|
max-width: 26rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
border: 1px solid var(--calc-notecolor, #B45309);
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
background: var(--calc-surface, #fff);
|
||||||
|
color: var(--bs-body-color, #1a1a1a);
|
||||||
|
box-shadow: 0 4px 14px var(--calc-shadow, rgba(0, 0, 0, 0.15));
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.gls-float p { margin: 0 0 0.25rem; }
|
||||||
|
.gls-float p:last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
/* in-place definition cards and property sub-entries */
|
||||||
|
.gls-inline {
|
||||||
|
margin: 1rem 0;
|
||||||
|
padding: 0.4rem 0.8rem;
|
||||||
|
border-left: 3px solid var(--calc-notecolor, #B45309);
|
||||||
|
scroll-margin-top: 5rem;
|
||||||
|
}
|
||||||
|
.gls-inline p { margin: 0 0 0.3rem; }
|
||||||
|
.gls-inline:target,
|
||||||
|
.gls-prop-entry:target {
|
||||||
|
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 10%, transparent);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
.gls-prop-entry {
|
||||||
|
margin: 0.5rem 0 0.5rem 1.2rem;
|
||||||
|
padding: 0.25rem 0.6rem;
|
||||||
|
border-left: 2px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 45%, transparent);
|
||||||
|
font-size: 0.95em;
|
||||||
|
scroll-margin-top: 5rem;
|
||||||
|
}
|
||||||
|
.gls-back {
|
||||||
|
font-size: 0.85em; /* smaller, not fainter: at 0.75 opacity the link read 3.4:1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* standalone property cards keep the section flow (no indent) */
|
||||||
|
.gls-prop-entry.gls-standalone {
|
||||||
|
margin-left: 0;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.glossary .gls-prop-line {
|
||||||
|
margin: 0.1rem 0 0.1rem 1.2rem;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
// glossary — hover tooltip for .gls-sym usages (prose links and MathJax \class nodes)
|
||||||
|
(function () {
|
||||||
|
var tip = null;
|
||||||
|
|
||||||
|
function ensureTip() {
|
||||||
|
if (tip === null) {
|
||||||
|
tip = document.createElement("div");
|
||||||
|
tip.className = "gls-float";
|
||||||
|
tip.style.display = "none";
|
||||||
|
document.body.appendChild(tip);
|
||||||
|
}
|
||||||
|
return tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyOf(el) {
|
||||||
|
if (el.dataset && el.dataset.glsKey) return el.dataset.glsKey;
|
||||||
|
for (var i = 0; i < el.classList.length; i++) {
|
||||||
|
var c = el.classList[i];
|
||||||
|
if (c.indexOf("gls-key-") === 0) return c.slice(8);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(target) {
|
||||||
|
var key = keyOf(target);
|
||||||
|
if (!key) return;
|
||||||
|
var entry = document.getElementById("gls-" + key);
|
||||||
|
var t = ensureTip();
|
||||||
|
if (entry) {
|
||||||
|
// for a main entry, don't drag every property into the popup
|
||||||
|
var node = entry.cloneNode(true);
|
||||||
|
node.querySelectorAll(".gls-prop-entry").forEach(function (n) { n.remove(); });
|
||||||
|
t.innerHTML = node.innerHTML;
|
||||||
|
} else if (window.__glsData && window.__glsData[key]) {
|
||||||
|
// entry lives on another page (book chapters render separately)
|
||||||
|
t.innerHTML = window.__glsData[key];
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.style.display = "block";
|
||||||
|
if (window.MathJax && window.MathJax.typesetPromise) {
|
||||||
|
window.MathJax.typesetPromise([t]).catch(function () {});
|
||||||
|
}
|
||||||
|
var r = target.getBoundingClientRect();
|
||||||
|
var x = r.left + window.scrollX;
|
||||||
|
var y = r.bottom + window.scrollY + 6;
|
||||||
|
// keep it on screen horizontally
|
||||||
|
var w = t.offsetWidth;
|
||||||
|
var maxX = window.scrollX + document.documentElement.clientWidth - w - 12;
|
||||||
|
t.style.left = Math.max(window.scrollX + 8, Math.min(x, maxX)) + "px";
|
||||||
|
t.style.top = y + "px";
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
if (tip !== null) tip.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("mouseover", function (e) {
|
||||||
|
var el = e.target.closest ? e.target.closest(".gls-sym") : null;
|
||||||
|
if (el) show(el);
|
||||||
|
});
|
||||||
|
document.addEventListener("mouseout", function (e) {
|
||||||
|
var el = e.target.closest ? e.target.closest(".gls-sym") : null;
|
||||||
|
if (el) hide();
|
||||||
|
});
|
||||||
|
document.addEventListener("click", hide);
|
||||||
|
window.addEventListener("scroll", hide, { passive: true });
|
||||||
|
})();
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/* history.css -- historical context: a quiet grey box with an italic heading,
|
||||||
|
so it reads as background and not as material to study (the purple
|
||||||
|
.further box is for optional mathematics). Colours are notes tokens only,
|
||||||
|
so light/dark and high contrast follow by themselves. */
|
||||||
|
|
||||||
|
.history {
|
||||||
|
margin: 1.1rem 0;
|
||||||
|
padding: 0.5rem 0.9rem 0.6rem;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-muted, #57606a) 30%, transparent);
|
||||||
|
border-left: 3px double var(--calc-muted, #57606a);
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
background: color-mix(in srgb, var(--calc-muted, #57606a) 5%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-head {
|
||||||
|
color: var(--calc-muted, #57606a);
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.92em;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-body > p:first-child { margin-top: 0; }
|
||||||
|
.history-body > p:last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
/* keep wide content inside the box, as .further does */
|
||||||
|
.history mjx-container[display="true"] {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 0.35em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
justify-content: safe center;
|
||||||
|
}
|
||||||
|
.history :is(pre, table) { max-width: 100%; overflow-x: auto; }
|
||||||
|
.history img, .history svg { max-width: 100%; }
|
||||||
|
|
||||||
|
html.hc .history { border-color: var(--calc-ink, #1a1a1a); }
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/* latex-tables — HTML rendering of LaTeX tabular environments */
|
||||||
|
|
||||||
|
.ltx-table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 1rem auto;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ltx-table th,
|
||||||
|
.ltx-table td {
|
||||||
|
padding: 0.35em 0.7em;
|
||||||
|
vertical-align: top;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ltx-table th {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* alignment */
|
||||||
|
.ltx-l { text-align: left; }
|
||||||
|
.ltx-c { text-align: center; }
|
||||||
|
.ltx-r { text-align: right; }
|
||||||
|
|
||||||
|
/* vertical rules (from | in the column spec) */
|
||||||
|
.ltx-bl { border-left: 1px solid currentColor; }
|
||||||
|
.ltx-br { border-right: 1px solid currentColor; }
|
||||||
|
|
||||||
|
/* horizontal rules: t = above the row, b = below.
|
||||||
|
1 = \hline / \midrule / \cline, 2 = booktabs \toprule / \bottomrule,
|
||||||
|
d = doubled rule (\hline\hline) */
|
||||||
|
.ltx-t1 { border-top: 1px solid currentColor; }
|
||||||
|
.ltx-b1 { border-bottom: 1px solid currentColor; }
|
||||||
|
.ltx-t2 { border-top: 1.6px solid currentColor; }
|
||||||
|
.ltx-b2 { border-bottom: 1.6px solid currentColor; }
|
||||||
|
.ltx-td { border-top: 3px double currentColor; }
|
||||||
|
.ltx-bd { border-bottom: 3px double currentColor; }
|
||||||
|
|
||||||
|
/* keep wide tables usable on narrow screens */
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.ltx-table { font-size: 0.9em; }
|
||||||
|
.ltx-table th, .ltx-table td { padding: 0.25em 0.45em; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/* calc-notes — HTML layout for the calc / calc* environments */
|
||||||
|
|
||||||
|
.calc {
|
||||||
|
display: grid;
|
||||||
|
/* lhs | rhs | notes | equation number */
|
||||||
|
grid-template-columns: max-content max-content minmax(8rem, 1fr) auto;
|
||||||
|
column-gap: 0.35rem;
|
||||||
|
row-gap: 0.6rem;
|
||||||
|
align-items: baseline;
|
||||||
|
margin: 1rem 0 1.4rem;
|
||||||
|
/* allow horizontal scrolling for very wide equations, but never show a
|
||||||
|
vertical bar (Firefox computes phantom vertical overflow otherwise) */
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 0.4em; /* keep descenders clear of a horizontal bar */
|
||||||
|
}
|
||||||
|
|
||||||
|
.calc-row { display: contents; }
|
||||||
|
|
||||||
|
.calc-lhs { grid-column: 1; justify-self: end; }
|
||||||
|
.calc-rhs { grid-column: 2; justify-self: start; }
|
||||||
|
.calc-full { grid-column: 1 / 3; justify-self: start; }
|
||||||
|
|
||||||
|
/* ---- notes ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.calc-notes {
|
||||||
|
grid-column: 3;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.35rem 0.75rem;
|
||||||
|
align-items: baseline;
|
||||||
|
min-width: 0;
|
||||||
|
padding-left: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calc-note {
|
||||||
|
color: var(--calc-notecolor, #B45309);
|
||||||
|
font-size: 0.85em;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calc-note > summary {
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none; /* remove the default triangle ... */
|
||||||
|
user-select: none;
|
||||||
|
font-style: italic; /* quiet by style and --calc-muted (theme.css), not by
|
||||||
|
opacity, which took it under 4.5:1 */
|
||||||
|
}
|
||||||
|
.calc-note > summary::-webkit-details-marker { display: none; }
|
||||||
|
.calc-note > summary::before { content: "▸ "; font-style: normal; }
|
||||||
|
.calc-note[open] > summary::before { content: "▾ "; }
|
||||||
|
.calc-note > summary:hover { opacity: 1; }
|
||||||
|
|
||||||
|
.calc-note[open] {
|
||||||
|
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 8%, transparent);
|
||||||
|
border-left: 2px solid var(--calc-notecolor, #B45309);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.15rem 0.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calc-note-body { margin-top: 0.1rem; }
|
||||||
|
.calc-note-body p { margin: 0; }
|
||||||
|
|
||||||
|
/* \mnote: math note (no extra styling needed — body is typeset math) */
|
||||||
|
.calc-note-math .calc-note-body { padding: 0.1rem 0; }
|
||||||
|
|
||||||
|
/* ---- calc*: boxed final result ----------------------------------- */
|
||||||
|
|
||||||
|
.calc-box {
|
||||||
|
display: inline-block;
|
||||||
|
border: 1.5px solid currentColor;
|
||||||
|
border-radius: 0.3em;
|
||||||
|
padding: 0.3em 0.65em;
|
||||||
|
margin-top: 0.15em;
|
||||||
|
background: color-mix(in srgb, currentColor 4%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- labelled blocks: equation number on the last line ----------- */
|
||||||
|
|
||||||
|
.calc-tag {
|
||||||
|
grid-column: 4;
|
||||||
|
justify-self: end;
|
||||||
|
padding-left: 1rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- printing: show notes unfolded, like the PDF ------------------ */
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.calc-note > summary { display: none; }
|
||||||
|
.calc-note[open] { background: none; border: none; padding: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* small screens: notes drop under the equation line */
|
||||||
|
@media (max-width: 560px) {
|
||||||
|
.calc { grid-template-columns: max-content 1fr; }
|
||||||
|
.calc-notes { grid-column: 1 / 3; padding-left: 1.5rem; }
|
||||||
|
.calc-full { grid-column: 1 / 3; }
|
||||||
|
.calc-tag { grid-column: 1 / -1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- interactive figures ------------------------------------------------
|
||||||
|
A figure that is dragged — a rotatable 3d view, a point moved with the
|
||||||
|
mouse — must not select its own labels while the pointer travels over
|
||||||
|
them: the browser would paint the axis names and captions as selected
|
||||||
|
text. The readouts and captions around the drawing stay selectable, so a
|
||||||
|
value can still be copied. The hooks are the ones every course's figure
|
||||||
|
scripts build into. */
|
||||||
|
[data-notes-fig] svg,
|
||||||
|
[data-notes-plot] svg,
|
||||||
|
[data-notes-fig] canvas,
|
||||||
|
[data-notes-plot] canvas {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// calc-notes — open every note before printing, restore afterwards
|
||||||
|
(function () {
|
||||||
|
window.addEventListener("beforeprint", function () {
|
||||||
|
document.querySelectorAll("details.calc-note").forEach(function (d) {
|
||||||
|
d.dataset.calcWasOpen = d.open ? "1" : "0";
|
||||||
|
d.open = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
window.addEventListener("afterprint", function () {
|
||||||
|
document.querySelectorAll("details.calc-note").forEach(function (d) {
|
||||||
|
d.open = d.dataset.calcWasOpen === "1";
|
||||||
|
delete d.dataset.calcWasOpen;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
// --- high contrast: a switch of its own, beside Quarto's light/dark one ----
|
||||||
|
// The class is already set before the first paint by the script calc-notes.lua
|
||||||
|
// puts in the head; this only builds the control and remembers a choice.
|
||||||
|
// Precedence: what the reader picked here, then `high-contrast: true` in the
|
||||||
|
// book, then the reader's system setting.
|
||||||
|
(function () {
|
||||||
|
var KEY = "notes-contrast";
|
||||||
|
var root = document.documentElement;
|
||||||
|
|
||||||
|
var LABELS = {
|
||||||
|
de: { on: "Hoher Kontrast aus", off: "Hoher Kontrast ein" },
|
||||||
|
fr: { on: "Désactiver le contraste élevé", off: "Activer le contraste élevé" },
|
||||||
|
en: { on: "Turn high contrast off", off: "Turn high contrast on" }
|
||||||
|
};
|
||||||
|
var lang = (root.lang || "en").slice(0, 2).toLowerCase();
|
||||||
|
var L = LABELS[lang] || LABELS.en;
|
||||||
|
|
||||||
|
function store(v) {
|
||||||
|
try { localStorage.setItem(KEY, v ? "more" : "normal"); } catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function paint() {
|
||||||
|
var on = root.classList.contains("hc");
|
||||||
|
document.querySelectorAll(".notes-contrast-toggle").forEach(function (b) {
|
||||||
|
b.setAttribute("aria-pressed", String(on));
|
||||||
|
b.setAttribute("title", on ? L.on : L.off);
|
||||||
|
b.setAttribute("aria-label", on ? L.on : L.off);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
var anchors = document.querySelectorAll(".quarto-color-scheme-toggle");
|
||||||
|
if (anchors.length === 0) return; // a page without Quarto's own tools
|
||||||
|
anchors.forEach(function (a) {
|
||||||
|
var b = document.createElement("button");
|
||||||
|
b.type = "button";
|
||||||
|
b.className = "quarto-navigation-tool px-1 notes-contrast-toggle";
|
||||||
|
// bootstrap-icons ships with these books; the glyph is the fallback
|
||||||
|
b.innerHTML = '<i class="bi bi-circle-half" aria-hidden="true"></i>';
|
||||||
|
b.addEventListener("click", function () {
|
||||||
|
var on = !root.classList.contains("hc");
|
||||||
|
root.classList.toggle("hc", on);
|
||||||
|
store(on);
|
||||||
|
paint();
|
||||||
|
});
|
||||||
|
a.parentNode.insertBefore(b, a.nextSibling);
|
||||||
|
});
|
||||||
|
paint();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === "loading") {
|
||||||
|
document.addEventListener("DOMContentLoaded", build);
|
||||||
|
} else { build(); }
|
||||||
|
})();
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
/* high-contrast.css — the high-contrast pair, taken from GitHub's
|
||||||
|
"GitHub Light High Contrast" and "GitHub Dark High Contrast" VS Code
|
||||||
|
themes (the Primer `light_high_contrast` / `dark_high_contrast` scales).
|
||||||
|
|
||||||
|
It is switched by `hc` on <html>, which calc-notes.lua sets from
|
||||||
|
|
||||||
|
high-contrast: true
|
||||||
|
|
||||||
|
in the document metadata, and which the same in-header script sets for a
|
||||||
|
reader whose system asks for `prefers-contrast: more`. One class rather
|
||||||
|
than a class and a media query, so the palette below is written once.
|
||||||
|
|
||||||
|
It rides on top of the ordinary light/dark pair: `html.hc` restyles the
|
||||||
|
light theme, `html.hc body.quarto-dark` the night one, so the reader's own
|
||||||
|
light/dark toggle keeps working.
|
||||||
|
|
||||||
|
GitHub's two high-contrast themes separate things by outline rather than by
|
||||||
|
fill: text sits at full strength (fg.muted == fg.default), borders are
|
||||||
|
strong, and the tinted panels of the ordinary themes lose their tint. The
|
||||||
|
rules here do the same to the notes environments. */
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------- light -- */
|
||||||
|
html.hc {
|
||||||
|
/* Primer light_high_contrast */
|
||||||
|
--hc-canvas: #ffffff; /* canvas.default */
|
||||||
|
--hc-inset: #ffffff; /* canvas.inset — separation is by border */
|
||||||
|
--hc-fg: #0e1116; /* fg.default, and fg.muted, which equals it */
|
||||||
|
--hc-subtle: #66707b; /* fg.subtle — the only softened ink */
|
||||||
|
--hc-border: #20252c; /* border.default */
|
||||||
|
--hc-border-soft: #88929d; /* border.muted */
|
||||||
|
--hc-accent: #0349b4; /* accent.fg */
|
||||||
|
--hc-danger: #a0111f; /* danger.fg */
|
||||||
|
--hc-success: #055d20; /* success.fg */
|
||||||
|
--hc-attention: #4e2c00; /* attention.fg */
|
||||||
|
--hc-severe: #702c00; /* severe.fg */
|
||||||
|
--hc-done: #622cbc; /* done.fg */
|
||||||
|
|
||||||
|
/* the extension's own tokens */
|
||||||
|
--calc-ink: var(--hc-fg);
|
||||||
|
--calc-muted: var(--hc-fg);
|
||||||
|
--calc-line: var(--hc-border);
|
||||||
|
--calc-grid: var(--hc-border-soft);
|
||||||
|
--calc-accent-a: var(--hc-accent);
|
||||||
|
--calc-accent-b: var(--hc-severe);
|
||||||
|
--calc-accent-c: var(--hc-success);
|
||||||
|
--calc-danger: var(--hc-danger);
|
||||||
|
--calc-surface: var(--hc-canvas);
|
||||||
|
--calc-faint: var(--hc-border-soft);
|
||||||
|
--calc-shadow: rgba(14, 17, 22, 0.4);
|
||||||
|
--calc-domface: var(--hc-canvas);
|
||||||
|
--calc-domtop: #d8dee4;
|
||||||
|
--calc-notecolor: var(--hc-attention);
|
||||||
|
--calc-furthercolor: var(--hc-done);
|
||||||
|
|
||||||
|
/* the page itself */
|
||||||
|
--bs-body-bg: var(--hc-canvas);
|
||||||
|
--bs-body-color: var(--hc-fg);
|
||||||
|
--bs-emphasis-color: var(--hc-fg);
|
||||||
|
--bs-secondary-color: var(--hc-fg);
|
||||||
|
--bs-tertiary-color: var(--hc-subtle);
|
||||||
|
--bs-border-color: var(--hc-border);
|
||||||
|
--bs-link-color: var(--hc-accent);
|
||||||
|
--bs-link-hover-color: var(--hc-accent);
|
||||||
|
--bs-code-color: var(--hc-fg);
|
||||||
|
--bs-heading-color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- dark -- */
|
||||||
|
html.hc body.quarto-dark {
|
||||||
|
/* Primer dark_high_contrast, except for the canvas: the theme's own
|
||||||
|
#0a0c10 still reads as a very dark grey next to a black one, so the page
|
||||||
|
goes fully black and every other value keeps its relation to it. */
|
||||||
|
--hc-canvas: #000000; /* canvas.default is #0a0c10 upstream */
|
||||||
|
--hc-inset: #000000; /* canvas.inset */
|
||||||
|
--hc-subtle-bg: #272b33; /* canvas.subtle */
|
||||||
|
--hc-fg: #f0f3f6; /* fg.default == fg.muted */
|
||||||
|
--hc-subtle: #9ea7b3; /* fg.subtle */
|
||||||
|
--hc-border: #7a828e; /* border.default */
|
||||||
|
--hc-border-soft: #7a828e; /* border.muted — the same in this theme */
|
||||||
|
--hc-accent: #71b7ff; /* accent.fg */
|
||||||
|
--hc-danger: #ff9492; /* danger.fg */
|
||||||
|
--hc-success: #26cd4d; /* success.fg */
|
||||||
|
--hc-attention: #f0b72f; /* attention.fg */
|
||||||
|
--hc-severe: #ff803d; /* severe.fg */
|
||||||
|
--hc-done: #cb9eff; /* done.fg */
|
||||||
|
|
||||||
|
/* a stroke on near-black wants the text colour, not the border grey */
|
||||||
|
--calc-line: var(--hc-fg);
|
||||||
|
--calc-grid: var(--hc-border);
|
||||||
|
--calc-domface: var(--hc-subtle-bg);
|
||||||
|
--calc-domtop: #3d444d;
|
||||||
|
--calc-shadow: rgba(1, 4, 9, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the tokens that only alias, so they follow whichever block is in force */
|
||||||
|
html.hc body.quarto-dark {
|
||||||
|
--calc-ink: var(--hc-fg);
|
||||||
|
--calc-muted: var(--hc-fg);
|
||||||
|
--calc-accent-a: var(--hc-accent);
|
||||||
|
--calc-accent-b: var(--hc-severe);
|
||||||
|
--calc-accent-c: var(--hc-success);
|
||||||
|
--calc-danger: var(--hc-danger);
|
||||||
|
--calc-surface: var(--hc-canvas);
|
||||||
|
--calc-faint: var(--hc-border);
|
||||||
|
--calc-notecolor: var(--hc-attention);
|
||||||
|
--calc-furthercolor: var(--hc-done);
|
||||||
|
|
||||||
|
--bs-body-bg: var(--hc-canvas);
|
||||||
|
--bs-body-color: var(--hc-fg);
|
||||||
|
--bs-emphasis-color: var(--hc-fg);
|
||||||
|
--bs-secondary-color: var(--hc-fg);
|
||||||
|
--bs-tertiary-color: var(--hc-subtle);
|
||||||
|
--bs-border-color: var(--hc-border);
|
||||||
|
--bs-link-color: var(--hc-accent);
|
||||||
|
--bs-link-hover-color: var(--hc-accent);
|
||||||
|
--bs-code-color: var(--hc-fg);
|
||||||
|
--bs-heading-color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------- page chrome -- */
|
||||||
|
/* Quarto's own furniture is compiled from the bootswatch theme, so the
|
||||||
|
variables above do not reach all of it. */
|
||||||
|
html.hc body {
|
||||||
|
background-color: var(--hc-canvas);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :is(h1, h2, h3, h4, h5, h6, p, li, dt, dd, caption, figcaption, th, td) {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :is(.text-muted, .quarto-figure figcaption, figcaption.figure-caption,
|
||||||
|
.quarto-title-meta-heading, .quarto-title-meta-contents,
|
||||||
|
.callout-title-container, .footnotes) {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc a:not(.nav-link):not(.sidebar-item-text) { color: var(--hc-accent); }
|
||||||
|
html.hc a:focus-visible,
|
||||||
|
html.hc button:focus-visible,
|
||||||
|
html.hc summary:focus-visible { outline: 2px solid var(--hc-accent); outline-offset: 2px; }
|
||||||
|
|
||||||
|
html.hc :is(#quarto-sidebar, #quarto-margin-sidebar, .sidebar, .sidebar-navigation,
|
||||||
|
#quarto-header, .navbar, .quarto-secondary-nav) {
|
||||||
|
background-color: var(--hc-canvas);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
border-color: var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc :is(.sidebar-item-text, .sidebar .nav-link, nav[role="doc-toc"] a, .navbar .nav-link,
|
||||||
|
.quarto-secondary-nav .nav-link) {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
html.hc .sidebar nav[role="doc-toc"] ul > li > a,
|
||||||
|
html.hc .sidebar-navigation .sidebar-item a,
|
||||||
|
html.hc .sidebar-navigation .sidebar-item .sidebar-item-text {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
/* the active entry: Quarto writes its colour with !important, so this is the
|
||||||
|
one place the palette has to answer in kind */
|
||||||
|
html.hc .sidebar nav[role="doc-toc"] ul > li > a.active,
|
||||||
|
html.hc .sidebar nav[role="doc-toc"] ul > li > ul > li > a.active,
|
||||||
|
html.hc .sidebar nav[role="doc-toc"] ul > li > a:hover,
|
||||||
|
html.hc .sidebar-navigation .sidebar-item a.active,
|
||||||
|
html.hc .sidebar-navigation .sidebar-item a:hover {
|
||||||
|
color: var(--hc-accent) !important;
|
||||||
|
border-left-color: var(--hc-accent);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
html.hc nav[role="doc-toc"] { border-left: 1px solid var(--hc-border-soft); }
|
||||||
|
/* the breadcrumb of the collapsed header carries its own fill in both
|
||||||
|
bootswatch themes, and its ink is the weakest contrast on the page */
|
||||||
|
html.hc .breadcrumb {
|
||||||
|
background-color: var(--hc-canvas);
|
||||||
|
border: 1px solid var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc :is(.breadcrumb, .breadcrumb-item, .breadcrumb-item a, .quarto-btn-toggle) {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc .breadcrumb-item a { color: var(--hc-accent); }
|
||||||
|
html.hc :is(hr, .quarto-title-block .quarto-title-banner, header#title-block-header) {
|
||||||
|
border-color: var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc hr { background-color: var(--hc-border); opacity: 1; }
|
||||||
|
html.hc blockquote {
|
||||||
|
border-left: 4px solid var(--hc-border);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :is(table, th, td) { border-color: var(--hc-border-soft); }
|
||||||
|
html.hc thead { border-bottom: 2px solid var(--hc-border); }
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------- code ----- */
|
||||||
|
/* GitHub's high-contrast themes give a block an outline instead of a fill. */
|
||||||
|
html.hc :is(pre, div.sourceCode, pre.sourceCode) {
|
||||||
|
background-color: var(--hc-inset);
|
||||||
|
border: 1px solid var(--hc-border);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :not(pre) > code {
|
||||||
|
background-color: var(--hc-inset);
|
||||||
|
border: 1px solid var(--hc-border-soft);
|
||||||
|
border-radius: 3px;
|
||||||
|
color: var(--hc-fg);
|
||||||
|
padding: 0 0.2em;
|
||||||
|
}
|
||||||
|
html.hc code { color: var(--hc-fg); }
|
||||||
|
|
||||||
|
/* the syntax palette of the same two themes, mapped onto pandoc's classes */
|
||||||
|
html.hc code span:is(.co, .cv, .do, .an, .in) { color: var(--hc-subtle); font-style: italic; }
|
||||||
|
html.hc code span:is(.kw, .cf) { color: var(--hc-danger); }
|
||||||
|
html.hc code span:is(.st, .ch, .sc, .ss, .vs){ color: #032563; }
|
||||||
|
html.hc code span:is(.dv, .bn, .fl, .cn) { color: #023b95; }
|
||||||
|
html.hc code span:is(.fu, .ex) { color: #512598; }
|
||||||
|
html.hc code span:is(.va, .at) { color: var(--hc-severe); }
|
||||||
|
html.hc code span:is(.dt, .bu) { color: var(--hc-success); }
|
||||||
|
html.hc code span:is(.im, .pp) { color: var(--hc-severe); }
|
||||||
|
html.hc code span:is(.er, .wa, .al) { color: var(--hc-danger); font-weight: 600; }
|
||||||
|
html.hc code span:is(.op, .ot) { color: var(--hc-fg); }
|
||||||
|
|
||||||
|
html.hc body.quarto-dark code span:is(.st, .ch, .sc, .ss, .vs) { color: #addcff; }
|
||||||
|
html.hc body.quarto-dark code span:is(.dv, .bn, .fl, .cn) { color: #91cbff; }
|
||||||
|
html.hc body.quarto-dark code span:is(.fu, .ex) { color: #dbb7ff; }
|
||||||
|
html.hc body.quarto-dark code span:is(.co, .cv, .do, .an, .in) { color: #bdc4cc; }
|
||||||
|
|
||||||
|
/* ------------------------------------------- the notes environments ----- */
|
||||||
|
/* out goes the tint; the outline carries the box, at full accent strength */
|
||||||
|
html.hc :is(.exo, .further, .quiz, .gls-inline, .gls-float, .calc-note,
|
||||||
|
.exo-sol, .exo-hint, .quiz-opt) {
|
||||||
|
background: var(--hc-canvas);
|
||||||
|
}
|
||||||
|
html.hc .exo { border-color: var(--calc-notecolor); }
|
||||||
|
html.hc :is(.exo-sol, .exo-hint) { border-color: var(--calc-notecolor); }
|
||||||
|
html.hc .exo-head strong,
|
||||||
|
html.hc .exo-hint > summary { color: var(--calc-notecolor); }
|
||||||
|
html.hc .further { border-color: var(--calc-furthercolor); }
|
||||||
|
html.hc .gls-float { border-color: var(--calc-notecolor); box-shadow: 0 4px 14px var(--calc-shadow); }
|
||||||
|
html.hc :is(.gls-inline, .calc-note) { border-left-width: 4px; }
|
||||||
|
html.hc .gls-sym { text-decoration-color: var(--calc-notecolor); }
|
||||||
|
html.hc .quiz { --quiz-ok: var(--hc-success); --quiz-bad: var(--hc-danger); --quiz-ink: var(--hc-fg); }
|
||||||
|
html.hc :is(.quiz-opt.quiz-ok, .quiz-opt.quiz-bad) { background: var(--hc-canvas); }
|
||||||
|
html.hc .quiz-opt.quiz-ok { outline: 2px solid var(--hc-success); }
|
||||||
|
html.hc .quiz-opt.quiz-bad { outline: 2px solid var(--hc-danger); }
|
||||||
|
|
||||||
|
/* Quarto's own callouts, so a page does not mix outlined boxes with filled
|
||||||
|
ones; the callout keeps its colour, in its left bar and its title */
|
||||||
|
html.hc .callout {
|
||||||
|
background-color: var(--hc-canvas) !important;
|
||||||
|
border: 1px solid var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc .callout > .callout-header {
|
||||||
|
background-color: var(--hc-canvas) !important;
|
||||||
|
border-bottom: 1px solid var(--hc-border-soft);
|
||||||
|
}
|
||||||
|
html.hc :is(.callout-body, .callout-title-container, .callout-body-container p) {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc .callout.callout-style-default > div.callout-header { font-weight: 600; }
|
||||||
|
|
||||||
|
/* Quarto's search box: its widget is not themed by the bootswatch pair, so it
|
||||||
|
stays white on a dark page unless it is told otherwise (see theme.css) */
|
||||||
|
html.hc :is(.aa-Form, .aa-InputWrapper, .aa-Panel, .aa-Item) {
|
||||||
|
background-color: var(--hc-canvas);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
border-color: var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapper .aa-Input,
|
||||||
|
html.hc :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapperSuffix .aa-ClearButton,
|
||||||
|
html.hc :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapperPrefix :is(.aa-Label, .aa-LoadingIndicator) svg {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapper .aa-Input::placeholder {
|
||||||
|
color: var(--hc-fg);
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the results panel: Quarto colours the cards through an id, so this does too */
|
||||||
|
html.hc :is(.aa-DetachedOverlay, #quarto-search-results) li.aa-Item .search-item,
|
||||||
|
html.hc :is(.aa-DetachedOverlay, #quarto-search-results) li.aa-Item .search-item
|
||||||
|
:is(.search-result-title-container, .search-result-text-container,
|
||||||
|
.search-result-section, .search-result-text, .search-result-more) {
|
||||||
|
background-color: var(--hc-canvas);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
}
|
||||||
|
html.hc :is(.aa-DetachedOverlay, #quarto-search-results) li.aa-Item[aria-selected="true"] .search-item,
|
||||||
|
html.hc :is(.aa-DetachedOverlay, #quarto-search-results) li.aa-Item[aria-selected="true"] .search-item
|
||||||
|
:is(.search-result-title-container, .search-result-text-container,
|
||||||
|
.search-result-section, .search-result-text, .search-result-more) {
|
||||||
|
background-color: var(--hc-accent);
|
||||||
|
color: var(--hc-canvas);
|
||||||
|
}
|
||||||
|
/* a hit is marked by weight and a rule, not by a block of colour */
|
||||||
|
html.hc :is(.aa-DetachedOverlay, #quarto-search-results) li.aa-Item .search-item
|
||||||
|
:is(mark.search-match, .search-match.mark) {
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the figure buttons of the animated schemes */
|
||||||
|
html.hc :is(.ns-btn, .nc-btn, .nd-replay) {
|
||||||
|
background: var(--hc-canvas);
|
||||||
|
color: var(--hc-fg);
|
||||||
|
border-color: var(--hc-border);
|
||||||
|
}
|
||||||
|
html.hc :is(.notes-spiral, .notes-cantor) :is(.ns-btn, .nc-btn)[aria-pressed="true"] {
|
||||||
|
background: var(--hc-canvas);
|
||||||
|
border-color: var(--hc-accent);
|
||||||
|
color: var(--hc-accent);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the last tinted fills: a calc box and a note keep their outline instead */
|
||||||
|
html.hc :is(.calc-box, .calc-note, .calc-note[open]) { background: transparent; }
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/* narrow.css — the book on a phone.
|
||||||
|
Nothing in the flow may be wider than the screen: a wide formula, table or
|
||||||
|
figure scrolls inside its own box instead of pushing the whole page
|
||||||
|
sideways (which leaves the text cut off at the left edge).
|
||||||
|
Loaded with calc-notes.css, so every page of every book gets it. */
|
||||||
|
|
||||||
|
/* --- display maths ------------------------------------------------------
|
||||||
|
The boxes of this extension (.calc, .exo, .further) already scroll their
|
||||||
|
own maths; this covers every other display formula on the page. */
|
||||||
|
:is(main, .quarto-title-block) :is(mjx-container[display="true"], .math.display) {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden; /* Firefox computes phantom vertical overflow */
|
||||||
|
padding-bottom: 0.35em; /* keep descenders clear of a scrollbar */
|
||||||
|
/* a centred formula that overflows would hide its left side out of reach,
|
||||||
|
so centre it only while it fits */
|
||||||
|
justify-content: safe center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- everything else that can be wider than a phone ---------------------- */
|
||||||
|
main :is(pre, .sourceCode) { max-width: 100%; overflow-x: auto; }
|
||||||
|
main :is(img, svg) { max-width: 100%; height: auto; }
|
||||||
|
main table:not(.ltx-table) { display: block; max-width: 100%; overflow-x: auto; }
|
||||||
|
|
||||||
|
/* the animated figures of lesson-style chapters */
|
||||||
|
.notes-cantor, .notes-spiral, .notes-dominos { max-width: 100%; overflow-x: auto; }
|
||||||
|
|
||||||
|
/* the glossary popup: never wider than the screen */
|
||||||
|
.gls-float { max-width: min(92vw, 26rem); }
|
||||||
|
|
||||||
|
/* --- phone-sized screens ------------------------------------------------- */
|
||||||
|
@media (max-width: 575.98px) {
|
||||||
|
/* the equation number of a labelled calc block goes under the line, so the
|
||||||
|
formula keeps the full width */
|
||||||
|
.calc { grid-template-columns: max-content 1fr; }
|
||||||
|
|
||||||
|
/* figure captions and the fold summaries read better tight */
|
||||||
|
.exo, .further { padding-left: 0.6rem; padding-right: 0.6rem; }
|
||||||
|
|
||||||
|
/* A bare url in prose, or a long identifier in a code span, is one word to
|
||||||
|
the line breaker and paints past its block on a narrow screen — no
|
||||||
|
element is oversized, so only the text itself overflows. */
|
||||||
|
#quarto-document-content :is(a, code) { overflow-wrap: break-word; }
|
||||||
|
|
||||||
|
/* Quarto lets inline code wrap only inside a <p> (white-space: pre-wrap);
|
||||||
|
in a list item or a table it keeps one line, and a formula such as
|
||||||
|
"{PersN} → {PersN, Name, Position, Room, …}" pushed a page to 947px. */
|
||||||
|
#quarto-document-content :not(pre) > code:not(.sourceCode) { white-space: pre-wrap; }
|
||||||
|
|
||||||
|
/* A long compound in running text — "Unternehmensarchitekturmanagement" in
|
||||||
|
a list item is 348px — has no break opportunity. The page's lang picks
|
||||||
|
the hyphenation dictionary; overflow-wrap is the fallback without one. */
|
||||||
|
#quarto-document-content { hyphens: auto; overflow-wrap: break-word; }
|
||||||
|
|
||||||
|
/* An inline formula MathJax cannot break (one long fraction or product)
|
||||||
|
is wider than a phone: 413px in ModernPhysics' first exercise. It scrolls
|
||||||
|
inside its own box instead of pushing the page; the padding keeps tall
|
||||||
|
glyphs clear of the box's edge. */
|
||||||
|
/* A Bootstrap grid (::: {.grid} with .g-col-* items) has 12 columns and 11
|
||||||
|
gaps of 1.5rem: 264px of gaps alone, more than a callout on a phone
|
||||||
|
(248px in SoftwareEngineering's git appendix), so the columns collapse to
|
||||||
|
0 and a full-width item overflows. A smaller gap keeps the layout;
|
||||||
|
min-width: 0 lets an item's text wrap instead of widening its track. */
|
||||||
|
.grid { --bs-gap: 0.75rem; }
|
||||||
|
.grid > [class*="g-col"] { min-width: 0; }
|
||||||
|
|
||||||
|
#quarto-document-content mjx-container:not([display="true"]) {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-block: 0.15em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quarto's own previous/next footer: the chapter titles are laid out in a
|
||||||
|
row that will not shrink, so a long title pushes the page sideways. */
|
||||||
|
.page-navigation { flex-wrap: wrap; row-gap: 0.75em; }
|
||||||
|
.nav-page, .nav-page .nav-page-text { min-width: 0; }
|
||||||
|
.nav-page .chapter-title { overflow-wrap: break-word; }
|
||||||
|
|
||||||
|
/* A long compound in a heading — "Implementierungsentscheidungen" is 366px
|
||||||
|
at h3 size — is wider than a 320px screen. The page's lang picks the
|
||||||
|
hyphenation dictionary; overflow-wrap is the fallback without one. */
|
||||||
|
#quarto-document-content :is(h1, h2, h3, h4, h5, h6),
|
||||||
|
.quarto-title .title {
|
||||||
|
hyphens: auto;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The bar at the top of a phone page: menu button, the chapter's title,
|
||||||
|
search. The title is a flex item that will not shrink, so a long one
|
||||||
|
("3 Komplexitätsanalyse" in darkly's wider font) pushes the search button
|
||||||
|
off the screen. It now shrinks and ends in an ellipsis. */
|
||||||
|
.quarto-secondary-nav nav.quarto-page-breadcrumbs { min-width: 0; }
|
||||||
|
.quarto-secondary-nav nav.quarto-page-breadcrumbs .breadcrumb {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.quarto-secondary-nav nav.quarto-page-breadcrumbs .breadcrumb-item {
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
/* theme.css — one palette for every part of the notes extension, in light
|
||||||
|
mode, in night mode and in high contrast.
|
||||||
|
|
||||||
|
Night mode keys off Quarto's own `body.quarto-dark`, which the light/dark
|
||||||
|
toggle sets — never off `prefers-color-scheme`, so a book configured
|
||||||
|
light-only stays light for a reader whose system is dark.
|
||||||
|
A book opts in with, in _quarto.yml:
|
||||||
|
format:
|
||||||
|
html:
|
||||||
|
theme:
|
||||||
|
light: [cosmo]
|
||||||
|
dark: [darkly]
|
||||||
|
|
||||||
|
High contrast is a separate sheet, high-contrast.css, after GitHub's two
|
||||||
|
high-contrast VS Code themes. It keys off `hc` on <html>, which
|
||||||
|
calc-notes.lua sets from `high-contrast: true` in the metadata and for a
|
||||||
|
reader whose system asks for `prefers-contrast: more`.
|
||||||
|
|
||||||
|
Loaded with calc-notes.css, so every page of every book has these tokens. */
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--calc-ink: #1a1a1a; /* figure text, strong strokes */
|
||||||
|
--calc-muted: #57606a; /* captions, readouts, button text */
|
||||||
|
--calc-line: #444444; /* axes and rules */
|
||||||
|
--calc-grid: #cccccc; /* lattice dots, faint grid */
|
||||||
|
--calc-accent-a: #1F6FB4; /* lineA of the tikz preamble */
|
||||||
|
--calc-accent-b: #D1541F; /* lineB */
|
||||||
|
--calc-accent-c: #2E8B57; /* lineC */
|
||||||
|
--calc-danger: #B91C1C; /* an error state, e.g. a failed code run */
|
||||||
|
--calc-surface: var(--bs-body-bg, #ffffff);
|
||||||
|
--calc-faint: #e7e9ec; /* hairlines between rows */
|
||||||
|
--calc-shadow: rgba(0, 0, 0, 0.15); /* floats above the page */
|
||||||
|
--calc-domface: #DCE7F2; /* the domino figure's front face */
|
||||||
|
--calc-domtop: #B8CFE4; /* its top face */
|
||||||
|
/* --calc-notecolor-src and --calc-furthercolor-src come from the document
|
||||||
|
metadata (calc-notes.lua / further.lua) and are the book's own colours;
|
||||||
|
--calc-notecolor and --calc-furthercolor are what everything draws with,
|
||||||
|
and equal the source here. The dark block lifts them. */
|
||||||
|
}
|
||||||
|
|
||||||
|
body.quarto-dark {
|
||||||
|
--calc-ink: #e6e9ed;
|
||||||
|
--calc-muted: #9aa4b2;
|
||||||
|
--calc-line: #b6bec7;
|
||||||
|
--calc-grid: #4b535d;
|
||||||
|
--calc-accent-a: #6fb0ea;
|
||||||
|
--calc-accent-b: #f0956a;
|
||||||
|
--calc-accent-c: #64c49a;
|
||||||
|
--calc-danger: #f08a8a;
|
||||||
|
--calc-faint: #3a4049;
|
||||||
|
--calc-shadow: rgba(0, 0, 0, 0.55);
|
||||||
|
--calc-domface: #2b3b4d;
|
||||||
|
--calc-domtop: #365070;
|
||||||
|
/* The book's own accent is kept, not replaced: its print value is too dim
|
||||||
|
on a dark ground, so it is lifted to a light tone at the same hue rather
|
||||||
|
than swapped for a generic amber. A book that wants a specific night
|
||||||
|
value sets `notecolor-dark:` / `furthercolor-dark:` in its metadata.
|
||||||
|
On a browser without relative colour syntax the lift is dropped and the
|
||||||
|
book's own colour is used unchanged. */
|
||||||
|
--calc-notecolor:
|
||||||
|
var(--calc-notecolor-dark,
|
||||||
|
oklch(from var(--calc-notecolor-src, #B45309) 0.78 c h));
|
||||||
|
--calc-furthercolor:
|
||||||
|
var(--calc-furthercolor-dark,
|
||||||
|
oklch(from var(--calc-furthercolor-src, #6B3FA0) 0.80 c h));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- generated line art -------------------------------------------------
|
||||||
|
The tikz figures are black-and-colour line drawings on transparent white.
|
||||||
|
Inverting them keeps the drawing readable and, with the hue rotation,
|
||||||
|
keeps blue blue and orange orange. Photographs live under img/ and are
|
||||||
|
left alone; an svg that is a photograph, or that carries its own dark
|
||||||
|
palette, opts out with class="no-invert". */
|
||||||
|
body.quarto-dark main img[src$=".svg"]:not(.no-invert) {
|
||||||
|
filter: invert(1) hue-rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- captions -----------------------------------------------------------
|
||||||
|
Quarto's caption grey reads 4.4:1 on cosmo's white, under WCAG AA. The
|
||||||
|
muted token reads about 6.4:1 in light and in dark, and high contrast
|
||||||
|
makes it the foreground. The list ends with Quarto's most specific caption
|
||||||
|
selector so that :is() gives every entry its weight. */
|
||||||
|
:is(.panel-caption, .figure-caption, .subfigure-caption, .table-caption,
|
||||||
|
figcaption, caption, .margin-caption, .column-margin figcaption,
|
||||||
|
.quarto-layout-cell[data-ref-parent] caption) {
|
||||||
|
color: var(--calc-muted, #57606a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- breadcrumbs --------------------------------------------------------
|
||||||
|
Quarto greys the current page (#6c757d) and Bootstrap the separators; on
|
||||||
|
darkly's breadcrumb band that reads 2.1:1. The ink token passes in every
|
||||||
|
mode. `body` outweighs Quarto's own selectors; pseudo-elements cannot go
|
||||||
|
inside :is(), hence the separate rule. */
|
||||||
|
body :is(.quarto-title-breadcrumbs .breadcrumb li:last-of-type a,
|
||||||
|
.breadcrumb-item.active) {
|
||||||
|
color: var(--calc-ink, #1a1a1a);
|
||||||
|
}
|
||||||
|
body .breadcrumb-item + .breadcrumb-item::before,
|
||||||
|
body .quarto-secondary-nav nav.quarto-page-breadcrumbs .breadcrumb-item::before,
|
||||||
|
body .quarto-secondary-nav nav.quarto-page-breadcrumbs a {
|
||||||
|
color: var(--calc-ink, #1a1a1a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Quarto's other greys -----------------------------------------------
|
||||||
|
Quarto hard-codes #6c757d for every fold label (details > summary) and for
|
||||||
|
the previous/next page links, and a mid grey for section numbers: 3.4:1 on
|
||||||
|
darkly, 4.4:1 on cosmo. The muted token reads about 6.4:1 in both, and
|
||||||
|
high contrast makes it the foreground. An exercise hint keeps its accent
|
||||||
|
(.exo-hint > summary outweighs these), and the active entry of the
|
||||||
|
contents still inherits its colour. */
|
||||||
|
body details > summary,
|
||||||
|
body .nav-page a,
|
||||||
|
body .header-section-number {
|
||||||
|
color: var(--calc-muted, #57606a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quoted text: Quarto's .blockquote grey is 4.4:1 on cosmo, and it names the
|
||||||
|
paragraphs, so they are named here too. */
|
||||||
|
body :is(blockquote, .blockquote, blockquote p, .blockquote p) {
|
||||||
|
color: var(--calc-muted, #57606a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Inline code: Bootstrap's pill is #f8f9fa in both themes, so darkly's light
|
||||||
|
code text sat on near-white (1.05:1). The pill is now a faint tint of the
|
||||||
|
page, which keeps each theme's code colour readable, and inherited muted
|
||||||
|
text (code in a caption) too. */
|
||||||
|
body :not(pre) > code:not(.sourceCode) {
|
||||||
|
background-color: color-mix(in srgb, var(--calc-faint, #e7e9ec) 60%,
|
||||||
|
var(--calc-surface, #ffffff));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A code block inside a tinted box (exercise, hint, solution, "to go
|
||||||
|
further", quiz): Quarto's block ground is 65% opaque, so the tint shows
|
||||||
|
through and a11y-light's keyword red drops to 4.4:1. Here the ground is
|
||||||
|
opaque, and the same light grey as on the page. */
|
||||||
|
body :is(.exo, .exo-hint, .exo-sol, .further, .quiz) div.sourceCode {
|
||||||
|
background-color: color-mix(in srgb, var(--calc-faint, #e7e9ec) 45%,
|
||||||
|
var(--calc-surface, #ffffff));
|
||||||
|
}
|
||||||
|
/* A static (not executed) block also gives its <code> the translucent
|
||||||
|
ground, so the two layers stack and darken it. The block carries the
|
||||||
|
ground; the code inside is transparent, as in an executed cell. */
|
||||||
|
body div.sourceCode > pre > code.sourceCode { background-color: transparent; }
|
||||||
|
|
||||||
|
/* --- Jupyter output: ANSI colours ---------------------------------------
|
||||||
|
A traceback comes out in the notebook's terminal palette, made for a dark
|
||||||
|
terminal: yellow is 1.9:1 and cyan 2.0:1 on the page. Each colour name
|
||||||
|
takes the matching token with a fifth of ink, which keeps the hue and passes
|
||||||
|
in all four modes. IPython's 256-colour spans carry inline styles and no
|
||||||
|
name, so they take the text colour. */
|
||||||
|
body :is(.ansi-black-fg, .ansi-bright-black-fg) { color: var(--calc-ink); }
|
||||||
|
body :is(.ansi-white-fg, .ansi-bright-white-fg) { color: var(--calc-muted); }
|
||||||
|
body :is(.ansi-red-fg, .ansi-bright-red-fg) {
|
||||||
|
color: color-mix(in srgb, var(--calc-danger) 85%, var(--calc-ink));
|
||||||
|
}
|
||||||
|
body :is(.ansi-green-fg, .ansi-bright-green-fg) {
|
||||||
|
color: color-mix(in srgb, var(--calc-accent-c) 75%, var(--calc-ink));
|
||||||
|
}
|
||||||
|
body :is(.ansi-yellow-fg, .ansi-bright-yellow-fg) {
|
||||||
|
color: color-mix(in srgb, var(--calc-accent-b) 75%, var(--calc-ink));
|
||||||
|
}
|
||||||
|
body :is(.ansi-blue-fg, .ansi-bright-blue-fg) {
|
||||||
|
color: color-mix(in srgb, var(--calc-accent-a) 80%, var(--calc-ink));
|
||||||
|
}
|
||||||
|
body :is(.ansi-magenta-fg, .ansi-bright-magenta-fg) {
|
||||||
|
color: color-mix(in srgb, var(--calc-furthercolor) 85%, var(--calc-ink));
|
||||||
|
}
|
||||||
|
body :is(.ansi-cyan-fg, .ansi-bright-cyan-fg) {
|
||||||
|
color: color-mix(in srgb,
|
||||||
|
color-mix(in srgb, var(--calc-accent-a) 50%, var(--calc-accent-c)) 75%,
|
||||||
|
var(--calc-ink));
|
||||||
|
}
|
||||||
|
body .ansi-escaped-output span[style*="color"] { color: inherit !important; }
|
||||||
|
|
||||||
|
/* --- higher contrast ---------------------------------------------------
|
||||||
|
The high-contrast pair lives in high-contrast.css, which is loaded with
|
||||||
|
this file and keys off `hc` on <html>. */
|
||||||
|
|
||||||
|
/* --- Quarto's search box -------------------------------------------------
|
||||||
|
The search widget keeps its own white surface whatever the bootswatch
|
||||||
|
theme says, so on a dark page it is a white slab with dark text. It is
|
||||||
|
given the page's own surface here rather than in each book. */
|
||||||
|
body.quarto-dark :is(.aa-Form, .aa-InputWrapper, .aa-Panel, .aa-Item,
|
||||||
|
.aa-DetachedContainer, .aa-DetachedFormContainer) {
|
||||||
|
background-color: var(--calc-surface, #222);
|
||||||
|
color: var(--calc-ink, #e6e9ed);
|
||||||
|
border-color: var(--calc-faint, #3a4049);
|
||||||
|
}
|
||||||
|
/* The ink inside the form is a separate problem from its surface: Quarto's
|
||||||
|
dark bundle sets the input, its placeholder, the clear button and the
|
||||||
|
magnifier to rgb(45,45,45) through a four-class selector, so a short one
|
||||||
|
loses the cascade and the typed text stays unreadable. The shape below
|
||||||
|
matches Quarto's own, which is the only way to win without !important. */
|
||||||
|
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapper .aa-Input,
|
||||||
|
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapperSuffix .aa-ClearButton,
|
||||||
|
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapperPrefix :is(.aa-Label, .aa-LoadingIndicator) svg {
|
||||||
|
color: var(--calc-ink, #e6e9ed);
|
||||||
|
}
|
||||||
|
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
|
||||||
|
.aa-Form .aa-InputWrapper .aa-Input::placeholder {
|
||||||
|
color: var(--calc-muted, #9aa4b2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- search: the selected result ----------------------------------------
|
||||||
|
Quarto marks it with cosmo's primary (#2780e3) under white text, 3.97:1,
|
||||||
|
and its matched words with a lighter blue, worse still. The same hue at a
|
||||||
|
lower lightness passes. Night mode (darkly's #375a7f, 7.2:1) and high
|
||||||
|
contrast (high-contrast.css) keep their own. */
|
||||||
|
html:not(.hc) body:not(.quarto-dark) :is(.aa-DetachedOverlay, #quarto-search-results)
|
||||||
|
li.aa-Item[aria-selected="true"] :is(.search-item, .search-item *:not(mark, .mark)) {
|
||||||
|
background-color: oklch(from var(--bs-primary, #2780e3) 0.42 c h);
|
||||||
|
}
|
||||||
|
html:not(.hc) body:not(.quarto-dark) :is(.aa-DetachedOverlay, #quarto-search-results)
|
||||||
|
li.aa-Item[aria-selected="true"] .search-item :is(mark.search-match, .search-match.mark) {
|
||||||
|
background-color: oklch(from var(--bs-primary, #2780e3) 0.52 c h);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- the high-contrast switch -------------------------------------------
|
||||||
|
Built by calc-notes.js next to Quarto's light/dark toggle, and styled to
|
||||||
|
sit with it rather than stand out. */
|
||||||
|
.notes-contrast-toggle {
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
color: inherit;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
.notes-contrast-toggle:hover { opacity: 1; }
|
||||||
|
.notes-contrast-toggle[aria-pressed="true"] {
|
||||||
|
opacity: 1;
|
||||||
|
color: var(--calc-accent-a, #1F6FB4);
|
||||||
|
}
|
||||||
|
.notes-contrast-toggle:focus-visible {
|
||||||
|
outline: 2px solid var(--calc-accent-a, #1F6FB4);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
/* quiz — tick-box self-checks: options, per-option explanations, score bar
|
||||||
|
*
|
||||||
|
* The card borrows .exo's frame so a quiz and an exercise look related.
|
||||||
|
* Green and red are reserved for the verdict: nothing else on the page uses
|
||||||
|
* them, so a colour here always means "this answer was judged".
|
||||||
|
*/
|
||||||
|
|
||||||
|
.quiz {
|
||||||
|
--quiz-ok: #1a7f5a;
|
||||||
|
--quiz-bad: #a3324a;
|
||||||
|
--quiz-ink: #5a6879;
|
||||||
|
|
||||||
|
margin: 1.4rem 0;
|
||||||
|
padding: 0.7rem 1rem 0.85rem;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 35%, transparent);
|
||||||
|
border-left: 3px solid var(--calc-notecolor, #B45309);
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
scroll-margin-top: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* keep wide content inside the card, as in .calc and .exo */
|
||||||
|
.quiz mjx-container[display="true"],
|
||||||
|
.quiz .katex-display {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 0.35em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
justify-content: safe center;
|
||||||
|
}
|
||||||
|
.quiz .math.display { display: block; max-width: 100%; }
|
||||||
|
.quiz :is(pre, table) { max-width: 100%; overflow-x: auto; }
|
||||||
|
.quiz img, .quiz svg { max-width: 100%; }
|
||||||
|
|
||||||
|
.quiz-head { margin: 0 0 0.45rem; }
|
||||||
|
.quiz-head strong { color: var(--calc-notecolor, #B45309); }
|
||||||
|
|
||||||
|
.quiz-tip {
|
||||||
|
margin: 0 0 0.7rem;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--quiz-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- questions ------------------------------------------------------ */
|
||||||
|
|
||||||
|
.quiz-q + .quiz-q {
|
||||||
|
margin-top: 1.1rem;
|
||||||
|
padding-top: 0.9rem;
|
||||||
|
border-top: 1px dashed color-mix(in srgb, var(--calc-notecolor, #B45309) 30%, transparent);
|
||||||
|
}
|
||||||
|
.quiz-q-head { margin: 0 0 0.35rem; font-size: 0.9em; }
|
||||||
|
|
||||||
|
/* ---- options -------------------------------------------------------- */
|
||||||
|
|
||||||
|
.quiz-opts {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0.55rem 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.quiz-opt {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.22rem 0.4rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
border-left: 2px solid transparent;
|
||||||
|
}
|
||||||
|
.quiz-opt + .quiz-opt { margin-top: 0.15rem; }
|
||||||
|
|
||||||
|
/* the whole row is the click target, so a long formula is still easy to tick */
|
||||||
|
.quiz-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.55rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.quiz-box {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
margin: 0;
|
||||||
|
/* baseline-align the box with the first line of the option text */
|
||||||
|
transform: translateY(0.15rem);
|
||||||
|
accent-color: var(--calc-notecolor, #B45309);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.quiz-opt-text { min-width: 0; }
|
||||||
|
.quiz-opt-text > :first-child { margin-top: 0; }
|
||||||
|
.quiz-opt-text > :last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
/* judged options */
|
||||||
|
.quiz-opt.quiz-ok {
|
||||||
|
background: color-mix(in srgb, var(--quiz-ok) 8%, transparent);
|
||||||
|
border-left-color: var(--quiz-ok);
|
||||||
|
}
|
||||||
|
.quiz-opt.quiz-bad {
|
||||||
|
background: color-mix(in srgb, var(--quiz-bad) 8%, transparent);
|
||||||
|
border-left-color: var(--quiz-bad);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- explanations --------------------------------------------------- */
|
||||||
|
|
||||||
|
.quiz-why {
|
||||||
|
margin: 0.35rem 0 0.15rem 1.55rem;
|
||||||
|
padding: 0.3rem 0 0.3rem 0.7rem;
|
||||||
|
border-left: 2px solid var(--quiz-bad);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
.quiz-why > :first-child { margin-top: 0; }
|
||||||
|
.quiz-why > :last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
.quiz-why-q {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- the per-question points badge ---------------------------------- */
|
||||||
|
|
||||||
|
/* The head now always exists (it is where the badge lands), so an empty one
|
||||||
|
on a single-question quiz must not leave a gap. */
|
||||||
|
.quiz-q-head:empty { display: none; }
|
||||||
|
|
||||||
|
.quiz-q-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quiz-q-score {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--quiz-ink);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.quiz-q-score b { color: var(--calc-notecolor, #B45309); font-weight: 600; }
|
||||||
|
/* green and red stay reserved for a judged answer; the badge follows the
|
||||||
|
verdict right below it so the two never disagree */
|
||||||
|
.quiz-q-score.quiz-ok b { color: var(--quiz-ok); }
|
||||||
|
.quiz-q-score.quiz-bad b { color: var(--quiz-bad); }
|
||||||
|
|
||||||
|
/* ---- verdict and bar ------------------------------------------------ */
|
||||||
|
|
||||||
|
.quiz-verdict {
|
||||||
|
margin: 0.5rem 0 0;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.quiz-verdict.quiz-ok { color: var(--quiz-ok); }
|
||||||
|
.quiz-verdict.quiz-bad { color: var(--quiz-bad); }
|
||||||
|
|
||||||
|
.quiz-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding-top: 0.7rem;
|
||||||
|
border-top: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 25%, transparent);
|
||||||
|
}
|
||||||
|
.quiz-bar button {
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.84rem;
|
||||||
|
padding: 0.2rem 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--calc-notecolor, #B45309) 45%, transparent);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--calc-notecolor, #B45309);
|
||||||
|
}
|
||||||
|
.quiz-bar button:hover {
|
||||||
|
background: color-mix(in srgb, var(--calc-notecolor, #B45309) 10%, transparent);
|
||||||
|
}
|
||||||
|
.quiz-bar button.quiz-reset {
|
||||||
|
border-color: color-mix(in srgb, var(--quiz-ink) 40%, transparent);
|
||||||
|
color: var(--quiz-ink);
|
||||||
|
}
|
||||||
|
.quiz-bar button.quiz-reset:hover {
|
||||||
|
background: color-mix(in srgb, var(--quiz-ink) 10%, transparent);
|
||||||
|
}
|
||||||
|
.quiz-score {
|
||||||
|
font-size: 0.84rem;
|
||||||
|
color: var(--quiz-ink);
|
||||||
|
}
|
||||||
|
.quiz-score b { color: var(--calc-notecolor, #B45309); font-weight: 600; }
|
||||||
|
|
||||||
|
/* ---- dark theme ----------------------------------------------------- */
|
||||||
|
|
||||||
|
/* High contrast remaps the whole palette, and --quiz-ok / --quiz-bad are local
|
||||||
|
to this file, so they have to be pointed at the HC pair by hand: without
|
||||||
|
this the verdict and the points badge keep their ordinary-mode green and
|
||||||
|
red, which is exactly what a reader turns HC on to avoid. `body` makes it
|
||||||
|
outweigh body.quarto-dark .quiz below, or dark + HC would keep the plain
|
||||||
|
dark pair. */
|
||||||
|
html.hc body .quiz {
|
||||||
|
--quiz-ok: var(--hc-success);
|
||||||
|
--quiz-bad: var(--hc-danger);
|
||||||
|
--quiz-ink: var(--hc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.quarto-dark .quiz {
|
||||||
|
--quiz-ok: #4cb08a;
|
||||||
|
--quiz-bad: #e2798f;
|
||||||
|
--quiz-ink: #8b98a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- print ----------------------------------------------------------
|
||||||
|
* Printing the HTML is a fallback (the pdf format is the real print path).
|
||||||
|
* A printed quiz is one to fill in with a pen: the bar goes, the boxes stay
|
||||||
|
* empty, and anything already revealed on screen is kept so a checked quiz
|
||||||
|
* prints as it looks.
|
||||||
|
*/
|
||||||
|
@media print {
|
||||||
|
.quiz-bar { display: none; }
|
||||||
|
/* on paper the points are printed in the statement by quiz.lua, so the
|
||||||
|
screen badge would say the same thing twice */
|
||||||
|
.quiz-q-score { display: none; }
|
||||||
|
.quiz-opt.quiz-ok, .quiz-opt.quiz-bad { background: none; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
// quiz — judge the tick boxes of one quiz, score it in points, explain mistakes
|
||||||
|
//
|
||||||
|
// Every label the reader sees is written into the markup by quiz.lua, so the
|
||||||
|
// wording follows the book's language and nothing is translated twice. A
|
||||||
|
// quiz carries:
|
||||||
|
// data-quiz-score "{n} of {m} questions correct"
|
||||||
|
// data-quiz-points "{n} of {m} points" (the headline)
|
||||||
|
// data-quiz-qpoints "{n}/{m} points" (one question's badge)
|
||||||
|
// data-quiz-right verdict of a question answered correctly
|
||||||
|
// data-quiz-wrong verdict of a question answered wrongly
|
||||||
|
// and each question carries data-points / data-penalty.
|
||||||
|
//
|
||||||
|
// SCORING. A question is worth data-points (default 3). Every statement whose
|
||||||
|
// box disagrees with its truth value — an unticked true one, or a ticked false
|
||||||
|
// one — costs data-penalty (default 1). The result floors at zero, so a
|
||||||
|
// question can never drag the total down. The quiz total is the sum over its
|
||||||
|
// questions. A question still counts as "correct" for the verdict line only
|
||||||
|
// when every one of its statements is right, which is the exam's
|
||||||
|
// multiple-true-false rule.
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function options(quiz) {
|
||||||
|
return quiz.querySelectorAll(".quiz-opt");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number(undefined) || 3 would also swallow a deliberate 0, so test first.
|
||||||
|
function num(el, name, dflt) {
|
||||||
|
var raw = el.dataset ? el.dataset[name] : null;
|
||||||
|
if (raw === undefined || raw === null || raw === "") return dflt;
|
||||||
|
var n = Number(raw);
|
||||||
|
return isFinite(n) ? n : dflt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Substitute {n} and {m} into a template from metadata, building text nodes
|
||||||
|
// rather than markup: the template is author text, never trusted as HTML.
|
||||||
|
function render(el, template, n, m) {
|
||||||
|
el.innerHTML = "";
|
||||||
|
var parts = template.split(/\{n\}|\{m\}/);
|
||||||
|
var values = (template.match(/\{n\}|\{m\}/g) || []).map(function (token) {
|
||||||
|
return token === "{n}" ? n : m;
|
||||||
|
});
|
||||||
|
parts.forEach(function (text, i) {
|
||||||
|
el.appendChild(document.createTextNode(text));
|
||||||
|
if (i < values.length) {
|
||||||
|
var b = document.createElement("b");
|
||||||
|
b.textContent = String(values[i]);
|
||||||
|
el.appendChild(b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function judge(quiz) {
|
||||||
|
var questions = quiz.querySelectorAll(".quiz-q");
|
||||||
|
var right = 0, scored = 0, available = 0;
|
||||||
|
|
||||||
|
questions.forEach(function (q) {
|
||||||
|
var ok = true;
|
||||||
|
var misses = 0;
|
||||||
|
var pts = num(q, "points", 3);
|
||||||
|
var pen = num(q, "penalty", 1);
|
||||||
|
|
||||||
|
q.querySelectorAll(".quiz-opt").forEach(function (opt) {
|
||||||
|
var box = opt.querySelector(".quiz-box");
|
||||||
|
if (!box) return;
|
||||||
|
var want = opt.dataset.correct === "1";
|
||||||
|
var hit = box.checked === want;
|
||||||
|
|
||||||
|
opt.classList.toggle("quiz-ok", hit);
|
||||||
|
opt.classList.toggle("quiz-bad", !hit);
|
||||||
|
|
||||||
|
// the explanation of an option is for the reader who got it wrong.
|
||||||
|
// :scope > keeps this to the option's own .why — a question-level
|
||||||
|
// .quiz-why-q also carries the class quiz-why.
|
||||||
|
var why = opt.querySelector(":scope > .quiz-why");
|
||||||
|
if (why) why.hidden = hit;
|
||||||
|
|
||||||
|
if (!hit) { ok = false; misses++; }
|
||||||
|
});
|
||||||
|
|
||||||
|
var got = Math.max(0, pts - misses * pen);
|
||||||
|
scored += got;
|
||||||
|
available += pts;
|
||||||
|
|
||||||
|
var badge = q.querySelector(".quiz-q-score");
|
||||||
|
if (badge) {
|
||||||
|
badge.hidden = false;
|
||||||
|
render(badge, quiz.dataset.quizQpoints || "{n}/{m}", got, pts);
|
||||||
|
badge.classList.toggle("quiz-ok", misses === 0);
|
||||||
|
badge.classList.toggle("quiz-bad", got === 0 && pts > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var verdict = q.querySelector(".quiz-verdict");
|
||||||
|
if (verdict) {
|
||||||
|
verdict.hidden = false;
|
||||||
|
verdict.textContent = ok
|
||||||
|
? (quiz.dataset.quizRight || "Correct")
|
||||||
|
: (quiz.dataset.quizWrong || "Not quite");
|
||||||
|
verdict.classList.toggle("quiz-ok", ok);
|
||||||
|
verdict.classList.toggle("quiz-bad", !ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
// a question-level explanation backs up a wrong answer as a whole
|
||||||
|
var qwhy = q.querySelector(".quiz-why-q");
|
||||||
|
if (qwhy) qwhy.hidden = ok;
|
||||||
|
|
||||||
|
if (ok) right++;
|
||||||
|
});
|
||||||
|
|
||||||
|
var score = quiz.querySelector(".quiz-score");
|
||||||
|
if (score) {
|
||||||
|
score.hidden = false;
|
||||||
|
render(score, quiz.dataset.quizPoints || "{n}/{m}", scored, available);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset(quiz) {
|
||||||
|
options(quiz).forEach(function (opt) {
|
||||||
|
var box = opt.querySelector(".quiz-box");
|
||||||
|
if (box) box.checked = false;
|
||||||
|
opt.classList.remove("quiz-ok", "quiz-bad");
|
||||||
|
var why = opt.querySelector(":scope > .quiz-why");
|
||||||
|
if (why) why.hidden = true;
|
||||||
|
});
|
||||||
|
quiz.querySelectorAll(".quiz-verdict").forEach(function (v) {
|
||||||
|
v.hidden = true;
|
||||||
|
v.textContent = "";
|
||||||
|
v.classList.remove("quiz-ok", "quiz-bad");
|
||||||
|
});
|
||||||
|
quiz.querySelectorAll(".quiz-q-score").forEach(function (b) {
|
||||||
|
b.hidden = true;
|
||||||
|
b.textContent = "";
|
||||||
|
b.classList.remove("quiz-ok", "quiz-bad");
|
||||||
|
});
|
||||||
|
quiz.querySelectorAll(".quiz-why-q").forEach(function (w) { w.hidden = true; });
|
||||||
|
var score = quiz.querySelector(".quiz-score");
|
||||||
|
if (score) { score.textContent = ""; score.hidden = false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("click", function (event) {
|
||||||
|
var target = event.target;
|
||||||
|
if (!target.closest) return;
|
||||||
|
|
||||||
|
var check = target.closest(".quiz .quiz-check");
|
||||||
|
if (check) {
|
||||||
|
judge(check.closest(".quiz"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var again = target.closest(".quiz .quiz-reset");
|
||||||
|
if (again) {
|
||||||
|
reset(again.closest(".quiz"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Re-ticking a box after checking clears that row's verdict, so a stale
|
||||||
|
// green or red never sits next to a box the reader has just changed — and
|
||||||
|
// with it the question's badge and the headline, which would otherwise
|
||||||
|
// still claim a score for an answer that has since moved.
|
||||||
|
document.addEventListener("change", function (event) {
|
||||||
|
var box = event.target;
|
||||||
|
if (!box.closest || !box.classList || !box.classList.contains("quiz-box")) return;
|
||||||
|
var opt = box.closest(".quiz-opt");
|
||||||
|
if (!opt) return;
|
||||||
|
opt.classList.remove("quiz-ok", "quiz-bad");
|
||||||
|
var why = opt.querySelector(":scope > .quiz-why");
|
||||||
|
if (why) why.hidden = true;
|
||||||
|
|
||||||
|
var q = opt.closest(".quiz-q");
|
||||||
|
if (q) {
|
||||||
|
var badge = q.querySelector(".quiz-q-score");
|
||||||
|
if (badge) { badge.hidden = true; badge.textContent = ""; }
|
||||||
|
var verdict = q.querySelector(".quiz-verdict");
|
||||||
|
if (verdict) { verdict.hidden = true; verdict.textContent = ""; }
|
||||||
|
var qwhy = q.querySelector(".quiz-why-q");
|
||||||
|
if (qwhy) qwhy.hidden = true;
|
||||||
|
}
|
||||||
|
var quiz = opt.closest(".quiz");
|
||||||
|
if (quiz) {
|
||||||
|
var score = quiz.querySelector(".quiz-score");
|
||||||
|
if (score) score.textContent = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
|
//
|
||||||
|
// AnchorJS - v5.0.0 - 2023-01-18
|
||||||
|
// https://www.bryanbraun.com/anchorjs/
|
||||||
|
// Copyright (c) 2023 Bryan Braun; Licensed MIT
|
||||||
|
//
|
||||||
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
|
!function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(globalThis,function(){"use strict";return function(A){function u(A){A.icon=Object.prototype.hasOwnProperty.call(A,"icon")?A.icon:"",A.visible=Object.prototype.hasOwnProperty.call(A,"visible")?A.visible:"hover",A.placement=Object.prototype.hasOwnProperty.call(A,"placement")?A.placement:"right",A.ariaLabel=Object.prototype.hasOwnProperty.call(A,"ariaLabel")?A.ariaLabel:"Anchor",A.class=Object.prototype.hasOwnProperty.call(A,"class")?A.class:"",A.base=Object.prototype.hasOwnProperty.call(A,"base")?A.base:"",A.truncate=Object.prototype.hasOwnProperty.call(A,"truncate")?Math.floor(A.truncate):64,A.titleText=Object.prototype.hasOwnProperty.call(A,"titleText")?A.titleText:""}function d(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new TypeError("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],u(this.options),this.add=function(A){var e,t,o,i,n,s,a,r,l,c,h,p=[];if(u(this.options),0!==(e=d(A=A||"h2, h3, h4, h5, h6")).length){for(null===document.head.querySelector("style.anchorjs")&&((A=document.createElement("style")).className="anchorjs",A.appendChild(document.createTextNode("")),void 0===(h=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(A):document.head.insertBefore(A,h),A.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",A.sheet.cssRules.length),A.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",A.sheet.cssRules.length),A.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",A.sheet.cssRules.length),A.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',A.sheet.cssRules.length)),h=document.querySelectorAll("[id]"),t=[].map.call(h,function(A){return A.id}),i=0;i<e.length;i++)if(this.hasAnchorJSLink(e[i]))p.push(i);else{if(e[i].hasAttribute("id"))o=e[i].getAttribute("id");else if(e[i].hasAttribute("data-anchor-id"))o=e[i].getAttribute("data-anchor-id");else{for(r=a=this.urlify(e[i].textContent),s=0;n=t.indexOf(r=void 0!==n?a+"-"+s:r),s+=1,-1!==n;);n=void 0,t.push(r),e[i].setAttribute("id",r),o=r}(l=document.createElement("a")).className="anchorjs-link "+this.options.class,l.setAttribute("aria-label",this.options.ariaLabel),l.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(l.title=this.options.titleText),c=document.querySelector("base")?window.location.pathname+window.location.search:"",c=this.options.base||c,l.href=c+"#"+o,"always"===this.options.visible&&(l.style.opacity="1"),""===this.options.icon&&(l.style.font="1em/1 anchorjs-icons","left"===this.options.placement)&&(l.style.lineHeight="inherit"),"left"===this.options.placement?(l.style.position="absolute",l.style.marginLeft="-1.25em",l.style.paddingRight=".25em",l.style.paddingLeft=".25em",e[i].insertBefore(l,e[i].firstChild)):(l.style.marginLeft=".1875em",l.style.paddingRight=".1875em",l.style.paddingLeft=".1875em",e[i].appendChild(l))}for(i=0;i<p.length;i++)e.splice(p[i]-i,1);this.elements=this.elements.concat(e)}return this},this.remove=function(A){for(var e,t,o=d(A),i=0;i<o.length;i++)(t=o[i].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(o[i]))&&this.elements.splice(e,1),o[i].removeChild(t));return this},this.removeAll=function(){thisLine truncated
|
||||||
|
// @license-end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @popperjs/core v2.11.7 - MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,(function(e){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function o(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var i=Math.max,a=Math.min,s=Math.round;function f(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function c(){return!/^((?!chrome|android).)*safari/i.test(f())}function p(e,o,i){void 0===o&&(o=!1),void 0===i&&(i=!1);var a=e.getBoundingClientRect(),f=1,p=1;o&&r(e)&&(f=e.offsetWidth>0&&s(a.width)/e.offsetWidth||1,p=e.offsetHeight>0&&s(a.height)/e.offsetHeight||1);var u=(n(e)?t(e):window).visualViewport,l=!c()&&i,d=(a.left+(l&&u?u.offsetLeft:0))/f,h=(a.top+(l&&u?u.offsetTop:0))/p,m=a.width/f,v=a.height/p;return{width:m,height:v,top:h,right:d+m,bottom:h+v,left:d,x:d,y:h}}function u(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function l(e){return e?(e.nodeName||"").toLowerCase():null}function d(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function h(e){return p(d(e)).left+u(e).scrollLeft}function m(e){return t(e).getComputedStyle(e)}function v(e){var t=m(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function y(e,n,o){void 0===o&&(o=!1);var i,a,f=r(n),c=r(n)&&function(e){var t=e.getBoundingClientRect(),n=s(t.width)/e.offsetWidth||1,r=s(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(n),m=d(n),y=p(e,c,o),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(f||!f&&!o)&&(("body"!==l(n)||v(m))&&(g=(i=n)!==t(i)&&r(i)?{scrollLeft:(a=i).scrollLeft,scrollTop:a.scrollTop}:u(i)),r(n)?((b=p(n,!0)).x+=n.clientLeft,b.y+=n.clientTop):m&&(b.x=h(m))),{x:y.left+g.scrollLeft-b.x,y:y.top+g.scrollTop-b.y,width:y.width,height:y.height}}function g(e){var t=p(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function b(e){return"html"===l(e)?e:e.assignedSlot||e.parentNode||(o(e)?e.host:null)||d(e)}function x(e){return["html","body","#document"].indexOf(l(e))>=0?e.ownerDocument.body:r(e)&&v(e)?e:x(b(e))}function w(e,n){var r;void 0===n&&(n=[]);var o=x(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=t(o),s=i?[a].concat(a.visualViewport||[],v(o)?o:[]):o,f=n.concat(s);return i?f:f.concat(w(b(s)))}function O(e){return["table","td","th"].indexOf(l(e))>=0}function j(e){return r(e)&&"fixed"!==m(e).position?e.offsetParent:null}function E(e){for(var n=t(e),i=j(e);i&&O(i)&&"static"===m(i).position;)i=j(i);return i&&("html"===l(i)||"body"===l(i)&&"static"===m(i).position)?n:i||function(e){var t=/firefox/i.test(f());if(/Trident/i.test(f())&&r(e)&&"fixed"===m(e).position)return null;var n=b(e);for(o(n)&&(n=n.host);r(n)&&["html","body"].indexOf(l(n))<0;){var i=m(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var D="top",A="bottom",L="right",P="left",M="auto",k=[D,A,L,P],W="start",B="end",H="viewport",T="popper",R=k.reduce((function(e,t){return e.concat([t+"-"+W,t+"-"+B])}),[]),S=[].concat(k,[M]).reduce((function(e,t){return e.concat([t,t+"-"+W,t+"-"+B])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function q(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}function C(e){return e.split("-")[0]}function N(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function I(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function _(e,r,o){return r===H?I(function(e,n){var r=t(e),o=d(e),i=r.visualViewport,a=o.clientWidth,s=o.clientHeight,f=0,p=0;if(i){a=i.width,s=i.height;var u=c();(u||!u&&"fixed"===n)&&(f=i.offsetLeft,p=i.offsetTop)}return{width:a,height:s,x:f+h(e),y:p}}(e,o)):n(r)?function(e,t){var n=p(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.lLine truncated
|
||||||
|
|
||||||
+233
@@ -0,0 +1,233 @@
|
|||||||
|
/* quarto syntax highlight colors */
|
||||||
|
:root {
|
||||||
|
--quarto-hl-ot-color: #d91e18;
|
||||||
|
--quarto-hl-at-color: #a55a00;
|
||||||
|
--quarto-hl-ss-color: #008000;
|
||||||
|
--quarto-hl-an-color: #696969;
|
||||||
|
--quarto-hl-fu-color: #06287e;
|
||||||
|
--quarto-hl-st-color: #008000;
|
||||||
|
--quarto-hl-cf-color: #d91e18;
|
||||||
|
--quarto-hl-op-color: #00769e;
|
||||||
|
--quarto-hl-er-color: #7928a1;
|
||||||
|
--quarto-hl-bn-color: #7928a1;
|
||||||
|
--quarto-hl-al-color: #7928a1;
|
||||||
|
--quarto-hl-va-color: #a55a00;
|
||||||
|
--quarto-hl-bu-color: inherit;
|
||||||
|
--quarto-hl-ex-color: inherit;
|
||||||
|
--quarto-hl-pp-color: #7928a1;
|
||||||
|
--quarto-hl-in-color: #696969;
|
||||||
|
--quarto-hl-vs-color: #008000;
|
||||||
|
--quarto-hl-wa-color: #696969;
|
||||||
|
--quarto-hl-do-color: #696969;
|
||||||
|
--quarto-hl-im-color: inherit;
|
||||||
|
--quarto-hl-ch-color: #008000;
|
||||||
|
--quarto-hl-dt-color: #7928a1;
|
||||||
|
--quarto-hl-fl-color: #a55a00;
|
||||||
|
--quarto-hl-co-color: #696969;
|
||||||
|
--quarto-hl-cv-color: #696969;
|
||||||
|
--quarto-hl-cn-color: #d91e18;
|
||||||
|
--quarto-hl-sc-color: #00769e;
|
||||||
|
--quarto-hl-dv-color: #7928a1;
|
||||||
|
--quarto-hl-kw-color: #d91e18;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* other quarto variables */
|
||||||
|
:root {
|
||||||
|
--quarto-font-monospace: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* syntax highlight based on Pandoc's rules */
|
||||||
|
pre > code.sourceCode > span {
|
||||||
|
color: #545454;
|
||||||
|
}
|
||||||
|
|
||||||
|
code.sourceCode > span {
|
||||||
|
color: #545454;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sourceCode,
|
||||||
|
div.sourceCode pre.sourceCode {
|
||||||
|
color: #545454;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Normal */
|
||||||
|
code span {
|
||||||
|
color: #545454;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Alert */
|
||||||
|
code span.al {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Annotation */
|
||||||
|
code span.an {
|
||||||
|
color: #696969;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Attribute */
|
||||||
|
code span.at {
|
||||||
|
color: #a55a00;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BaseN */
|
||||||
|
code span.bn {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BuiltIn */
|
||||||
|
code span.bu {
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ControlFlow */
|
||||||
|
code span.cf {
|
||||||
|
color: #d91e18;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Char */
|
||||||
|
code span.ch {
|
||||||
|
color: #008000;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Constant */
|
||||||
|
code span.cn {
|
||||||
|
color: #d91e18;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Comment */
|
||||||
|
code span.co {
|
||||||
|
color: #696969;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CommentVar */
|
||||||
|
code span.cv {
|
||||||
|
color: #696969;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Documentation */
|
||||||
|
code span.do {
|
||||||
|
color: #696969;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DataType */
|
||||||
|
code span.dt {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DecVal */
|
||||||
|
code span.dv {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Error */
|
||||||
|
code span.er {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extension */
|
||||||
|
code span.ex {
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Float */
|
||||||
|
code span.fl {
|
||||||
|
color: #a55a00;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function */
|
||||||
|
code span.fu {
|
||||||
|
color: #06287e;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Import */
|
||||||
|
code span.im {
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Information */
|
||||||
|
code span.in {
|
||||||
|
color: #696969;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyword */
|
||||||
|
code span.kw {
|
||||||
|
color: #d91e18;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Operator */
|
||||||
|
code span.op {
|
||||||
|
color: #00769e;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Other */
|
||||||
|
code span.ot {
|
||||||
|
color: #d91e18;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Preprocessor */
|
||||||
|
code span.pp {
|
||||||
|
color: #7928a1;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SpecialChar */
|
||||||
|
code span.sc {
|
||||||
|
color: #00769e;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SpecialString */
|
||||||
|
code span.ss {
|
||||||
|
color: #008000;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* String */
|
||||||
|
code span.st {
|
||||||
|
color: #008000;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variable */
|
||||||
|
code span.va {
|
||||||
|
color: #a55a00;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* VerbatimString */
|
||||||
|
code span.vs {
|
||||||
|
color: #008000;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Warning */
|
||||||
|
code span.wa {
|
||||||
|
color: #696969;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prevent-inlining {
|
||||||
|
content: "</";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=0a12fef89ae5056e90fb92cad957d154.css.map */
|
||||||
+234
@@ -0,0 +1,234 @@
|
|||||||
|
/* quarto syntax highlight colors */
|
||||||
|
:root {
|
||||||
|
--quarto-hl-ot-color: #ffa07a;
|
||||||
|
--quarto-hl-at-color: #ffd700;
|
||||||
|
--quarto-hl-ss-color: #abe338;
|
||||||
|
--quarto-hl-an-color: #d4d0ab;
|
||||||
|
--quarto-hl-fu-color: #ffd700;
|
||||||
|
--quarto-hl-st-color: #abe338;
|
||||||
|
--quarto-hl-cf-color: #ffa07a;
|
||||||
|
--quarto-hl-op-color: #00e0e0;
|
||||||
|
--quarto-hl-er-color: #dcc6e0;
|
||||||
|
--quarto-hl-bn-color: #dcc6e0;
|
||||||
|
--quarto-hl-al-color: #dcc6e0;
|
||||||
|
--quarto-hl-va-color: #f5ab35;
|
||||||
|
--quarto-hl-bu-color: #f5ab35;
|
||||||
|
--quarto-hl-ex-color: #ffd700;
|
||||||
|
--quarto-hl-pp-color: #dcc6e0;
|
||||||
|
--quarto-hl-in-color: #d4d0ab;
|
||||||
|
--quarto-hl-vs-color: #abe338;
|
||||||
|
--quarto-hl-wa-color: #d4d0ab;
|
||||||
|
--quarto-hl-do-color: #d4d0ab;
|
||||||
|
--quarto-hl-ch-color: #abe338;
|
||||||
|
--quarto-hl-dt-color: #dcc6e0;
|
||||||
|
--quarto-hl-fl-color: #f5ab35;
|
||||||
|
--quarto-hl-co-color: #d4d0ab;
|
||||||
|
--quarto-hl-cv-color: #d4d0ab;
|
||||||
|
--quarto-hl-cn-color: #ffa07a;
|
||||||
|
--quarto-hl-sc-color: #00e0e0;
|
||||||
|
--quarto-hl-dv-color: #dcc6e0;
|
||||||
|
--quarto-hl-kw-color: #ffa07a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* other quarto variables */
|
||||||
|
:root {
|
||||||
|
--quarto-font-monospace: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* syntax highlight based on Pandoc's rules */
|
||||||
|
pre > code.sourceCode > span {
|
||||||
|
color: #f8f8f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
code.sourceCode > span {
|
||||||
|
color: #f8f8f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sourceCode,
|
||||||
|
div.sourceCode pre.sourceCode {
|
||||||
|
color: #f8f8f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Normal */
|
||||||
|
code span {
|
||||||
|
color: #f8f8f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Alert */
|
||||||
|
code span.al {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Annotation */
|
||||||
|
code span.an {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Attribute */
|
||||||
|
code span.at {
|
||||||
|
color: #ffd700;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BaseN */
|
||||||
|
code span.bn {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BuiltIn */
|
||||||
|
code span.bu {
|
||||||
|
color: #f5ab35;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ControlFlow */
|
||||||
|
code span.cf {
|
||||||
|
color: #ffa07a;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Char */
|
||||||
|
code span.ch {
|
||||||
|
color: #abe338;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Constant */
|
||||||
|
code span.cn {
|
||||||
|
color: #ffa07a;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Comment */
|
||||||
|
code span.co {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CommentVar */
|
||||||
|
code span.cv {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Documentation */
|
||||||
|
code span.do {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DataType */
|
||||||
|
code span.dt {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DecVal */
|
||||||
|
code span.dv {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Error */
|
||||||
|
code span.er {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extension */
|
||||||
|
code span.ex {
|
||||||
|
color: #ffd700;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Float */
|
||||||
|
code span.fl {
|
||||||
|
color: #f5ab35;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function */
|
||||||
|
code span.fu {
|
||||||
|
color: #ffd700;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Import */
|
||||||
|
code span.im {
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Information */
|
||||||
|
code span.in {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyword */
|
||||||
|
code span.kw {
|
||||||
|
color: #ffa07a;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Operator */
|
||||||
|
code span.op {
|
||||||
|
color: #00e0e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Other */
|
||||||
|
code span.ot {
|
||||||
|
color: #ffa07a;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Preprocessor */
|
||||||
|
code span.pp {
|
||||||
|
color: #dcc6e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SpecialChar */
|
||||||
|
code span.sc {
|
||||||
|
color: #00e0e0;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SpecialString */
|
||||||
|
code span.ss {
|
||||||
|
color: #abe338;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* String */
|
||||||
|
code span.st {
|
||||||
|
color: #abe338;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variable */
|
||||||
|
code span.va {
|
||||||
|
color: #f5ab35;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* VerbatimString */
|
||||||
|
code span.vs {
|
||||||
|
color: #abe338;
|
||||||
|
font-style: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Warning */
|
||||||
|
code span.wa {
|
||||||
|
color: #d4d0ab;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prevent-inlining {
|
||||||
|
content: "</";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=02314e985f2be8e35f214ed82eec63a7.css.map */
|
||||||
@@ -0,0 +1,845 @@
|
|||||||
|
import * as tabsets from "./tabsets/tabsets.js";
|
||||||
|
|
||||||
|
const sectionChanged = new CustomEvent("quarto-sectionChanged", {
|
||||||
|
detail: {},
|
||||||
|
bubbles: true,
|
||||||
|
cancelable: false,
|
||||||
|
composed: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const layoutMarginEls = () => {
|
||||||
|
// Find any conflicting margin elements and add margins to the
|
||||||
|
// top to prevent overlap
|
||||||
|
const marginChildren = window.document.querySelectorAll(
|
||||||
|
".column-margin.column-container > *, .margin-caption, .aside"
|
||||||
|
);
|
||||||
|
|
||||||
|
let lastBottom = 0;
|
||||||
|
for (const marginChild of marginChildren) {
|
||||||
|
if (marginChild.offsetParent !== null) {
|
||||||
|
// clear the top margin so we recompute it
|
||||||
|
marginChild.style.marginTop = null;
|
||||||
|
const top = marginChild.getBoundingClientRect().top + window.scrollY;
|
||||||
|
if (top < lastBottom) {
|
||||||
|
const marginChildStyle = window.getComputedStyle(marginChild);
|
||||||
|
const marginBottom = parseFloat(marginChildStyle["marginBottom"]);
|
||||||
|
const margin = lastBottom - top + marginBottom;
|
||||||
|
marginChild.style.marginTop = `${margin}px`;
|
||||||
|
}
|
||||||
|
const styles = window.getComputedStyle(marginChild);
|
||||||
|
const marginTop = parseFloat(styles["marginTop"]);
|
||||||
|
lastBottom = top + marginChild.getBoundingClientRect().height + marginTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.document.addEventListener("DOMContentLoaded", function (_event) {
|
||||||
|
// Recompute the position of margin elements anytime the body size changes
|
||||||
|
if (window.ResizeObserver) {
|
||||||
|
const resizeObserver = new window.ResizeObserver(
|
||||||
|
throttle(() => {
|
||||||
|
layoutMarginEls();
|
||||||
|
if (
|
||||||
|
window.document.body.getBoundingClientRect().width < 990 &&
|
||||||
|
isReaderMode()
|
||||||
|
) {
|
||||||
|
quartoToggleReader();
|
||||||
|
}
|
||||||
|
}, 50)
|
||||||
|
);
|
||||||
|
resizeObserver.observe(window.document.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tocEl = window.document.querySelector('nav.toc-active[role="doc-toc"]');
|
||||||
|
const sidebarEl = window.document.getElementById("quarto-sidebar");
|
||||||
|
const leftTocEl = window.document.getElementById("quarto-sidebar-toc-left");
|
||||||
|
const marginSidebarEl = window.document.getElementById(
|
||||||
|
"quarto-margin-sidebar"
|
||||||
|
);
|
||||||
|
// function to determine whether the element has a previous sibling that is active
|
||||||
|
const prevSiblingIsActiveLink = (el) => {
|
||||||
|
const sibling = el.previousElementSibling;
|
||||||
|
if (sibling && sibling.tagName === "A") {
|
||||||
|
return sibling.classList.contains("active");
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// dispatch for htmlwidgets
|
||||||
|
// they use slideenter event to trigger resize
|
||||||
|
function fireSlideEnter() {
|
||||||
|
const event = window.document.createEvent("Event");
|
||||||
|
event.initEvent("slideenter", true, true);
|
||||||
|
window.document.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tabs = window.document.querySelectorAll('a[data-bs-toggle="tab"]');
|
||||||
|
tabs.forEach((tab) => {
|
||||||
|
tab.addEventListener("shown.bs.tab", fireSlideEnter);
|
||||||
|
});
|
||||||
|
|
||||||
|
// dispatch for shiny
|
||||||
|
// they use BS shown and hidden events to trigger rendering
|
||||||
|
function distpatchShinyEvents(previous, current) {
|
||||||
|
if (window.jQuery) {
|
||||||
|
if (previous) {
|
||||||
|
window.jQuery(previous).trigger("hidden");
|
||||||
|
}
|
||||||
|
if (current) {
|
||||||
|
window.jQuery(current).trigger("shown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// tabby.js listener: Trigger event for htmlwidget and shiny
|
||||||
|
document.addEventListener(
|
||||||
|
"tabby",
|
||||||
|
function (event) {
|
||||||
|
fireSlideEnter();
|
||||||
|
distpatchShinyEvents(event.detail.previousTab, event.detail.tab);
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
// Track scrolling and mark TOC links as active
|
||||||
|
// get table of contents and sidebar (bail if we don't have at least one)
|
||||||
|
const tocLinks = tocEl
|
||||||
|
? [...tocEl.querySelectorAll("a[data-scroll-target]")]
|
||||||
|
: [];
|
||||||
|
const makeActive = (link) => tocLinks[link].classList.add("active");
|
||||||
|
const removeActive = (link) => tocLinks[link].classList.remove("active");
|
||||||
|
const removeAllActive = () =>
|
||||||
|
[...Array(tocLinks.length).keys()].forEach((link) => removeActive(link));
|
||||||
|
|
||||||
|
// activate the anchor for a section associated with this TOC entry
|
||||||
|
tocLinks.forEach((link) => {
|
||||||
|
link.addEventListener("click", () => {
|
||||||
|
if (link.href.indexOf("#") !== -1) {
|
||||||
|
const anchor = link.href.split("#")[1];
|
||||||
|
const heading = window.document.querySelector(
|
||||||
|
`[data-anchor-id="${anchor}"]`
|
||||||
|
);
|
||||||
|
if (heading) {
|
||||||
|
// Add the class
|
||||||
|
heading.classList.add("reveal-anchorjs-link");
|
||||||
|
|
||||||
|
// function to show the anchor
|
||||||
|
const handleMouseout = () => {
|
||||||
|
heading.classList.remove("reveal-anchorjs-link");
|
||||||
|
heading.removeEventListener("mouseout", handleMouseout);
|
||||||
|
};
|
||||||
|
|
||||||
|
// add a function to clear the anchor when the user mouses out of it
|
||||||
|
heading.addEventListener("mouseout", handleMouseout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const sections = tocLinks.map((link) => {
|
||||||
|
const target = link.getAttribute("data-scroll-target");
|
||||||
|
if (target.startsWith("#")) {
|
||||||
|
return window.document.getElementById(decodeURI(`${target.slice(1)}`));
|
||||||
|
} else {
|
||||||
|
return window.document.querySelector(decodeURI(`${target}`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const sectionMargin = 200;
|
||||||
|
let currentActive = 0;
|
||||||
|
// track whether we've initialized state the first time
|
||||||
|
let init = false;
|
||||||
|
|
||||||
|
const updateActiveLink = () => {
|
||||||
|
// The index from bottom to top (e.g. reversed list)
|
||||||
|
let sectionIndex = -1;
|
||||||
|
if (
|
||||||
|
window.innerHeight + window.pageYOffset >=
|
||||||
|
window.document.body.offsetHeight
|
||||||
|
) {
|
||||||
|
// This is the no-scroll case where last section should be the active one
|
||||||
|
sectionIndex = 0;
|
||||||
|
} else {
|
||||||
|
// This finds the last section visible on screen that should be made active
|
||||||
|
sectionIndex = [...sections].reverse().findIndex((section) => {
|
||||||
|
if (section) {
|
||||||
|
return window.pageYOffset >= section.offsetTop - sectionMargin;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (sectionIndex > -1) {
|
||||||
|
const current = sections.length - sectionIndex - 1;
|
||||||
|
if (current !== currentActive) {
|
||||||
|
removeAllActive();
|
||||||
|
currentActive = current;
|
||||||
|
makeActive(current);
|
||||||
|
if (init) {
|
||||||
|
window.dispatchEvent(sectionChanged);
|
||||||
|
}
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const inHiddenRegion = (top, bottom, hiddenRegions) => {
|
||||||
|
for (const region of hiddenRegions) {
|
||||||
|
if (top <= region.bottom && bottom >= region.top) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const categorySelector = "header.quarto-title-block .quarto-category";
|
||||||
|
const activateCategories = (href) => {
|
||||||
|
// Find any categories
|
||||||
|
// Surround them with a link pointing back to:
|
||||||
|
// #category=Authoring
|
||||||
|
try {
|
||||||
|
const categoryEls = window.document.querySelectorAll(categorySelector);
|
||||||
|
for (const categoryEl of categoryEls) {
|
||||||
|
const categoryText = categoryEl.textContent;
|
||||||
|
if (categoryText) {
|
||||||
|
const link = `${href}#category=${encodeURIComponent(categoryText)}`;
|
||||||
|
const linkEl = window.document.createElement("a");
|
||||||
|
linkEl.setAttribute("href", link);
|
||||||
|
for (const child of categoryEl.childNodes) {
|
||||||
|
linkEl.append(child);
|
||||||
|
}
|
||||||
|
categoryEl.appendChild(linkEl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Ignore errors
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function hasTitleCategories() {
|
||||||
|
return window.document.querySelector(categorySelector) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function offsetRelativeUrl(url) {
|
||||||
|
const offset = getMeta("quarto:offset");
|
||||||
|
return offset ? offset + url : url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function offsetAbsoluteUrl(url) {
|
||||||
|
const offset = getMeta("quarto:offset");
|
||||||
|
const baseUrl = new URL(offset, window.location);
|
||||||
|
|
||||||
|
const projRelativeUrl = url.replace(baseUrl, "");
|
||||||
|
if (projRelativeUrl.startsWith("/")) {
|
||||||
|
return projRelativeUrl;
|
||||||
|
} else {
|
||||||
|
return "/" + projRelativeUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read a meta tag value
|
||||||
|
function getMeta(metaName) {
|
||||||
|
const metas = window.document.getElementsByTagName("meta");
|
||||||
|
for (let i = 0; i < metas.length; i++) {
|
||||||
|
if (metas[i].getAttribute("name") === metaName) {
|
||||||
|
return metas[i].getAttribute("content");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findAndActivateCategories() {
|
||||||
|
// Categories search with listing only use path without query
|
||||||
|
const currentPagePath = offsetAbsoluteUrl(
|
||||||
|
window.location.origin + window.location.pathname
|
||||||
|
);
|
||||||
|
const response = await fetch(offsetRelativeUrl("listings.json"));
|
||||||
|
if (response.status == 200) {
|
||||||
|
return response.json().then(function (listingPaths) {
|
||||||
|
const listingHrefs = [];
|
||||||
|
for (const listingPath of listingPaths) {
|
||||||
|
const pathWithoutLeadingSlash = listingPath.listing.substring(1);
|
||||||
|
for (const item of listingPath.items) {
|
||||||
|
const encodedItem = encodeURI(item);
|
||||||
|
if (
|
||||||
|
encodedItem === currentPagePath ||
|
||||||
|
encodedItem === currentPagePath + "index.html"
|
||||||
|
) {
|
||||||
|
// Resolve this path against the offset to be sure
|
||||||
|
// we already are using the correct path to the listing
|
||||||
|
// (this adjusts the listing urls to be rooted against
|
||||||
|
// whatever root the page is actually running against)
|
||||||
|
const relative = offsetRelativeUrl(pathWithoutLeadingSlash);
|
||||||
|
const baseUrl = window.location;
|
||||||
|
const resolvedPath = new URL(relative, baseUrl);
|
||||||
|
listingHrefs.push(resolvedPath.pathname);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look up the tree for a nearby linting and use that if we find one
|
||||||
|
const nearestListing = findNearestParentListing(
|
||||||
|
offsetAbsoluteUrl(window.location.pathname),
|
||||||
|
listingHrefs
|
||||||
|
);
|
||||||
|
if (nearestListing) {
|
||||||
|
activateCategories(nearestListing);
|
||||||
|
} else {
|
||||||
|
// See if the referrer is a listing page for this item
|
||||||
|
const referredRelativePath = offsetAbsoluteUrl(document.referrer);
|
||||||
|
const referrerListing = listingHrefs.find((listingHref) => {
|
||||||
|
const isListingReferrer =
|
||||||
|
listingHref === referredRelativePath ||
|
||||||
|
listingHref === referredRelativePath + "index.html";
|
||||||
|
return isListingReferrer;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (referrerListing) {
|
||||||
|
// Try to use the referrer if possible
|
||||||
|
activateCategories(referrerListing);
|
||||||
|
} else if (listingHrefs.length > 0) {
|
||||||
|
// Otherwise, just fall back to the first listing
|
||||||
|
activateCategories(listingHrefs[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasTitleCategories()) {
|
||||||
|
findAndActivateCategories();
|
||||||
|
}
|
||||||
|
|
||||||
|
const findNearestParentListing = (href, listingHrefs) => {
|
||||||
|
if (!href || !listingHrefs) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// Look up the tree for a nearby linting and use that if we find one
|
||||||
|
const relativeParts = href.substring(1).split("/");
|
||||||
|
while (relativeParts.length > 0) {
|
||||||
|
const path = relativeParts.join("/");
|
||||||
|
for (const listingHref of listingHrefs) {
|
||||||
|
if (listingHref.startsWith(path)) {
|
||||||
|
return listingHref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
relativeParts.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const manageSidebarVisiblity = (el, placeholderDescriptor) => {
|
||||||
|
let isVisible = true;
|
||||||
|
let elRect;
|
||||||
|
|
||||||
|
return (hiddenRegions) => {
|
||||||
|
if (el === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the last element of the TOC
|
||||||
|
const lastChildEl = el.lastElementChild;
|
||||||
|
|
||||||
|
if (lastChildEl) {
|
||||||
|
// Converts the sidebar to a menu
|
||||||
|
const convertToMenu = () => {
|
||||||
|
for (const child of el.children) {
|
||||||
|
child.style.opacity = 0;
|
||||||
|
child.style.overflow = "hidden";
|
||||||
|
child.style.pointerEvents = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
nexttick(() => {
|
||||||
|
const toggleContainer = window.document.createElement("div");
|
||||||
|
toggleContainer.style.width = "100%";
|
||||||
|
toggleContainer.classList.add("zindex-over-content");
|
||||||
|
toggleContainer.classList.add("quarto-sidebar-toggle");
|
||||||
|
toggleContainer.classList.add("headroom-target"); // Marks this to be managed by headeroom
|
||||||
|
toggleContainer.id = placeholderDescriptor.id;
|
||||||
|
toggleContainer.style.position = "fixed";
|
||||||
|
|
||||||
|
const toggleIcon = window.document.createElement("i");
|
||||||
|
toggleIcon.classList.add("quarto-sidebar-toggle-icon");
|
||||||
|
toggleIcon.classList.add("bi");
|
||||||
|
toggleIcon.classList.add("bi-caret-down-fill");
|
||||||
|
|
||||||
|
const toggleTitle = window.document.createElement("div");
|
||||||
|
const titleEl = window.document.body.querySelector(
|
||||||
|
placeholderDescriptor.titleSelector
|
||||||
|
);
|
||||||
|
if (titleEl) {
|
||||||
|
toggleTitle.append(
|
||||||
|
titleEl.textContent || titleEl.innerText,
|
||||||
|
toggleIcon
|
||||||
|
);
|
||||||
|
}
|
||||||
|
toggleTitle.classList.add("zindex-over-content");
|
||||||
|
toggleTitle.classList.add("quarto-sidebar-toggle-title");
|
||||||
|
toggleContainer.append(toggleTitle);
|
||||||
|
|
||||||
|
const toggleContents = window.document.createElement("div");
|
||||||
|
toggleContents.classList = el.classList;
|
||||||
|
toggleContents.classList.add("zindex-over-content");
|
||||||
|
toggleContents.classList.add("quarto-sidebar-toggle-contents");
|
||||||
|
for (const child of el.children) {
|
||||||
|
if (child.id === "toc-title") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const clone = child.cloneNode(true);
|
||||||
|
clone.style.opacity = 1;
|
||||||
|
clone.style.pointerEvents = null;
|
||||||
|
clone.style.display = null;
|
||||||
|
toggleContents.append(clone);
|
||||||
|
}
|
||||||
|
toggleContents.style.height = "0px";
|
||||||
|
const positionToggle = () => {
|
||||||
|
// position the element (top left of parent, same width as parent)
|
||||||
|
if (!elRect) {
|
||||||
|
elRect = el.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
toggleContainer.style.left = `${elRect.left}px`;
|
||||||
|
toggleContainer.style.top = `${elRect.top}px`;
|
||||||
|
toggleContainer.style.width = `${elRect.width}px`;
|
||||||
|
};
|
||||||
|
positionToggle();
|
||||||
|
|
||||||
|
toggleContainer.append(toggleContents);
|
||||||
|
el.parentElement.prepend(toggleContainer);
|
||||||
|
|
||||||
|
// Process clicks
|
||||||
|
let tocShowing = false;
|
||||||
|
// Allow the caller to control whether this is dismissed
|
||||||
|
// when it is clicked (e.g. sidebar navigation supports
|
||||||
|
// opening and closing the nav tree, so don't dismiss on click)
|
||||||
|
const clickEl = placeholderDescriptor.dismissOnClick
|
||||||
|
? toggleContainer
|
||||||
|
: toggleTitle;
|
||||||
|
|
||||||
|
const closeToggle = () => {
|
||||||
|
if (tocShowing) {
|
||||||
|
toggleContainer.classList.remove("expanded");
|
||||||
|
toggleContents.style.height = "0px";
|
||||||
|
tocShowing = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get rid of any expanded toggle if the user scrolls
|
||||||
|
window.document.addEventListener(
|
||||||
|
"scroll",
|
||||||
|
throttle(() => {
|
||||||
|
closeToggle();
|
||||||
|
}, 50)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle positioning of the toggle
|
||||||
|
window.addEventListener(
|
||||||
|
"resize",
|
||||||
|
throttle(() => {
|
||||||
|
elRect = undefined;
|
||||||
|
positionToggle();
|
||||||
|
}, 50)
|
||||||
|
);
|
||||||
|
|
||||||
|
window.addEventListener("quarto-hrChanged", () => {
|
||||||
|
elRect = undefined;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Process the click
|
||||||
|
clickEl.onclick = () => {
|
||||||
|
if (!tocShowing) {
|
||||||
|
toggleContainer.classList.add("expanded");
|
||||||
|
toggleContents.style.height = null;
|
||||||
|
tocShowing = true;
|
||||||
|
} else {
|
||||||
|
closeToggle();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Converts a sidebar from a menu back to a sidebar
|
||||||
|
const convertToSidebar = () => {
|
||||||
|
for (const child of el.children) {
|
||||||
|
child.style.opacity = 1;
|
||||||
|
child.style.overflow = null;
|
||||||
|
child.style.pointerEvents = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const placeholderEl = window.document.getElementById(
|
||||||
|
placeholderDescriptor.id
|
||||||
|
);
|
||||||
|
if (placeholderEl) {
|
||||||
|
placeholderEl.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
el.classList.remove("rollup");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isReaderMode()) {
|
||||||
|
convertToMenu();
|
||||||
|
isVisible = false;
|
||||||
|
} else {
|
||||||
|
// Find the top and bottom o the element that is being managed
|
||||||
|
const elTop = el.offsetTop;
|
||||||
|
const elBottom =
|
||||||
|
elTop + lastChildEl.offsetTop + lastChildEl.offsetHeight;
|
||||||
|
|
||||||
|
if (!isVisible) {
|
||||||
|
// If the element is current not visible reveal if there are
|
||||||
|
// no conflicts with overlay regions
|
||||||
|
if (!inHiddenRegion(elTop, elBottom, hiddenRegions)) {
|
||||||
|
convertToSidebar();
|
||||||
|
isVisible = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If the element is visible, hide it if it conflicts with overlay regions
|
||||||
|
// and insert a placeholder toggle (or if we're in reader mode)
|
||||||
|
if (inHiddenRegion(elTop, elBottom, hiddenRegions)) {
|
||||||
|
convertToMenu();
|
||||||
|
isVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const tabEls = document.querySelectorAll('a[data-bs-toggle="tab"]');
|
||||||
|
for (const tabEl of tabEls) {
|
||||||
|
const id = tabEl.getAttribute("data-bs-target");
|
||||||
|
if (id) {
|
||||||
|
const columnEl = document.querySelector(
|
||||||
|
`${id} .column-margin, .tabset-margin-content`
|
||||||
|
);
|
||||||
|
if (columnEl)
|
||||||
|
tabEl.addEventListener("shown.bs.tab", function (event) {
|
||||||
|
const el = event.srcElement;
|
||||||
|
if (el) {
|
||||||
|
const visibleCls = `${el.id}-margin-content`;
|
||||||
|
// walk up until we find a parent tabset
|
||||||
|
let panelTabsetEl = el.parentElement;
|
||||||
|
while (panelTabsetEl) {
|
||||||
|
if (panelTabsetEl.classList.contains("panel-tabset")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
panelTabsetEl = panelTabsetEl.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (panelTabsetEl) {
|
||||||
|
const prevSib = panelTabsetEl.previousElementSibling;
|
||||||
|
if (
|
||||||
|
prevSib &&
|
||||||
|
prevSib.classList.contains("tabset-margin-container")
|
||||||
|
) {
|
||||||
|
const childNodes = prevSib.querySelectorAll(
|
||||||
|
".tabset-margin-content"
|
||||||
|
);
|
||||||
|
for (const childEl of childNodes) {
|
||||||
|
if (childEl.classList.contains(visibleCls)) {
|
||||||
|
childEl.classList.remove("collapse");
|
||||||
|
} else {
|
||||||
|
childEl.classList.add("collapse");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutMarginEls();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manage the visibility of the toc and the sidebar
|
||||||
|
const marginScrollVisibility = manageSidebarVisiblity(marginSidebarEl, {
|
||||||
|
id: "quarto-toc-toggle",
|
||||||
|
titleSelector: "#toc-title",
|
||||||
|
dismissOnClick: true,
|
||||||
|
});
|
||||||
|
const sidebarScrollVisiblity = manageSidebarVisiblity(sidebarEl, {
|
||||||
|
id: "quarto-sidebarnav-toggle",
|
||||||
|
titleSelector: ".title",
|
||||||
|
dismissOnClick: false,
|
||||||
|
});
|
||||||
|
let tocLeftScrollVisibility;
|
||||||
|
if (leftTocEl) {
|
||||||
|
tocLeftScrollVisibility = manageSidebarVisiblity(leftTocEl, {
|
||||||
|
id: "quarto-lefttoc-toggle",
|
||||||
|
titleSelector: "#toc-title",
|
||||||
|
dismissOnClick: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the first element that uses formatting in special columns
|
||||||
|
const conflictingEls = window.document.body.querySelectorAll(
|
||||||
|
'[class^="column-"], [class*=" column-"], aside, [class*="margin-caption"], [class*=" margin-caption"], [class*="margin-ref"], [class*=" margin-ref"]'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Filter all the possibly conflicting elements into ones
|
||||||
|
// the do conflict on the left or ride side
|
||||||
|
const arrConflictingEls = Array.from(conflictingEls);
|
||||||
|
const leftSideConflictEls = arrConflictingEls.filter((el) => {
|
||||||
|
if (el.tagName === "ASIDE") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Array.from(el.classList).find((className) => {
|
||||||
|
return (
|
||||||
|
className !== "column-body" &&
|
||||||
|
className.startsWith("column-") &&
|
||||||
|
!className.endsWith("right") &&
|
||||||
|
!className.endsWith("container") &&
|
||||||
|
className !== "column-margin"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const rightSideConflictEls = arrConflictingEls.filter((el) => {
|
||||||
|
if (el.tagName === "ASIDE") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasMarginCaption = Array.from(el.classList).find((className) => {
|
||||||
|
return className == "margin-caption";
|
||||||
|
});
|
||||||
|
if (hasMarginCaption) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.from(el.classList).find((className) => {
|
||||||
|
return (
|
||||||
|
className !== "column-body" &&
|
||||||
|
!className.endsWith("container") &&
|
||||||
|
className.startsWith("column-") &&
|
||||||
|
!className.endsWith("left")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const kOverlapPaddingSize = 10;
|
||||||
|
function toRegions(els) {
|
||||||
|
return els.map((el) => {
|
||||||
|
const boundRect = el.getBoundingClientRect();
|
||||||
|
const top =
|
||||||
|
boundRect.top +
|
||||||
|
document.documentElement.scrollTop -
|
||||||
|
kOverlapPaddingSize;
|
||||||
|
return {
|
||||||
|
top,
|
||||||
|
bottom: top + el.scrollHeight + 2 * kOverlapPaddingSize,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let hasObserved = false;
|
||||||
|
const visibleItemObserver = (els) => {
|
||||||
|
let visibleElements = [...els];
|
||||||
|
const intersectionObserver = new IntersectionObserver(
|
||||||
|
(entries, _observer) => {
|
||||||
|
entries.forEach((entry) => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
if (visibleElements.indexOf(entry.target) === -1) {
|
||||||
|
visibleElements.push(entry.target);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
visibleElements = visibleElements.filter((visibleEntry) => {
|
||||||
|
return visibleEntry !== entry;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!hasObserved) {
|
||||||
|
hideOverlappedSidebars();
|
||||||
|
}
|
||||||
|
hasObserved = true;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
els.forEach((el) => {
|
||||||
|
intersectionObserver.observe(el);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
getVisibleEntries: () => {
|
||||||
|
return visibleElements;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const rightElementObserver = visibleItemObserver(rightSideConflictEls);
|
||||||
|
const leftElementObserver = visibleItemObserver(leftSideConflictEls);
|
||||||
|
|
||||||
|
const hideOverlappedSidebars = () => {
|
||||||
|
marginScrollVisibility(toRegions(rightElementObserver.getVisibleEntries()));
|
||||||
|
sidebarScrollVisiblity(toRegions(leftElementObserver.getVisibleEntries()));
|
||||||
|
if (tocLeftScrollVisibility) {
|
||||||
|
tocLeftScrollVisibility(
|
||||||
|
toRegions(leftElementObserver.getVisibleEntries())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.quartoToggleReader = () => {
|
||||||
|
// Applies a slow class (or removes it)
|
||||||
|
// to update the transition speed
|
||||||
|
const slowTransition = (slow) => {
|
||||||
|
const manageTransition = (id, slow) => {
|
||||||
|
const el = document.getElementById(id);
|
||||||
|
if (el) {
|
||||||
|
if (slow) {
|
||||||
|
el.classList.add("slow");
|
||||||
|
} else {
|
||||||
|
el.classList.remove("slow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
manageTransition("TOC", slow);
|
||||||
|
manageTransition("quarto-sidebar", slow);
|
||||||
|
};
|
||||||
|
const readerMode = !isReaderMode();
|
||||||
|
setReaderModeValue(readerMode);
|
||||||
|
|
||||||
|
// If we're entering reader mode, slow the transition
|
||||||
|
if (readerMode) {
|
||||||
|
slowTransition(readerMode);
|
||||||
|
}
|
||||||
|
highlightReaderToggle(readerMode);
|
||||||
|
hideOverlappedSidebars();
|
||||||
|
|
||||||
|
// If we're exiting reader mode, restore the non-slow transition
|
||||||
|
if (!readerMode) {
|
||||||
|
slowTransition(!readerMode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const highlightReaderToggle = (readerMode) => {
|
||||||
|
const els = document.querySelectorAll(".quarto-reader-toggle");
|
||||||
|
if (els) {
|
||||||
|
els.forEach((el) => {
|
||||||
|
if (readerMode) {
|
||||||
|
el.classList.add("reader");
|
||||||
|
} else {
|
||||||
|
el.classList.remove("reader");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const setReaderModeValue = (val) => {
|
||||||
|
if (window.location.protocol !== "file:") {
|
||||||
|
window.localStorage.setItem("quarto-reader-mode", val);
|
||||||
|
} else {
|
||||||
|
localReaderMode = val;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isReaderMode = () => {
|
||||||
|
if (window.location.protocol !== "file:") {
|
||||||
|
return window.localStorage.getItem("quarto-reader-mode") === "true";
|
||||||
|
} else {
|
||||||
|
return localReaderMode;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let localReaderMode = null;
|
||||||
|
|
||||||
|
const tocOpenDepthStr = tocEl?.getAttribute("data-toc-expanded");
|
||||||
|
const tocOpenDepth = tocOpenDepthStr ? Number(tocOpenDepthStr) : 1;
|
||||||
|
|
||||||
|
// Walk the TOC and collapse/expand nodes
|
||||||
|
// Nodes are expanded if:
|
||||||
|
// - they are top level
|
||||||
|
// - they have children that are 'active' links
|
||||||
|
// - they are directly below an link that is 'active'
|
||||||
|
const walk = (el, depth) => {
|
||||||
|
// Tick depth when we enter a UL
|
||||||
|
if (el.tagName === "UL") {
|
||||||
|
depth = depth + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It this is active link
|
||||||
|
let isActiveNode = false;
|
||||||
|
if (el.tagName === "A" && el.classList.contains("active")) {
|
||||||
|
isActiveNode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if there is an active child to this element
|
||||||
|
let hasActiveChild = false;
|
||||||
|
for (const child of el.children) {
|
||||||
|
hasActiveChild = walk(child, depth) || hasActiveChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the collapse state if this is an UL
|
||||||
|
if (el.tagName === "UL") {
|
||||||
|
if (tocOpenDepth === -1 && depth > 1) {
|
||||||
|
// toc-expand: false
|
||||||
|
el.classList.add("collapse");
|
||||||
|
} else if (
|
||||||
|
depth <= tocOpenDepth ||
|
||||||
|
hasActiveChild ||
|
||||||
|
prevSiblingIsActiveLink(el)
|
||||||
|
) {
|
||||||
|
el.classList.remove("collapse");
|
||||||
|
} else {
|
||||||
|
el.classList.add("collapse");
|
||||||
|
}
|
||||||
|
|
||||||
|
// untick depth when we leave a UL
|
||||||
|
depth = depth - 1;
|
||||||
|
}
|
||||||
|
return hasActiveChild || isActiveNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
// walk the TOC and expand / collapse any items that should be shown
|
||||||
|
if (tocEl) {
|
||||||
|
updateActiveLink();
|
||||||
|
walk(tocEl, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Throttle the scroll event and walk peridiocally
|
||||||
|
window.document.addEventListener(
|
||||||
|
"scroll",
|
||||||
|
throttle(() => {
|
||||||
|
if (tocEl) {
|
||||||
|
updateActiveLink();
|
||||||
|
walk(tocEl, 0);
|
||||||
|
}
|
||||||
|
if (!isReaderMode()) {
|
||||||
|
hideOverlappedSidebars();
|
||||||
|
}
|
||||||
|
}, 5)
|
||||||
|
);
|
||||||
|
window.addEventListener(
|
||||||
|
"resize",
|
||||||
|
throttle(() => {
|
||||||
|
if (tocEl) {
|
||||||
|
updateActiveLink();
|
||||||
|
walk(tocEl, 0);
|
||||||
|
}
|
||||||
|
if (!isReaderMode()) {
|
||||||
|
hideOverlappedSidebars();
|
||||||
|
}
|
||||||
|
}, 10)
|
||||||
|
);
|
||||||
|
hideOverlappedSidebars();
|
||||||
|
highlightReaderToggle(isReaderMode());
|
||||||
|
});
|
||||||
|
|
||||||
|
tabsets.init();
|
||||||
|
|
||||||
|
function throttle(func, wait) {
|
||||||
|
let waiting = false;
|
||||||
|
return function () {
|
||||||
|
if (!waiting) {
|
||||||
|
func.apply(this, arguments);
|
||||||
|
waiting = true;
|
||||||
|
setTimeout(function () {
|
||||||
|
waiting = false;
|
||||||
|
}, wait);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function nexttick(func) {
|
||||||
|
return setTimeout(func, 0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
// grouped tabsets
|
||||||
|
|
||||||
|
export function init() {
|
||||||
|
window.addEventListener("pageshow", (_event) => {
|
||||||
|
function getTabSettings() {
|
||||||
|
const data = localStorage.getItem("quarto-persistent-tabsets-data");
|
||||||
|
if (!data) {
|
||||||
|
localStorage.setItem("quarto-persistent-tabsets-data", "{}");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
if (data) {
|
||||||
|
return JSON.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTabSettings(data) {
|
||||||
|
localStorage.setItem(
|
||||||
|
"quarto-persistent-tabsets-data",
|
||||||
|
JSON.stringify(data)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTabState(groupName, groupValue) {
|
||||||
|
const data = getTabSettings();
|
||||||
|
data[groupName] = groupValue;
|
||||||
|
setTabSettings(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleTab(tab, active) {
|
||||||
|
const tabPanelId = tab.getAttribute("aria-controls");
|
||||||
|
const tabPanel = document.getElementById(tabPanelId);
|
||||||
|
if (active) {
|
||||||
|
tab.classList.add("active");
|
||||||
|
tabPanel.classList.add("active");
|
||||||
|
} else {
|
||||||
|
tab.classList.remove("active");
|
||||||
|
tabPanel.classList.remove("active");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAll(selectedGroup, selectorsToSync) {
|
||||||
|
for (const [thisGroup, tabs] of Object.entries(selectorsToSync)) {
|
||||||
|
const active = selectedGroup === thisGroup;
|
||||||
|
for (const tab of tabs) {
|
||||||
|
toggleTab(tab, active);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function findSelectorsToSyncByLanguage() {
|
||||||
|
const result = {};
|
||||||
|
const tabs = Array.from(
|
||||||
|
document.querySelectorAll(`div[data-group] a[id^='tabset-']`)
|
||||||
|
);
|
||||||
|
for (const item of tabs) {
|
||||||
|
const div = item.parentElement.parentElement.parentElement;
|
||||||
|
const group = div.getAttribute("data-group");
|
||||||
|
if (!result[group]) {
|
||||||
|
result[group] = {};
|
||||||
|
}
|
||||||
|
const selectorsToSync = result[group];
|
||||||
|
const value = item.innerHTML;
|
||||||
|
if (!selectorsToSync[value]) {
|
||||||
|
selectorsToSync[value] = [];
|
||||||
|
}
|
||||||
|
selectorsToSync[value].push(item);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupSelectorSync() {
|
||||||
|
const selectorsToSync = findSelectorsToSyncByLanguage();
|
||||||
|
Object.entries(selectorsToSync).forEach(([group, tabSetsByValue]) => {
|
||||||
|
Object.entries(tabSetsByValue).forEach(([value, items]) => {
|
||||||
|
items.forEach((item) => {
|
||||||
|
item.addEventListener("click", (_event) => {
|
||||||
|
setTabState(group, value);
|
||||||
|
toggleAll(value, selectorsToSync[group]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return selectorsToSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectorsToSync = setupSelectorSync();
|
||||||
|
for (const [group, selectedName] of Object.entries(getTabSettings())) {
|
||||||
|
const selectors = selectorsToSync[group];
|
||||||
|
// it's possible that stale state gives us empty selections, so we explicitly check here.
|
||||||
|
if (selectors) {
|
||||||
|
toggleAll(selectedName, selectors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],t):(e=e||self).tippy=t(e.Popper)}(this,(function(e){"use strict";var t={passive:!0,capture:!0},n=function(){return document.body};function r(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function o(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function i(e,t){return"function"==typeof e?e.apply(void 0,t):e}function a(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function s(e,t){var n=Object.assign({},e);return t.forEach((function(e){delete n[e]})),n}function u(e){return[].concat(e)}function c(e,t){-1===e.indexOf(t)&&e.push(t)}function p(e){return e.split("-")[0]}function f(e){return[].slice.call(e)}function l(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function d(){return document.createElement("div")}function v(e){return["Element","Fragment"].some((function(t){return o(e,t)}))}function m(e){return o(e,"MouseEvent")}function g(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function h(e){return v(e)?[e]:function(e){return o(e,"NodeList")}(e)?f(e):Array.isArray(e)?e:f(document.querySelectorAll(e))}function b(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function y(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function w(e){var t,n=u(e)[0];return null!=n&&null!=(t=n.ownerDocument)&&t.body?n.ownerDocument:document}function E(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function O(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var x={isTouch:!1},C=0;function T(){x.isTouch||(x.isTouch=!0,window.performance&&document.addEventListener("mousemove",A))}function A(){var e=performance.now();e-C<20&&(x.isTouch=!1,document.removeEventListener("mousemove",A)),C=e}function L(){var e=document.activeElement;if(g(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var D=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto,R=Object.assign({appendTo:n,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),k=Object.keys(R);function P(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=R[o])?r:i);return t}),{});return Object.assign({},e,t)}function j(e,t){var n=Object.assign({},t,{content:i(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(P(Object.assign({},R,{plugins:t}))):k).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},R.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function M(e,t){e.innerHTML=t}function V(e){var t=d();return!0===e?t.className="tippy-arrow":(t.className="tippy-svg-arrow",v(e)?t.appendChild(e):M(t,e)),t}function I(e,t){v(t.content)?(M(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?M(e,t.content):e.textContent=t.content)}function S(e){var t=e.firstElementChild,n=f(t.children);return{box:t,content:n.find((function(e){return e.classList.contains("tippy-content")})),arrow:n.find((function(e){return e.classList.contains("tippy-arrow")||e.classList.contains("tippy-svg-arrow")})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function N(e){var t=d(),n=d();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=d();function o(n,r){var o=S(t),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==tyLine truncated
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
!function(t,e){"function"==typeof define&&define.amd?define([],e()):"object"==typeof module&&module.exports?module.exports=e():function n(){document&&document.body?t.zenscroll=e():setTimeout(n,9)}()}(this,function(){"use strict";var t=function(t){return t&&"getComputedStyle"in window&&"smooth"===window.getComputedStyle(t)["scroll-behavior"]};if("undefined"==typeof window||!("document"in window))return{};var e=function(e,n,o){n=n||999,o||0===o||(o=9);var i,r=function(t){i=t},u=function(){clearTimeout(i),r(0)},c=function(t){return Math.max(0,e.getTopOf(t)-o)},a=function(o,i,c){if(u(),0===i||i&&i<0||t(e.body))e.toY(o),c&&c();else{var a=e.getY(),f=Math.max(0,o)-a,s=(new Date).getTime();i=i||Math.min(Math.abs(f),n),function t(){r(setTimeout(function(){var n=Math.min(1,((new Date).getTime()-s)/i),o=Math.max(0,Math.floor(a+f*(n<.5?2*n*n:n*(4-2*n)-1)));e.toY(o),n<1&&e.getHeight()+o<e.body.scrollHeight?t():(setTimeout(u,99),c&&c())},9))}()}},f=function(t,e,n){a(c(t),e,n)},s=function(t,n,i){var r=t.getBoundingClientRect().height,u=e.getTopOf(t)+r,s=e.getHeight(),l=e.getY(),d=l+s;c(t)<l||r+o>s?f(t,n,i):u+o>d?a(u-s+o,n,i):i&&i()},l=function(t,n,o,i){a(Math.max(0,e.getTopOf(t)-e.getHeight()/2+(o||t.getBoundingClientRect().height/2)),n,i)};return{setup:function(t,e){return(0===t||t)&&(n=t),(0===e||e)&&(o=e),{defaultDuration:n,edgeOffset:o}},to:f,toY:a,intoView:s,center:l,stop:u,moving:function(){return!!i},getY:e.getY,getTopOf:e.getTopOf}},n=document.documentElement,o=function(){return window.scrollY||n.scrollTop},i=e({body:document.scrollingElement||document.body,toY:function(t){window.scrollTo(0,t)},getY:o,getHeight:function(){return window.innerHeight||n.clientHeight},getTopOf:function(t){return t.getBoundingClientRect().top+o()-n.offsetTop}});if(i.createScroller=function(t,o,i){return e({body:t,toY:function(e){t.scrollTop=e},getY:function(){return t.scrollTop},getHeight:function(){return Math.min(t.clientHeight,window.innerHeight||n.clientHeight)},getTopOf:function(t){return t.offsetTop}},o,i)},"addEventListener"in window&&!window.noZensmooth&&!t(document.body)){var r="history"in window&&"pushState"in history,u=r&&"scrollRestoration"in history;u&&(history.scrollRestoration="auto"),window.addEventListener("load",function(){u&&(setTimeout(function(){history.scrollRestoration="manual"},9),window.addEventListener("popstate",function(t){t.state&&"zenscrollY"in t.state&&i.toY(t.state.zenscrollY)},!1)),window.location.hash&&setTimeout(function(){var t=i.setup().edgeOffset;if(t){var e=document.getElementById(window.location.href.split("#")[1]);if(e){var n=Math.max(0,i.getTopOf(e)-t),o=i.getY()-n;0<=o&&o<9&&window.scrollTo(0,n)}}},9)},!1);var c=new RegExp("(^|\\s)noZensmooth(\\s|$)");window.addEventListener("click",function(t){for(var e=t.target;e&&"A"!==e.tagName;)e=e.parentNode;if(!(!e||1!==t.which||t.shiftKey||t.metaKey||t.ctrlKey||t.altKey)){if(u){var n=history.state&&"object"==typeof history.state?history.state:{};n.zenscrollY=i.getY();try{history.replaceState(n,"")}catch(t){}}var o=e.getAttribute("href")||"";if(0===o.indexOf("#")&&!c.test(e.className)){var a=0,f=document.getElementById(o.substring(1));if("#"!==o){if(!f)return;a=i.getTopOf(f)}t.preventDefault();var s=function(){window.location=o},l=i.setup().edgeOffset;l&&(a=Math.max(0,a-l),r&&(s=function(){history.pushState({},"",o)})),i.toY(a,null,s)}}},!1)}return i});
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/*!
|
||||||
|
* headroom.js v0.12.0 - Give your page some headroom. Hide your header until you need it
|
||||||
|
* Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js
|
||||||
|
* License: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=l<t?"down":"up",a.distance=Math.abs(t-l),a.isOutOfBounds=t<0||o<t+n,a.top=t<=s.offset[a.direction],a.bottom=o<=t+n,a.toleranceExceeded=a.distance>s.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t){return t===Object(t)?t:{down:t,up:t}}function s(t,n){n=n||{},Object.assign(this,s.options,n),this.classes=Object.assign({},s.options.classes,n.classes),this.elem=t,this.tolerance=o(this.tolerance),this.offset=o(this.offset),this.initialised=!1,this.frozen=!1}return s.prototype={constructor:s,init:function(){return s.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEach(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},s.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},s.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),s});
|
||||||
@@ -0,0 +1,328 @@
|
|||||||
|
const headroomChanged = new CustomEvent("quarto-hrChanged", {
|
||||||
|
detail: {},
|
||||||
|
bubbles: true,
|
||||||
|
cancelable: false,
|
||||||
|
composed: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const announceDismiss = () => {
|
||||||
|
const annEl = window.document.getElementById("quarto-announcement");
|
||||||
|
if (annEl) {
|
||||||
|
annEl.remove();
|
||||||
|
|
||||||
|
const annId = annEl.getAttribute("data-announcement-id");
|
||||||
|
window.localStorage.setItem(`quarto-announce-${annId}`, "true");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const announceRegister = () => {
|
||||||
|
const annEl = window.document.getElementById("quarto-announcement");
|
||||||
|
if (annEl) {
|
||||||
|
const annId = annEl.getAttribute("data-announcement-id");
|
||||||
|
const isDismissed =
|
||||||
|
window.localStorage.getItem(`quarto-announce-${annId}`) || false;
|
||||||
|
if (isDismissed) {
|
||||||
|
announceDismiss();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
annEl.classList.remove("hidden");
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionEl = annEl.querySelector(".quarto-announcement-action");
|
||||||
|
if (actionEl) {
|
||||||
|
actionEl.addEventListener("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// Hide the bar immediately
|
||||||
|
announceDismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
let init = false;
|
||||||
|
|
||||||
|
announceRegister();
|
||||||
|
|
||||||
|
// Manage the back to top button, if one is present.
|
||||||
|
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||||
|
const scrollDownBuffer = 5;
|
||||||
|
const scrollUpBuffer = 35;
|
||||||
|
const btn = document.getElementById("quarto-back-to-top");
|
||||||
|
const hideBackToTop = () => {
|
||||||
|
btn.style.display = "none";
|
||||||
|
};
|
||||||
|
const showBackToTop = () => {
|
||||||
|
btn.style.display = "inline-block";
|
||||||
|
};
|
||||||
|
if (btn) {
|
||||||
|
window.document.addEventListener(
|
||||||
|
"scroll",
|
||||||
|
function () {
|
||||||
|
const currentScrollTop =
|
||||||
|
window.pageYOffset || document.documentElement.scrollTop;
|
||||||
|
|
||||||
|
// Shows and hides the button 'intelligently' as the user scrolls
|
||||||
|
if (currentScrollTop - scrollDownBuffer > lastScrollTop) {
|
||||||
|
hideBackToTop();
|
||||||
|
lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
|
||||||
|
} else if (currentScrollTop < lastScrollTop - scrollUpBuffer) {
|
||||||
|
showBackToTop();
|
||||||
|
lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the button at the bottom, hides it at the top
|
||||||
|
if (currentScrollTop <= 0) {
|
||||||
|
hideBackToTop();
|
||||||
|
} else if (
|
||||||
|
window.innerHeight + currentScrollTop >=
|
||||||
|
document.body.offsetHeight
|
||||||
|
) {
|
||||||
|
showBackToTop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function throttle(func, wait) {
|
||||||
|
var timeout;
|
||||||
|
return function () {
|
||||||
|
const context = this;
|
||||||
|
const args = arguments;
|
||||||
|
const later = function () {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = null;
|
||||||
|
func.apply(context, args);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!timeout) {
|
||||||
|
timeout = setTimeout(later, wait);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function headerOffset() {
|
||||||
|
// Set an offset if there is are fixed top navbar
|
||||||
|
const headerEl = window.document.querySelector("header.fixed-top");
|
||||||
|
if (headerEl) {
|
||||||
|
return headerEl.clientHeight;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function footerOffset() {
|
||||||
|
const footerEl = window.document.querySelector("footer.footer");
|
||||||
|
if (footerEl) {
|
||||||
|
return footerEl.clientHeight;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function dashboardOffset() {
|
||||||
|
const dashboardNavEl = window.document.getElementById(
|
||||||
|
"quarto-dashboard-header"
|
||||||
|
);
|
||||||
|
if (dashboardNavEl !== null) {
|
||||||
|
return dashboardNavEl.clientHeight;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDocumentOffsetWithoutAnimation() {
|
||||||
|
updateDocumentOffset(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDocumentOffset(animated) {
|
||||||
|
// set body offset
|
||||||
|
const topOffset = headerOffset();
|
||||||
|
const bodyOffset = topOffset + footerOffset() + dashboardOffset();
|
||||||
|
const bodyEl = window.document.body;
|
||||||
|
bodyEl.setAttribute("data-bs-offset", topOffset);
|
||||||
|
bodyEl.style.paddingTop = topOffset + "px";
|
||||||
|
|
||||||
|
// deal with sidebar offsets
|
||||||
|
const sidebars = window.document.querySelectorAll(
|
||||||
|
".sidebar, .headroom-target"
|
||||||
|
);
|
||||||
|
sidebars.forEach((sidebar) => {
|
||||||
|
if (!animated) {
|
||||||
|
sidebar.classList.add("notransition");
|
||||||
|
// Remove the no transition class after the animation has time to complete
|
||||||
|
setTimeout(function () {
|
||||||
|
sidebar.classList.remove("notransition");
|
||||||
|
}, 201);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.Headroom && sidebar.classList.contains("sidebar-unpinned")) {
|
||||||
|
sidebar.style.top = "0";
|
||||||
|
sidebar.style.maxHeight = "100vh";
|
||||||
|
} else {
|
||||||
|
sidebar.style.top = topOffset + "px";
|
||||||
|
sidebar.style.maxHeight = "calc(100vh - " + topOffset + "px)";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// allow space for footer
|
||||||
|
const mainContainer = window.document.querySelector(".quarto-container");
|
||||||
|
if (mainContainer) {
|
||||||
|
mainContainer.style.minHeight = "calc(100vh - " + bodyOffset + "px)";
|
||||||
|
}
|
||||||
|
|
||||||
|
// link offset
|
||||||
|
let linkStyle = window.document.querySelector("#quarto-target-style");
|
||||||
|
if (!linkStyle) {
|
||||||
|
linkStyle = window.document.createElement("style");
|
||||||
|
linkStyle.setAttribute("id", "quarto-target-style");
|
||||||
|
window.document.head.appendChild(linkStyle);
|
||||||
|
}
|
||||||
|
while (linkStyle.firstChild) {
|
||||||
|
linkStyle.removeChild(linkStyle.firstChild);
|
||||||
|
}
|
||||||
|
if (topOffset > 0) {
|
||||||
|
linkStyle.appendChild(
|
||||||
|
window.document.createTextNode(`
|
||||||
|
section:target::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
height: ${topOffset}px;
|
||||||
|
margin: -${topOffset}px 0 0;
|
||||||
|
}`)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (init) {
|
||||||
|
window.dispatchEvent(headroomChanged);
|
||||||
|
}
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize headroom
|
||||||
|
var header = window.document.querySelector("#quarto-header");
|
||||||
|
if (header && window.Headroom) {
|
||||||
|
const headroom = new window.Headroom(header, {
|
||||||
|
tolerance: 5,
|
||||||
|
onPin: function () {
|
||||||
|
const sidebars = window.document.querySelectorAll(
|
||||||
|
".sidebar, .headroom-target"
|
||||||
|
);
|
||||||
|
sidebars.forEach((sidebar) => {
|
||||||
|
sidebar.classList.remove("sidebar-unpinned");
|
||||||
|
});
|
||||||
|
updateDocumentOffset();
|
||||||
|
},
|
||||||
|
onUnpin: function () {
|
||||||
|
const sidebars = window.document.querySelectorAll(
|
||||||
|
".sidebar, .headroom-target"
|
||||||
|
);
|
||||||
|
sidebars.forEach((sidebar) => {
|
||||||
|
sidebar.classList.add("sidebar-unpinned");
|
||||||
|
});
|
||||||
|
updateDocumentOffset();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
headroom.init();
|
||||||
|
|
||||||
|
let frozen = false;
|
||||||
|
window.quartoToggleHeadroom = function () {
|
||||||
|
if (frozen) {
|
||||||
|
headroom.unfreeze();
|
||||||
|
frozen = false;
|
||||||
|
} else {
|
||||||
|
headroom.freeze();
|
||||||
|
frozen = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener(
|
||||||
|
"hashchange",
|
||||||
|
function (e) {
|
||||||
|
if (
|
||||||
|
getComputedStyle(document.documentElement).scrollBehavior !== "smooth"
|
||||||
|
) {
|
||||||
|
window.scrollTo(0, window.pageYOffset - headerOffset());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
// Observe size changed for the header
|
||||||
|
const headerEl = window.document.querySelector("header.fixed-top");
|
||||||
|
if (headerEl && window.ResizeObserver) {
|
||||||
|
const observer = new window.ResizeObserver(() => {
|
||||||
|
setTimeout(updateDocumentOffsetWithoutAnimation, 0);
|
||||||
|
});
|
||||||
|
observer.observe(headerEl, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.addEventListener(
|
||||||
|
"resize",
|
||||||
|
throttle(updateDocumentOffsetWithoutAnimation, 50)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setTimeout(updateDocumentOffsetWithoutAnimation, 250);
|
||||||
|
|
||||||
|
// fixup index.html links if we aren't on the filesystem
|
||||||
|
if (window.location.protocol !== "file:") {
|
||||||
|
const links = window.document.querySelectorAll("a");
|
||||||
|
for (let i = 0; i < links.length; i++) {
|
||||||
|
if (links[i].href) {
|
||||||
|
links[i].dataset.originalHref = links[i].href;
|
||||||
|
// only strip index.html at the end of the path (optionally followed
|
||||||
|
// by a query or fragment) so that files like index.html.md
|
||||||
|
// (alternate-format twins) are left alone (#14667)
|
||||||
|
links[i].href = links[i].href.replace(/\/index\.html(?=[?#]|$)/, "/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixup any sharing links that require urls
|
||||||
|
// Append url to any sharing urls
|
||||||
|
const sharingLinks = window.document.querySelectorAll(
|
||||||
|
"a.sidebar-tools-main-item, a.quarto-navigation-tool, a.quarto-navbar-tools, a.quarto-navbar-tools-item"
|
||||||
|
);
|
||||||
|
for (let i = 0; i < sharingLinks.length; i++) {
|
||||||
|
const sharingLink = sharingLinks[i];
|
||||||
|
const href = sharingLink.getAttribute("href");
|
||||||
|
if (href) {
|
||||||
|
sharingLink.setAttribute(
|
||||||
|
"href",
|
||||||
|
href.replace("|url|", window.location.href)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scroll the active navigation item into view, if necessary
|
||||||
|
const navSidebar = window.document.querySelector("nav#quarto-sidebar");
|
||||||
|
if (navSidebar) {
|
||||||
|
// Find the active item
|
||||||
|
const activeItem = navSidebar.querySelector("li.sidebar-item a.active");
|
||||||
|
if (activeItem) {
|
||||||
|
// Wait for the scroll height and height to resolve by observing size changes on the
|
||||||
|
// nav element that is scrollable
|
||||||
|
const resizeObserver = new ResizeObserver((_entries) => {
|
||||||
|
// The bottom of the element
|
||||||
|
const elBottom = activeItem.offsetTop;
|
||||||
|
const viewBottom = navSidebar.scrollTop + navSidebar.clientHeight;
|
||||||
|
|
||||||
|
// The element height and scroll height are the same, then we are still loading
|
||||||
|
if (viewBottom !== navSidebar.scrollHeight) {
|
||||||
|
// Determine if the item isn't visible and scroll to it
|
||||||
|
if (elBottom >= viewBottom) {
|
||||||
|
navSidebar.scrollTop = elBottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop observing now since we've completed the scroll
|
||||||
|
resizeObserver.unobserve(navSidebar);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
resizeObserver.observe(navSidebar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/*! @algolia/autocomplete-js 1.19.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
|
||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-js"]={})}(this,(function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e){return{current:e}}function p(e,t){var n=void 0;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(void 0,o)}),t)}}function m(e){return e.reduce((function(e,t){return e.concat(t)}),[])}var v=0;function d(){return"autocomplete-".concat(v++)}function y(e,t){return t.reduce((function(e,t){return e&&e[t]}),e)}function b(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function g(e){return e!==Object(e)}function h(e,t){if(e===t)return!0;if(g(e)||g(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(!(o in t))return!1;if(!h(e[o],t[o]))return!1}return!0}var _=function(){};var O="1.19.1",S=[{segment:"autocomplete-core",version:O}];function j(e){var t=e.item,n=e.items,r=void 0===n?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.pLine truncated
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 Kiro Risk (http://kiro.me)
|
||||||
|
* All Rights Reserved. Apache Software License 2.0
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&u(e,t)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h(this,n)}}function f(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e){return Array.isArray?Array.isArray(e):"[object Array]"===b(e)}function g(e){return"string"==typeof e}function y(e){return"number"==typeof e}function p(e){return!0===e||!1===e||function(e){return m(e)&&null!==e}(e)&&"[object Boolean]"==b(e)}function m(e){return"object"===n(e)}function k(e){return null!=e}function M(e){return!e.trim().length}function b(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var x=function(e){return"Invalid value for key ".concat(e)},w=function(e){return"Pattern length exceeds max of ".concat(e,".")},L=Object.prototype.hasOwnProperty,S=function(){function e(t){var n=this;r(this,e),this._keys=[],this._keyMap={};var i=0;t.forEach((function(e){var t=_(e);i+=t.weight,n._keys.push(t),n._keyMap[t.id]=t,i+=t.weight})),this._keys.forEach((function(e){e.weight/=i}))}return o(e,[{key:"get",value:function(e){return this._keyMap[e]}},{key:"keys",value:function(){return this._keys}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}();function _(e){var t=null,n=null,r=null,i=1,o=null;if(g(e)||v(e))r=e,t=O(e),n=j(e);else{if(!L.call(e,"name"))throw new Error(function(e){return"Missing ".concat(e," property in key")}("name"));var c=e.name;if(r=c,L.call(e,"weight")&&(i=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(c));t=O(c),n=j(c),o=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:o}}function O(e){return v(e)?e:e.split(".")}function j(e){return v(e)?e.join("."):e}var A={useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i,o){if(k(t))if(i[o]){var c=t[i[o]];if(!k(c))return;if(o===i.Line truncated
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,134 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 230" width="760" height="230"
|
||||||
|
role="img" aria-labelledby="dc-title">
|
||||||
|
<title id="dc-title">The procedural version: inside one main(), IO.readln() is called, its result is passed to rot13(), and that result is passed to IO.println(). One thread, one process, three direct calls.</title>
|
||||||
|
<style><![CDATA[
|
||||||
|
/* figures/diagram.css -- shared look of every built figure.
|
||||||
|
*
|
||||||
|
* build-figures.py drops this file into the style element of every built
|
||||||
|
* svg, so a figure carries its own styling and stays self-contained.
|
||||||
|
* Classes, not per-element fills, do the work: one edit here restyles the
|
||||||
|
* whole book.
|
||||||
|
*
|
||||||
|
* Colours are the extension's tokens (_extensions/notes/theme.css) with a
|
||||||
|
* literal fallback, which covers all three ways a figure is seen:
|
||||||
|
*
|
||||||
|
* - inlined into the page by figures/flow-player.html: the tokens resolve
|
||||||
|
* against the page, so the figure follows light, night and high contrast;
|
||||||
|
* - as a plain <img> (JavaScript off): the fallback applies, and night mode
|
||||||
|
* comes from the extension's invert filter on main img[src$=".svg"];
|
||||||
|
* - in the pdf: librsvg ignores var() and uses the fallback, so print gets
|
||||||
|
* the light palette -- which is what a printed page wants.
|
||||||
|
*
|
||||||
|
* The fallbacks are this book's own light values; the tokens carry the night
|
||||||
|
* and high-contrast ones. Nothing here keys off prefers-color-scheme: the
|
||||||
|
* page's toggle decides, never the reader's system setting.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg {
|
||||||
|
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||||
|
/* the figure sits on the page, not on a white card of its own */
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- surfaces ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; }
|
||||||
|
.box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; }
|
||||||
|
.diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
||||||
|
.ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; }
|
||||||
|
|
||||||
|
/* ---- lines ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
.edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; }
|
||||||
|
.edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
||||||
|
.edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; }
|
||||||
|
.edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; }
|
||||||
|
.rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; }
|
||||||
|
|
||||||
|
/* ---- text ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
.t { fill: var(--calc-ink, #1b2430); font-size: 13px; }
|
||||||
|
.t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; }
|
||||||
|
.t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; }
|
||||||
|
.t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; }
|
||||||
|
.t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; }
|
||||||
|
.t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; }
|
||||||
|
.t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px;
|
||||||
|
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
||||||
|
|
||||||
|
.mid { text-anchor: middle; }
|
||||||
|
.end { text-anchor: end; }
|
||||||
|
|
||||||
|
/* ---- interaction ====================================================
|
||||||
|
* A .node groups one box with its labels. Hovering it lifts the whole group
|
||||||
|
* a little, which is enough to follow a path through a busy diagram without
|
||||||
|
* any script. Pointer events stay off the decorative layers so the hover
|
||||||
|
* target is the shape itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.node { transition: opacity .12s ease; }
|
||||||
|
.node:hover .box,
|
||||||
|
.node:hover .box-accent,
|
||||||
|
.node:hover .diamond { stroke-width: 2.6; }
|
||||||
|
.node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
|
||||||
|
svg:hover .node:not(:hover) { opacity: .55; }
|
||||||
|
|
||||||
|
/* a figure that marks no nodes must not dim on hover */
|
||||||
|
svg:not(:has(.node)) .node { opacity: 1; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.node { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- arrowheads ======================================================
|
||||||
|
* marker contents cannot inherit the referencing element's fill, so each
|
||||||
|
* arrowhead is its own class and is themed alongside the line it ends.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.arrow { fill: var(--calc-muted, #5a6879); }
|
||||||
|
.arrow-strong { fill: var(--calc-notecolor, #20666f); }
|
||||||
|
.arrow-warn { fill: var(--calc-accent-b, #D1541F); }
|
||||||
|
|
||||||
|
]]></style>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
||||||
|
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
||||||
|
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- everything happens inside one main(), on one thread -->
|
||||||
|
<rect class="box-plain" x="14" y="16" width="732" height="126" rx="4"/>
|
||||||
|
<text class="t-mut" data-label="frame" x="26" y="36">one process · one thread · one main()</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="read">
|
||||||
|
<rect class="box" x="40" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="read" x="125" y="90">IO.readln()</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<path class="edge" data-flow="1" data-flow-to="rot" d="M210,84 H298" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent mid" data-label="call1" x="254" y="72">call</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="rot">
|
||||||
|
<rect class="box" x="300" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="rot" x="385" y="90">rot13(text)</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<path class="edge" data-flow="2" data-flow-to="print" d="M470,84 H558" marker-end="url(#a)"/>
|
||||||
|
<text class="t-accent mid" data-label="call2" x="514" y="72">call</text>
|
||||||
|
|
||||||
|
<g class="node" data-flow-node="print">
|
||||||
|
<rect class="box" x="560" y="58" width="170" height="52" rx="3"/>
|
||||||
|
<text class="t-mono mid" data-label="print" x="645" y="90">IO.println(…)</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- who knows whom -->
|
||||||
|
<text class="t-sm" data-label="knows" x="14" y="176">main() knows all three: their names, argument and result types, and that they are available right now.</text>
|
||||||
|
<text class="t-mut" data-label="cost" x="14" y="202">The wiring is written into the code itself — step 1.</text>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 6.6 KiB |
Loaded 100 of 269 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user