Store the routing table in the database (part of #122)
check / check (push) Canceled after 0s

A new routes table holds one row per prefix and origin AS: the peer set
as the bitset's bytes, and the two kept routes, each with its peer's
number, AS path and time in seconds. A new route_peers table holds each
peer's number and address.

WriteRouteChanges writes one TakeChanges result in a transaction.
ReadRouteTable reads both tables into a new routing table, through the
new Table.Load, which records no change. It fails on a row that names a
peer number missing from route_peers. Nothing uses them yet.

Model: opus-5-5
This commit was merged in pull request #186.
This commit is contained in:
2026-10-27 08:54:57 +01:00
parent 7a34a46c4d
commit eda37da369
7 changed files with 1010 additions and 8 deletions
+7 -2
View File
@@ -33,6 +33,11 @@ tested.
# Completed Steps
- 2026-10-27: the database keeps a copy of the whole routing table in a new
`routes` table, one row per prefix and origin AS. The peers' numbers are in a
new `route_peers` table. One function writes the pairs that changed in memory,
and another reads the whole table back into memory at startup. Nothing uses
them yet (part of #122)
- 2026-10-27: a new package, `internal/routetable`, holds the whole routing
table in memory. For each prefix and origin AS it keeps the peers that carry
it, one bit per peer, and the two newest of their routes. Nothing uses it yet
@@ -249,5 +254,5 @@ tested.
# Future Steps
- the rest of https://git.eeqj.de/sneak/routewatch/issues/122, one PR each: the
routing table in the database, the prefix handler writing to it, the pages and
the API reading from it, then removing the per-peer route tables
prefix handler writing to the routing table, the pages and the API reading
from it, then removing the per-peer route tables