Part V, VI and VII chapters as written during the course

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
MatsuneMikuroiandClaude Opus 5 committed 2026-10-06 08:15:40 +02:00
1 parent 383e4bc6dd
commit 88eb755e5f
3 files changed
+467

No files matched your search

+162
View File
@@ -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 — the same lesson as the mediator that was restarted and 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é — la même leçon 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** |
:::
+170
View File
@@ -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 of course 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.
:::
+135
View File
@@ -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.
:::