aboutsummaryrefslogtreecommitdiffstats
path: root/docs/guides/federation/running-a-node.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/guides/federation/running-a-node.md')
-rw-r--r--docs/guides/federation/running-a-node.md130
1 files changed, 86 insertions, 44 deletions
diff --git a/docs/guides/federation/running-a-node.md b/docs/guides/federation/running-a-node.md
index 27ee3a0..2392578 100644
--- a/docs/guides/federation/running-a-node.md
+++ b/docs/guides/federation/running-a-node.md
@@ -1,29 +1,37 @@
# Running a node of a federation
-A node of a federated swarm runs as any continuum node: its node key, its state and
-document files, its transports, a supervisor ([`operations.md`](../../operations.md)).
-This guide says what is otherwise: the options of a swarm holding a store, who syncs,
-what its API lets in, and joining.
+A node of a federated swarm runs as any continuum node: its node key, its state file,
+its transports, a supervisor ([`operations.md`](../../operations.md)). This guide says
+what is otherwise: the options of a swarm holding a store, who syncs, what its API lets
+in, and joining.
+
+A node holds its store in a set of events, kept in a file (`--store-document`), which
+this guide describes; or in the Automerge document any swarm syncs, as federations
+started before sets did, and do until they move
+([In the Automerge document](#in-the-automerge-document), below). Nodes of the one and
+nodes of the other don't sync with each other.
## Its options
* `--store-root FILE` starts the swarm from its root, or goes on with it: the file the
founders made (`continuum-party root`), the root on its first line and, for a fork,
- the events the root keeps, a line each. The node builds the changes founding the
- swarm from it, as every node given the file builds them, and is ready at once.
-* `--store-id ID` joins the swarm by its ID, the root's SHA-256, through `--seeds`.
- Joining with an empty document, the node takes as its root that store's genesis change
- only.
+ the events the root keeps, a line each. The node begins its set from it, as every
+ node given the file does, and is ready at once.
+* `--store-id ID` joins the swarm by its ID, the root's SHA-256, through `--seeds`
+ ([Joining](#joining), below).
* `--store-party NAME`, which both need: the party the node is of, named in its entry
and its handshakes. It is a member once that party's node list names it
([Who syncs](#who-syncs)).
-* `--store-file PATH`: what is the node's own, written whenever it changes: the events
- it refused by what it took before (of two versions changing one, the second it judged)
- and those its operator had it drop. A node reads its store anew from its document
- whenever it starts: without the file, it may then take what it refused. Keep it beside
- the document file; one that doesn't read stops the node from starting.
-* `--store-checkpoint ID`: a checkpoint the node reads its store from whenever it starts,
- instead of from the document's checkpoint, by its ID ([Joining](#joining), below).
+* `--store-document PATH`: the file of the node's set of events, written where the set
+ changed, every five seconds and as the node stops: the store's events, what the node
+ refused by what it took before (of two versions changing one, the second it judged),
+ what its operator had it drop, and the members' entries. Started again, the node goes
+ on from it. One that doesn't read, or is of another store, stops the node from
+ starting.
+* `--store-checkpoint ID`: the checkpoint a node joining with nothing begins its set
+ from, instead of the root, by its ID ([Joining](#joining), below).
+* `--store-keeps-forgotten DURATION` (30 days unless given): for how long the node keeps
+ what a checkpoint its store moved to forgot, for nodes still before that checkpoint.
* `--store-neighbour-parties NAME,…`: parties among whose members, with its own party's,
the node keeps some of its neighbours.
* `--store-vote-key PATH` and the options with it: the node votes and proposes for its
@@ -37,10 +45,11 @@ node refuses to start with them.
## Its files
Beside those of every node ([`lifecycle.md`](../../lifecycle.md),
-[What the files are for](../../lifecycle.md#what-the-files-are-for)), the store file. Back
-up the node key, as every node's: its node ID is what its party lists, and a new key is a
-new node, which the party lists anew. The document file and the store file go together:
-the store file says what the node refuses of what the document holds.
+[What the files are for](../../lifecycle.md#what-the-files-are-for)), the file of its
+set, and no document file: the document a swarm syncs otherwise stays empty. Back up the
+node key, as every node's: its node ID is what its party lists, and a new key is a new
+node, which the party lists anew. Back up the set's file too: a node without it joins
+anew, and may then take what it refused.
## Who syncs
@@ -90,50 +99,83 @@ alone, so that a party listing many nodes can't be all of a node's neighbours.
(whether it takes a `true` a party is about to cast); and its operator's:
`POST /admin/events/drop`, `/admin/events/allow`, `/admin/events/vote`,
`/admin/events/fork`. Each answers `404` while the node holds no store.
-* **The store API** (`/store`) reads the document, where events are bytes at
- `_continuum/events/<ID>`; what counts is read at `GET /events/counts`. A write through
- it is refused (`403`): the document takes events and each node's own protocol data
- only.
+* **The store API** (`/store`) holds nothing: events are read at `GET /events/{id}`,
+ what counts at `GET /events/counts`. A write through it is refused (`403`): the set
+ takes events and each node's own entry only. So is a remake (`/admin/remakes`, `400`:
+ `this node's document is a set of events: there is nothing to remake`).
## Joining
-A node with an empty document joins by the store's ID (`--store-id`) through a member
-(`--seeds`), and holds its store once it has read the document: `GET /events` answers
-then. It learns of other members as it syncs, and needs none of its seeds once it has:
-they may go away. Before a checkpoint passed, it reads from the root: of two versions
-changing one, which keys voting twice wrote, it takes the first it judges, as any node,
-and reports the other (`own` in `GET /events/refused`), for you to choose
+A node with nothing of the store joins by its ID (`--store-id`) through a member
+(`--seeds`): it asks the members it reaches for the root by its ID, takes what hashes to
+it, and holds its store then (`Begun the store's set from what peers gave by name`):
+`GET /events` answers. Everything after it catches up on as it syncs. It learns of other
+members so, and needs none of its seeds once it has: they may go away. Before a
+checkpoint passed, it reads from the root: of two versions changing one, which keys
+voting twice wrote, it takes the first it judges, as any node, and reports the other
+(`own` in `GET /events/refused`), for you to choose
([`when-things-go-wrong.md`](when-things-go-wrong.md)).
Once the store moved to a checkpoint, a node joining starts from that checkpoint, which
its operator pins by its ID (`--store-checkpoint`): ask a node you trust for it
-(`checkpoint` in `GET /events`). The node finds it in its document, built from what the
-document holds as any node builds it, and holds no store until then (`The pinned
-checkpoint isn't in the document (yet)`). It takes no epoch whose snapshot holds a
-checkpoint it neither builds nor has pinned: from the root, it would take what was grown
-anew from it since, by keys of versions long replaced.
+(`checkpoint` in `GET /events`). The node asks the members it reaches for the checkpoint
+by that ID, and for the events it keeps, and holds no store until it has them all. From
+the root, it would take what was grown anew from it since, by keys of versions long
+replaced. The pin counts only while the node has no file of its set: with one, it goes on
+from there.
-A node that was away across a move to a checkpoint builds that checkpoint from its
-document, which holds what came before until a remake leaves it out; after such a remake,
-it takes the checkpoint only where its operator pins it. Pin it, and restart the node.
+A node that was away across a move to a checkpoint builds that checkpoint itself, from
+what the others keep of what the checkpoint forgot (`--store-keeps-forgotten`). Away for
+longer than they keep it, it stays before the checkpoint, and the others refuse what it
+writes: start it anew, without its set's file and with the checkpoint pinned. It then
+holds none of what it refused of its own or dropped
+([`refusals-and-drops.md`](refusals-and-drops.md)).
## What it writes by itself
* **A version that passed**, as soon as it holds the votes passing it (`Writing a
version that passed`): any node may write it, and the same version written by several
is one.
-* **Events its document lacks**, that its store would take and that it has: after a
- remake, a rejoin, or a change of another node it refused (`Put again events the
- document lacked`).
* **Merge events**, under a revision with them, where its party lists it and its store
holds more heads than an event may name (64): signed with its node key, a random wait
after there first were (`Merged heads beyond what an event may name`). They count for
nothing, and gather the heads apart, so that what is written after builds on them all.
-* **Its own protocol data**: its entry, its acks of remakes, and the remakes it
- coordinates. Remakes are compactions only, acked by the members
- ([`remakes.md`](../../remakes.md)).
+* **Its own entry**: where it is reached, its party, and what else a member says of
+ itself, signed with its node key and counted, the latest taken.
It refuses events as every node does, and some by what it took before: of two versions
changing the one it reads, the second it judged (`Refused an event its history takes, by
what this node took before: kept so`). `GET /events/refused` lists them apart (`own`):
tell its party, which decides what the node keeps.
+
+## In the Automerge document
+
+A federation started before sets of events keeps its store in the document every swarm
+syncs: its nodes run without `--store-document`, and move there node by node, through
+`--store-both` ([`operations.md`](../../operations.md),
+[Moving to sets of events](../../operations.md#moving-to-sets-of-events)). Until then,
+what is otherwise at such a node:
+
+* **Its options and files**: `--document-file`, as any node's, and `--store-file PATH`,
+ what is the node's own, written whenever it changes: the events it refused by what it
+ took before, and those its operator had it drop. The node reads its store anew from
+ its document whenever it starts: without the store file, it may then take what it
+ refused. The two go together; a store file that doesn't read stops the node from
+ starting.
+* **Starting and joining**: given the root, the node builds the changes founding the
+ swarm from it; joining with an empty document, it takes as its root that store's
+ genesis change only, and holds its store once it has read the document. A pinned
+ checkpoint (`--store-checkpoint`) it finds in its document, built from what the
+ document holds, at every start, and holds no store until then (`The pinned checkpoint
+ isn't in the document (yet)`).
+* **A node that was away** across a move to a checkpoint builds it from its document,
+ which holds what came before until a remake leaves it out; after such a remake, it
+ takes the checkpoint only where its operator pins it. Pin it, and restart the node.
+* **The store API** (`/store`) reads the document, where events are bytes at
+ `_continuum/events/<ID>`; a write through it is refused (`403`): the document takes
+ events and each node's own protocol data only.
+* **What it writes by itself** besides: events its document lacks, that its store would
+ take and that it has, after a remake, a rejoin, or a change of another node it refused
+ (`Put again events the document lacked`); and its acks of remakes, and the remakes it
+ coordinates. Remakes are compactions only, acked by the members
+ ([`remakes.md`](remakes.md)).