Record origin changes and show them on the prefix page (closes #161)
check / check (push) Successful in 4m6s

The routing table records each prefix and origin AS pair's origin changes:
when it gains its first peer and when it loses its last. Each row holds the
prefix, the origin AS, announced or withdrawn, the peer count and the time.
The prefix handler writes them to a new origin_changes table, and the database
maintainer prunes each prefix to its newest 500 rows and 72 hours. The prefix
page lists them newest first, at most 5,000.

Model: deepseek-v4-pro
This commit is contained in:
2026-11-05 04:07:39 +00:00
parent 15bf20a894
commit 347e1456a2
16 changed files with 1127 additions and 27 deletions
+16 -1
View File
@@ -119,4 +119,19 @@ CREATE TABLE IF NOT EXISTS routes (
CREATE TABLE IF NOT EXISTS route_peers (
number INTEGER PRIMARY KEY,
address TEXT NOT NULL UNIQUE
);
);
-- The origin changes of the routing table: each time a prefix and origin AS
-- gained its first peer or lost its last. The prefix handler writes them, and
-- the database maintainer prunes each prefix to its newest 500 rows and 72
-- hours. time is whole seconds since 1970, UTC.
CREATE TABLE IF NOT EXISTS origin_changes (
id INTEGER PRIMARY KEY,
prefix TEXT NOT NULL,
origin_asn INTEGER NOT NULL,
announced BOOLEAN NOT NULL,
peer_count INTEGER NOT NULL,
time INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_origin_changes_prefix ON origin_changes(prefix);