aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/store.rs
Commit message (Collapse)AuthorAgeFilesLines
* screen: what is at the policy's place found in every map on the waytv35 hours1-0/+23
| | | | | | | | | | | | | | | | A node judges what it receives once anything is at the policy's place (`Screening::policed`), as a read shows it. But a read shows the newest of the values written at once at a key, merging maps only where that one is a map: a string written at `_continuum/access` beside the map holding the policy, and newer, hides it. So the policy's place read as empty, a change putting `"signed"` into the hidden policy went unjudged where it came alone, and deleting the string left a strict policy no change was refused for. Whether anything is at the policy's place is asked of every map of each key on the way to it, read or not (`store::held_anywhere`), as `store::by_seq` walks them. A swarm with nothing there is screened as before.
* store: the policy's reading unmarked however it endstv46 hours1-3/+9
| | | | | | | `signs_values` marks, for its thread, that the policy is being read, so that the reading doesn't ask itself again; a panic within it left the mark, and that thread read every strict place by Automerge's order from then on. The mark is now taken off when the reading returns or unwinds.
* policy: read only as continuum writes ittv46 hours1-1/+10
| | | | | | | | | | | | | | | | | | | A swarm turns strict only at its start or through a strict remake, and a change writing a strict policy where the policy isn't strict is refused, found by its operations: `"signed"` put at the policy's `values`, or an envelope asking for it put at its place. But the policy was read in plain JSON, where an Automerge text reads as a string, and writing a text is no such operation: `{"$text": "signed"}` at `values`, through the typed API, turned a swarm strict that nothing refused, with a time before it nothing closes. The policy is read in typed JSON now (`store::read_plain_as`): what continuum writes there reads as it is, plain JSON or an envelope, and a text, a counter or bytes as itself, tagged; a setting that isn't a string makes a policy no node knows (`policy::read`), as a version it doesn't know does. So no text turns a swarm strict, and the operations `rules::turns_strict` asks of are the only ways to. A policy holding none of these reads as before.
* rules: a swarm turns strict only at its start or through a strict remaketv48 hours1-78/+0
| | | | | | | | | | | | | | | | | | | | | | A strict policy written into a running swarm left a time before it: changes written there, beside the turn, were refused by the nodes that took the turn first and taken by the others where they came first (a signed policy that isn't strict, among them, unseated the turn there); and a remake whose base preceded the turn had every switching node replay the turn as one of its own, each refusing the others'. A change writing a strict policy where the policy at its history isn't strict (`"signed"` at its `values`, or an envelope there asking for signed values) is now refused, in every swarm. A swarm turns strict at its start (`--bootstrap-policy`) or through a strict remake, each its epoch's first change: no change of a strict epoch is from before its policy, and the rule for the time before goes, with the walk that found the changes that turned a swarm strict and what kept them (`before_strict`, `turned_strict`, `Reads::strict_now`, `Reads::turned_now`, `store::writers`, `store::made`, `changes::in_history`). The strict swarm's simulation starts strict. access.md says so, and that a strict swarm can't move to a policy its nodes don't know by writing it.
* store: one reading of the policy's placetv2 days1-48/+75
| | | | | | | | | | | | | | | | Whether values are ordered by `seq` (`signs_values`) read the policy's place itself, the first value alone and a map by Automerge's choice of each field, while the policy as judged (`policy::of`) read it through the store, which orders by `seq` only where `signs_values` says so, and merges every map there. They parted: a signed policy that isn't strict beside a newer plain one that is read as not strict for the one and strict for the other, and two maps, the newer without the field asking for signed values, the other way round. `signs_values` now asks `policy::of`, and the store orders the policy's own place by `seq` wherever any value there asks for signed values, and what is within the policy as written, so the two are one reading. Asked from within that reading, it answers false rather than ask again.
* rules: the changes that turned a swarm strict found once for its headstv2 days1-14/+38
| | | | | | | | | | | | Every change judged under a policy that isn't strict, in a strict document, walked back to the changes that turned it strict, each step reading every change the document holds. Only changes from the time before reach it in an honest swarm, but a member can send crafted ones at an old history, each costing every node a walk. The changes are now read once per walk (`store::made`), and what the walk finds is kept for the document's heads (`Reads::turned_now`), as whether its policy is strict is.
* store: values ordered by seq as the policy a read shows saystv2 days1-20/+77
| | | | | | | | | | | | | | | Whether values are read by `seq` went by whether any value at the policy's place asks for signed values, not by what the policy reads as. Where the place holds two, they part: a signed policy that isn't strict read before a plain one that is, or two maps, the newer not strict. Such a swarm judged as not strict and read by `seq`. Now the policy's own place is read by `seq` where any value there asks for signed values, so an older policy put back beside a strict one can't undo it; every other place is read by `seq` only where the policy that read shows is strict (`policy::read`, which `policy::of` reads with). A swarm whose policy doesn't read as strict reads every place as Automerge has it.
* rules: the time before strict is the change that turned it, written again or nottv2 days1-18/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | A change written under a policy that isn't strict was refused, in a strict document, unless it was in the history of the change that wrote the policy value the document read now. So the policy written again by a node that held a change from before, taken beside the strict policy, put that change in the new writer's history: that node kept it, every other node refused it, and the new policy with it, and the node was cut off. Now the reference is the change that turned the swarm strict: one that wrote a strict policy where the policy at its history wasn't, found by following back the writes of what the policy holds (`store::writers`). A change written under a policy that isn't strict is refused where such a change is beside it, neither in its history nor built on it. A policy written again, strict over strict, names the same change. One turning the swarm strict beside it is refused like any other. Of two at once neither is preferred: any rule choosing one, the lower hash say, would let a change made later to look as old take the place of the one every node took, and every node would drop it with all that was built on it. So two members turning a swarm strict at once split the nodes that took one from those that took the other; access.md says to turn it from one.
* store: a signed value chosen by seq is named sotv2 days1-5/+13
| | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but conflict reports still called the choice `newestWins`, and the code and the architecture still said "newest" of what a read shows. A report names it `highestSeq`; the rest says "the one a read shows".
* rules: nothing added to the time before a swarm turned stricttv2 days1-0/+21
| | | | | | | | | | | | | | | | | | | A swarm turned strict by writing the policy into it kept the time before open: a change whose history lacks the policy's change is judged by the policy then, none or one that isn't strict, needs no signature there, and is taken whenever it comes, from any member. With values read by `seq`, an envelope planted at that time with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. Once a document's policy is strict, a change written under one that isn't is refused, received or held, unless it is in the history of the change that wrote the policy the document reads (`store::written_by`). A node that holds one beside that change, taken before it came, is told so by any peer that refused it (REFUSALS), judges it again, now refuses it too, and drops it with what builds on it, as for any change it took unjudged. A swarm strict from its genesis change has no such time; one whose policy isn't strict judges as before.
* store: counters and the API's placement go by what a read showstv2 days1-5/+50
| | | | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but two readers still took Automerge's own choice: an increment found the counter beside an envelope a read showed (answering the counter), and `inspect::placed`, which the API's checks go by, walked through whatever Automerge chose. Both now take the value a read shows (`store::shown`). A list's items keep Automerge's choice, as before: no signed value is one, and reading a list whole goes by it.
* store: values ordered by seq only where the policy asks for signed valuestv2 days1-13/+92
| | | | | | | | | | | | | | The order by `seq` sat in `store::candidates`, which every swarm reads through: in a swarm that isn't strict, a string shaped like an envelope, written at the same time as a plain value or a map, was read first. What a swarm without a strict policy reads must not change for signed values. The order now applies only where the policy asks for signed values (`"values": "signed"`), as any value at the policy's place says, read as written (`signs_values`), so the policy's own reading doesn't go round. Elsewhere `candidates` is newest first, as always. It is looked at only where a place holds several values and one is an envelope.
* signed values: one reading of an envelope, everywheretv2 days1-25/+17
| | | | | | | | | | | | | | | | Three parts read an envelope three ways: the store's order took any string with the prefix whose meta held a `seq`, its reads any whose value decoded, the checks only one with four parts and a meta of exactly its fields. A string that the first two took and the checks refused was read first, read as the registry's or the policy's value, and treated as nothing by the check of the next write there. `document::signed` reads an envelope the one way: four parts, the value JSON, the meta exactly its six fields (one more, or one twice, and it isn't one), no newline in either, the signature decoding. The store's order, its plain reads, the checks, the API and the users API all go by it. What isn't one in every respect is a plain string, wherever it is read.
* signed values: value and meta apart, numbered; the highest seq is readtv2 days1-15/+94
| | | | | | | | | | | | | | | | | | | | | | | | | A member could put a user's older signed value back beside a newer one: a change made with dependencies from before both is judged where the place was empty, so the older envelope (`prev` empty) is taken; and of values written at once, the one read was the one with the highest operation, which whoever writes the change steers. A revoked capability, a lifted ban or an earlier policy came back that way, signed by whoever signed it then. An envelope is now `cv2.<value>.<meta>.<signature>`: the value as its user wrote it, and apart from it what continuum adds (swarm, path, user, at, seq, prev), the signature over the value's line and the meta's. `seq` is one more than that of the envelope it replaces, 0 where it replaces none; every node checks it with `prev`. Of the values a place holds, written at once, signed ones are read before any other, the highest `seq` first, of equal ones the lower digest (`store::candidates`): reads, snapshots and writes all go by it. An older envelope beside a newer one changes nothing. `application/continuum-signed` is the value's line, the meta's, then the signature; `scripts/continuum-signed` writes and checks it so. The wire version goes up: nodes must agree on what a place's value is.
* state: limit refused writes per usertv9 days1-0/+3
| | | | | | | | | | A write every node would refuse is rolled back by forking the document at the heads before it, under the write lock, at a cost that grows with the document's history. A user could ask for such writes in a loop. Count each user's refused writes over the last minute. Past --refused-writes-per-minute (default 10), its writes are answered 429 without being tried, until the oldest refusal leaves the minute.
* envelope: a signed value names its swarmtv9 days1-2/+1
| | | | | | | | | | | | Review 3.1, part of finding 12: a signed value's payload bound path, user, time and prev, but not the swarm. A user with the same name and key in two swarms could have an envelope replayed from one into the other, wherever the path holds no envelope yet (prev ""). The payload now names the swarm (`swarm`), and a node takes an envelope only for its own. /auth/whoami says the swarm, and continuum-signed and the example in api.md sign it. Wire version 44: nodes before this refuse such envelopes, and those after refuse the old ones.
* access: a node judges its own changes before they leavetv9 days1-0/+4
| | | | | | | | | | | | | | | | | | | | The API checks the path a request asks for; the rules judge everything the change does. Where they disagreed, the honest node's change was refused by every other node, and with signatures required the node was refused as a whole. The plan had both gates run the same judgement. Under a policy, each change a node makes (its own writes and those through the API) is now judged by rules::judge as receivers will judge it, before it is signed or sent; one every node would refuse is rolled back (the document forked at the heads before it, same actor: the change never left) and the request refused with 403 (StoreError:: Refused). rules::judge_held, judging a change the document holds, moves from swarm::refusals to access::rules for both. The simulations that play a member past its own checks write with a helper that bypasses them (forge). Review finding 3 (the same judgement at both gates).
* access: strict policy, signed pathstv10 days1-0/+53
| | | | | | | | | "values": "signed" (strict, requiring signatures too): the registry, _continuum/access, bans and the paths in _continuum/access/userSigned (* for any key) hold values their users signed. Envelopes read as the values they hold where the node reads protocol data. Auth plan M7.
* access: the policy enforcedtv10 days1-0/+6
| | | | | | | | _continuum/access/policy ({"version": 1}) has every node screen every change it receives, on every path changes come in. A policy a node doesn't know stops its writes through the API. GET /admin/refused. Auth plan M6.
* bench: change pathstv10 days1-2/+13
| | | | | | | Finding the paths changes touch, from documents and from raw change bytes, measured before M6 is built. Auth plan M6 (measure first).
* store: keys_at tells no map from an empty onetv10 days1-9/+8
| | | | | | | | registry::exists counted any value at _continuum/users as a registry; keys_at answers None where there is no map, and its users (records, members, forget records, remakes) say what they make of it. Auth plan M1 (fix).
* access: authorization at the APItv10 days1-2/+12
| | | | | | | | | Every request is judged by the registry the node holds: store reads pruned to what the user may read, writes refused where it may not, admin endpoints by protocol capabilities. Without a registry, as before (--protocol-writers for protocol data). Auth plan M1.
* access: the user registrytv10 days1-0/+5
| | | | | | | | | _continuum/users/<name>: one entry per user, with capabilities by path (read, write) granted by whom and when, and a disabled flag. Read leniently: a damaged entry gives less, never more. Protocol data stays apart: a capability outside _continuum never covers it. Auth plan M1.
* api: /admin/changes read ops, not diffstv2026-11-021-0/+86
| | | | | | | | | | | | The new store::changed_by reads each change's own operations instead of diffing the document before and after it. Each object's path is found once per change, as it was right after that change. So the cost now grows with the size of the change, not the size of the map it touched. - It names paths the same way the diff did: a map entry by its key, and list and text edits by the list or text. - It relies on import_obj, which Automerge marks as hidden from its docs, to turn an operation's object ID back into an object.
* api: drop $float as JSON number is OKtv2026-11-021-16/+37
|
* api: add type caststv2026-11-021-0/+31
|
* api: types are stickytv2026-11-021-33/+216
|
* api: add application/vnd.continuum.typed+jsontv2026-11-021-130/+82
|
* api: add application/vnd.continuum.* scalar typestv2026-11-021-45/+155
|
* document: create new compound values at oncetv2026-11-011-11/+29
| | | | | This speeds up large writes as new maps and lists are created in one batch operation instead of one operation per value.
* document: introduce patch logtv2026-11-011-1/+6
|
* api: add support for counterstv2026-11-011-0/+57
|
* api: allow reading past versionstv2026-11-011-0/+3
|
* api: PUT changes only what differstv2026-11-011-23/+148
|
* document: reject writes during rejointv2026-11-011-0/+4
|
* use Automerge as Document instead of AutoCommittv2026-10-311-5/+5
| | | | This allows a lot of operations to drop mut.
* store function accept any documenttv2026-10-311-42/+50
|
* tests write through document::testing helperstv2026-10-311-16/+54
|
* one function for changed pathstv2026-10-311-0/+61
|
* move ChangeSet from swarm to documenttv2026-10-311-0/+11
|
* store reads go through resolve_loggedtv2026-10-311-21/+25
|
* consistently use resolve_throughtv2026-10-311-15/+7
|
* unify path deleterstv2026-10-311-50/+30
|
* unify path walkerstv2026-10-311-32/+7
|
* api: support list indexes in pathtv2026-10-301-39/+294
|
* add support to insert values at list indextv2026-10-301-0/+77
|
* api: add support for shallow store readstv2026-10-301-0/+72
|
* make clippy happy againtv2026-10-261-8/+8
|
* turn all pub into pub(crate)tv2026-10-261-17/+24
|
* add votes registertv2026-10-241-0/+23
|