Record whether a node is adopted and which modules were taken on it (hq ADR 0100)

This commit is contained in:
2026-09-22 17:14:05 +02:00
parent 0a39b7df82
commit 1c32af6a22
13 changed files with 559 additions and 46 deletions
@@ -0,0 +1,21 @@
-- A node is adopted or converged, and the mesh records which (novox/hq ADR 0100).
--
-- A machine already serving a predecessor's services is adopted: what is found on it is kept
-- until its module is taken, and the firewall found on it stays in force. It stays adopted until
-- the operator converges it. False by default, so every node that exists is converged, as it was.
alter table node add column adopted boolean not null default false;
-- When it was last made adopted, and when it last converged. Both kept: a node returned to adopted
-- after converging is a different history from one that never converged.
alter table node add column adopted_since timestamptz;
alter table node add column converged_at timestamptz;
-- The modules taken on a node: its cutover, the operator's act, done when the module's data has
-- moved. A row per node and module, and it outlives the assignment on purpose -- unassigning a
-- module does not un-take it, and what was taken stays taken when a node returns to adopted.
create table taken (
node uuid not null references node(id) on delete cascade,
module text not null references module(name) on delete cascade,
taken_at timestamptz not null default now(),
primary key (node, module)
);