Record origin changes and show them on the prefix page (closes #161)
check / check (push) Successful in 1m3s
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:
@@ -1,6 +1,7 @@
|
||||
// Package database provides SQLite storage for BGP routing data: ASNs,
|
||||
// prefixes, announcements, peerings and BGP peers. Its routes table holds a
|
||||
// copy of the whole routing table that internal/routetable keeps in memory.
|
||||
// prefixes, announcements, peerings, BGP peers and origin changes. Its routes
|
||||
// table holds a copy of the whole routing table that internal/routetable
|
||||
// keeps in memory.
|
||||
package database
|
||||
|
||||
import (
|
||||
@@ -55,6 +56,14 @@ type Store interface {
|
||||
WriteRouteChanges(changes []routetable.Change, newPeers map[string]uint) error
|
||||
ReadRouteTable(ctx context.Context) (*routetable.Table, error)
|
||||
|
||||
// Origin change operations: the prefix and origin AS pairs' first and
|
||||
// last peers, as the routing table records them.
|
||||
WriteOriginChanges(changes []routetable.OriginChange) error
|
||||
GetOriginChanges(
|
||||
ctx context.Context, prefix netip.Prefix, limit int,
|
||||
) ([]routetable.OriginChange, error)
|
||||
PruneOriginChanges(ctx context.Context) error
|
||||
|
||||
// ASN WHOIS operations
|
||||
GetNextStaleASN(ctx context.Context, staleThreshold time.Duration) (int, error)
|
||||
UpdateASNWHOIS(ctx context.Context, update *ASNWHOISUpdate) error
|
||||
|
||||
Reference in New Issue
Block a user