From 31d41eb1c902c907a5c6e5608510f96c4b1bc864 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 19 Nov 2026 01:48:57 +0000 Subject: store: a new event builds on as many heads as an event may name A party's client builds on the heads its node shows (`GET /events`), and a node on its own heads; an event names at most 64 dependencies. With more heads than that, where many write at once and nothing merges, every event built on them was none. `Store::building_on` gives the heads, as many as an event may name (`Fold::DEPENDENCIES`, the federation's 64), the earliest taken first, so that what is written merges what stayed apart the longest; `GET /events` shows those, and a node voting by itself builds on them. --- docs/store.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docs/store.md') diff --git a/docs/store.md b/docs/store.md index ad98f9f..d5159f6 100644 --- a/docs/store.md +++ b/docs/store.md @@ -100,7 +100,9 @@ A fold says, of its events: * **what an event builds on**, read from its bytes; bytes that aren't one of its events are none, and are refused; * **how large an event may be**, which the document judges a change by - ([On Automerge](#on-automerge)); + ([On Automerge](#on-automerge)), and how many events it may build on: a new event + builds on the heads of what a node holds, as many as that, the earliest taken first, so + that what is written merges what stayed apart the longest; * **whether an event is taken where its history reads as a given state**: judging. A root is taken only as its own store's, never by judging; * **the state a checkpoint and the events after it read as**, built by adding the events @@ -126,6 +128,8 @@ pub trait Fold { type State: Clone; /// The most bytes an event may have: larger ones are none. const LARGEST: usize; + /// The most events an event may build on. + const DEPENDENCIES: usize = usize::MAX; /// What the event builds on; `None` where its bytes are none of this fold's events. fn dependencies(event: &[u8]) -> Option>; /// Whether the event is taken where its history reads as `at`, as far as it reads it. -- cgit v1.3.1