Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/spec/glue.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ rollups:
status: Status, statusWhenFull: 7, statusWhenPartial: 6 }
```

A count roll-up keeps a counter on a parent current on the child's create / delete. With `op: sum` the roll-up keeps `field` equal to the sum of the children's `of` field, can maintain a `balance` (= `capacity - sum`), and can flip a `status` relation to `statusWhenFull` / `statusWhenPartial`. Sum roll-ups **compose transitively** across a multi-level composition (a leaf edit updates the mid total, then the top total); recomputation stops when values stop changing.
A count roll-up keeps a counter on a parent current on the child's create / delete. With `op: sum` the roll-up keeps `field` equal to the sum of the children's `of` field, can maintain a `balance` (= `capacity - sum`), and can drive a `status` relation: `statusWhenFull` once the sum reaches the capacity, `statusWhenPartial` while it is positive but below it - and, when the sum returns to zero, back to the status the roll-up displaced. The first move into one of the roll-up's two statuses records the status the parent held until then; a sum back at zero restores it, so a document whose only allocation is deleted, amended to zero or moved to another parent returns to where the allocation found it - not to a declared constant, which is wrong for every document that entered from another status. Only a status the roll-up itself set is relinquished; a status set by hand (a void, a cancellation) is never touched. Sum roll-ups **compose transitively** across a multi-level composition (a leaf edit updates the mid total, then the top total); recomputation stops when values stop changing.

Roll-ups are recompute-on-event (self-healing), so they are **eventually consistent, not transactionally exact** under heavy concurrency.

Expand Down