Expand description
The community rail’s arrangement: an ordered list of communities and the folders that group them, synced across the account’s own devices.
On the wire it is a crate::synced_prefs::Pref::Rail document — a
self-encrypted kind 30078 with the d tag vector/rail — deliberately
separate from the Community List, which carries join material. A drag is the
most frequent write the UI makes, and the list that holds keys is the last
document that should absorb that traffic: it is fragmented against a byte
ceiling, and it has already been wedged once by growing past one. Here a
failed write costs a session of default ordering and nothing else.
kind: 30078 (APPLICATION_SPECIFIC)
tags: ["d", "vector/rail"]
content: nip44(self, {"v":1,"nodes":[
{"type":"item","key":"<community-id>"},
{"type":"folder","id":"…","name":"Work","hue":210,"keys":["…","…"]}
]})Keys are opaque and never dropped. A community this device has not
synced yet keeps its place through every read and republish; rendering
simply skips what it cannot resolve. Dropping unknown keys would let the
device that knows least flatten everyone else’s folders. The single
exception is RailLayout::remove_key, called when the user LEAVES a
community: without it a later rejoin would silently reappear inside its old
folder at its old index.
Every operation here is pure, so the arrangement can be tested without a relay and the UI stays a view over it.
Structs§
- Rail
Layout - The stored arrangement.
Enums§
- Rail
Anchor - A top-level row, named so a drop can say “before this one” without caring whether it is a community or a folder.
- Rail
Drag - What a drag picked up.
- Rail
Drop - Where a drag let go.
- Rail
Node - One row of the rail: a community on its own, or a folder holding several.
Constants§
- RAIL_
VERSION - The version this build writes. A document from the future is read, rendered and republished untouched, but never EDITED: an older build cannot know what
Functions§
- new_
folder_ id - A fresh folder id. Short and random rather than sequential: two devices can each make a folder before either has seen the other’s, and an index would have them collide into one.