Rebasely Beta: data may be purged

examples/live-notes Public

Map the components and the main flows

system.yaml names the four parts (the Worker, the room, the shared ops library and the page) and what each one calls, and arch check holds it to the imports and bindings in the code. The flows walk through loading a note, an edit reaching other editors, and an editor being caught up with a snapshot.
e0ecd05198bd74ea8f161fec6d91dd21d1054e5d
Parent 359d966 Browse filesHistory

Changed files

5 files changed52 additions0 deletionsagainst 359d966

  1. Added.rebasely/architecture/flows/edit-broadcast.yaml+10−0
  2. Added.rebasely/architecture/flows/load-note.yaml+9−0
  3. Added.rebasely/architecture/flows/resync.yaml+7−0
  4. Added.rebasely/architecture/system.yaml+24−0
  5. Added.rebasely/architecture/views/editing.yaml+2−0
Added.rebasely/architecture/flows/edit-broadcast.yaml+10−0
@@ -0,0 +1,10 @@
+title: An edit reaching other editors
+description: Editor A types while editor B has the same note open. The room puts the edit in order, saves it and passes it on.
+actors: [editor-a, editor-b]
+steps:
+ - { from: editor-a, to: note-room, label: "op: insert \"oat \" at 4, written against version 41" }
+ - { from: note-room, to: ops, label: transform the op past versions 42 and 43 from the log }
+ - { from: ops, to: note-room, label: "the op as it applies now, which the room saves to SQLite" }
+ - { from: note-room, to: editor-a, label: "ack: version 44" }
+ - { from: note-room, to: editor-b, label: the transformed op at version 44 }
+ - { from: editor-b, to: ops, label: "move the op past B's own unacknowledged edits, then apply it" }
View file
Added.rebasely/architecture/flows/load-note.yaml+9−0
@@ -0,0 +1,9 @@
+title: Loading a note
+description: Someone opens /#groceries. The page connects to the note's room and gets its text.
+actors: [editor-a]
+steps:
+ - { from: editor-a, to: api, label: "GET / (the editor page and its script, from static assets)" }
+ - { from: editor-a, to: api, label: "GET /notes/groceries/ws, Upgrade: websocket" }
+ - { from: api, to: note-room, label: "forward the upgrade to the room for idFromName(\"groceries\")" }
+ - { from: note-room, to: editor-a, label: "101 Switching Protocols, socket accepted for hibernation" }
+ - { from: note-room, to: editor-a, label: "snapshot: the note's text and version" }
View file
Added.rebasely/architecture/flows/resync.yaml+7−0
@@ -0,0 +1,7 @@
+title: Catching up an editor that fell behind
+description: An op written against a version older than the room's log reaches, or one that no longer fits the text, is answered with the whole note.
+actors: [editor-a]
+steps:
+ - { from: editor-a, to: note-room, label: "op written against version 12, while the room is at 240" }
+ - { from: note-room, to: editor-a, label: "snapshot: the text at version 240; A drops its pending edits" }
+ - { from: editor-a, to: note-room, label: "the next edit, written against version 240" }
View file
Added.rebasely/architecture/system.yaml+24−0
@@ -0,0 +1,24 @@
+components:
+ api:
+ kind: worker
+ description: The Worker. Routes /notes/:id to that note's room and serves the editor page as static assets.
+ owns: [src/index.ts, src/routes.ts]
+ talks_to:
+ - { to: note-room, via: rpc }
+ note-room:
+ kind: durable-object
+ description: One per note, picked by name. Orders every edit, keeps the note and its op log in SQLite, and holds the editors' WebSockets.
+ binding: NOTES
+ owns: [src/note-room.ts, src/room.ts]
+ talks_to:
+ - { to: ops, via: import }
+ ops:
+ kind: library
+ description: Insert and delete operations, their transform, and the messages on the socket. The same code runs in the room and in the browser.
+ owns: [src/ops.ts, src/protocol.ts]
+ client:
+ kind: library
+ description: The editor page and its script, compiled by tsc into public/js.
+ owns: [client/**, public/index.html]
+ talks_to:
+ - { to: ops, via: import }
View file
Added.rebasely/architecture/views/editing.yaml+2−0
@@ -0,0 +1,2 @@
+description: What takes part in an edit, from the browser to the room and back.
+components: [client, ops, note-room]
View file

Checks

No checks reported for this commit.

Runs

No runs for this commit.