chore: phase 3 code quality — pipeline prefixes, godoc baseline
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
// Package pipeline ingests module inputs (CDN, ASN, domains, IP ranges), materializes
|
||||
// prefixes, and creates BIRD preview revisions via store.
|
||||
package pipeline
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// moduleIngestInputHash fingerprints module config and child entries so snapshots invalidate on CRUD.
|
||||
func moduleIngestInputHash(st store.Backend, tenantID string, mod *store.Module) (string, error) {
|
||||
if st == nil || mod == nil {
|
||||
return "", fmt.Errorf("module hash: missing store or module")
|
||||
return "", fmt.Errorf("pipeline: module hash: missing store or module")
|
||||
}
|
||||
h := sha256.New()
|
||||
_, _ = fmt.Fprintf(h, "type=%s\n", strings.TrimSpace(mod.Type))
|
||||
|
||||
@@ -52,7 +52,7 @@ func RefreshModuleIngest(ctx context.Context, st store.Backend, hc *http.Client,
|
||||
return err
|
||||
}
|
||||
if !mod.Enabled {
|
||||
return fmt.Errorf("module disabled")
|
||||
return fmt.Errorf("pipeline: module disabled")
|
||||
}
|
||||
|
||||
var prior []store.PrefixRow
|
||||
@@ -185,7 +185,7 @@ func collectModulePrefixRows(ctx context.Context, st store.Backend, hc *http.Cli
|
||||
}
|
||||
return collectDomainPrefixRows(ctx, hc, mod, profiles, policy, entries)
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown module type %q", mod.Type)
|
||||
return nil, fmt.Errorf("pipeline: unknown module type %q", mod.Type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,5 +76,5 @@ func PickTenantRefreshTriggerModule(st store.Backend, tenantID string, moduleIDs
|
||||
return mod.ID, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("no enabled module for tenant refresh")
|
||||
return "", fmt.Errorf("pipeline: no enabled module for tenant refresh")
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type Backend interface {
|
||||
// ListTenantIDs returns distinct tenant identifiers (for background workers).
|
||||
ListTenantIDs() ([]string, error)
|
||||
|
||||
// ListModules returns all modules for a tenant (control plane may paginate in httpapi).
|
||||
ListModules(tenantID string) []*Module
|
||||
GetModule(tenantID, moduleID string) (*Module, error)
|
||||
CreateModule(tenantID string, in *Module) (*Module, error)
|
||||
@@ -53,6 +54,7 @@ type Backend interface {
|
||||
UpdateCommunity(tenantID, id string, patch *CommunityPatch) (*Community, error)
|
||||
DeleteCommunity(tenantID, id string) error
|
||||
|
||||
// ListPeers returns all BGP peers for a tenant (control plane may paginate in httpapi).
|
||||
ListPeers(tenantID string) []*BGPPeer
|
||||
GetPeer(tenantID, id string) (*BGPPeer, error)
|
||||
CreatePeer(tenantID string, in *BGPPeer) (*BGPPeer, error)
|
||||
|
||||
Reference in New Issue
Block a user