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

The routing table records a row each time a prefix and origin AS gets its first peer (announced) or loses its last (withdrawn), with the time and how many peers carry the prefix just after. The prefix handler writes the rows to a new origin_changes table, apart from routes. Every hour the database maintainer keeps each prefix's rows from the last 72 hours or its newest 500, whichever keeps more. The prefix page lists them newest first, at most 5,000.

At most 100,000 rows wait in memory to be written; past that the oldest are dropped and logged. A stop loses the rows past its last write.

Model: deepseek-v4-pro (implementation); opus-5-5 (commit message)
This commit was merged in pull request #231.
This commit is contained in:
2026-11-05 06:57:41 +01:00
parent 15bf20a894
commit e58c6635e7
20 changed files with 1651 additions and 88 deletions
+17 -1
View File
@@ -119,4 +119,20 @@ 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 or its
-- rows from the last 72 hours, whichever keeps more. 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);