171 lines
15 KiB
Plaintext
171 lines
15 KiB
Plaintext
# [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.
|
|
:::
|