diff --git a/internal/pipeline/doc.go b/internal/pipeline/doc.go new file mode 100644 index 0000000..fb3fa54 --- /dev/null +++ b/internal/pipeline/doc.go @@ -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 diff --git a/internal/pipeline/module_hash.go b/internal/pipeline/module_hash.go index 4e0a24d..cc98388 100644 --- a/internal/pipeline/module_hash.go +++ b/internal/pipeline/module_hash.go @@ -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)) diff --git a/internal/pipeline/refresh.go b/internal/pipeline/refresh.go index 56be6bd..365280b 100644 --- a/internal/pipeline/refresh.go +++ b/internal/pipeline/refresh.go @@ -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) } } diff --git a/internal/pipeline/tenant_refresh.go b/internal/pipeline/tenant_refresh.go index 35aab6c..45fdad7 100644 --- a/internal/pipeline/tenant_refresh.go +++ b/internal/pipeline/tenant_refresh.go @@ -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") } diff --git a/internal/store/backend.go b/internal/store/backend.go index 14c8b26..87b6d09 100644 --- a/internal/store/backend.go +++ b/internal/store/backend.go @@ -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)