Add the presist storage for control routes

This commit is contained in:
Fran Bull
2024-04-01 12:59:21 -07:00
parent 61f7b83bda
commit 886ffc3096
4 changed files with 115 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import (
type RouteCollector struct {
routes []netip.Prefix
removedRoutes []netip.Prefix
routeInfo *routeinfo.RouteInfo
}
func (rc *RouteCollector) AdvertiseRoute(pfx ...netip.Prefix) error {
@@ -35,11 +36,15 @@ func (rc *RouteCollector) UnadvertiseRoute(toRemove ...netip.Prefix) error {
}
func (rc *RouteCollector) StoreRouteInfo(ri *routeinfo.RouteInfo) error {
rc.routeInfo = ri
return nil
}
func (rc *RouteCollector) ReadRouteInfo() (*routeinfo.RouteInfo, error) {
return nil, nil
if rc.routeInfo == nil {
return routeinfo.NewRouteInfo(), nil
}
return rc.routeInfo, nil
}
// RemovedRoutes returns the list of routes that were removed.