Documentation
¶
Overview ¶
Package schema defines the entgo schema types for PeeringDB objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PrepareQueryAllows = map[string]schemaannot.PrepareQueryAllowAnnotation{ "org": { Fields: []string{ "net__name", "net__asn", "ix__name", "fac__name", "fac__country", }, }, "net": { Fields: []string{ "org__name", "org__id", "ix__name", "ixlan__name", "fac__name", "netfac__fac__name", }, }, "fac": { Fields: []string{ "org__name", "campus__name", "net__name", "net__asn", "ix__name", "ix__id", "ixlan__ix__fac_count", }, }, "ix": { Fields: []string{ "org__name", "ixlan__name", "ixpfx__prefix", "net__name", "net__asn", "fac__name", "fac__country", }, }, "campus": { Fields: []string{ "org__name", "fac__name", "fac__country", }, }, "carrier": { Fields: []string{ "org__name", "fac__name", "fac__country", }, }, "ixlan": { Fields: []string{ "ix__name", "ix__id", "ixpfx__prefix", }, }, "ixpfx": { Fields: []string{ "ixlan__name", "ixlan__ix__name", "ixlan__ix__id", }, }, "ixfac": { Fields: []string{ "fac__name", "fac__country", "fac__city", "ix__name", }, }, "netfac": { Fields: []string{ "net__name", "net__asn", "fac__name", "fac__country", }, }, "netixlan": { Fields: []string{ "net__name", "net__asn", "ix__name", "ix__id", "ixlan__name", }, }, "carrierfac": { Fields: []string{ "carrier__name", "fac__name", "fac__country", }, }, "poc": { Fields: []string{ "net__name", "net__asn", }, }, }
PrepareQueryAllows is the hand-written source-of-truth for Phase 70 TRAVERSAL-01 Path A allowlists. Each entry mirrors an upstream peeringdb_server/serializers.py get_relation_filters list verbatim (or the equivalent related_fields / queryable_relations derivation when the serializer overrides or inherits default behaviour).
Consumed by cmd/pdb-compat-allowlist at codegen time to emit internal/pdbcompat/allowlist_gen.go. Keys are PeeringDB type strings ("net", "fac", etc. — the Registry/URL namespace), matching the map keys emitted in the generated file.
Keys use TraversalKey tokens (equivalent to PeeringDB type names like "netfac", "netixlan") — NOT the ent edge Go names ("network_facilities", "network_ix_lans"). The runtime parser resolves entries via LookupEdge, which indexes Edges[] by TraversalKey; a Go-name key would be silently ignored.
Living in this sibling file (rather than inside Annotations() on the per-entity generated ent/schema/{type}.go) keeps the source-of-truth safe from cmd/pdb-schema-generate, which regenerates {type}.go from schema/peeringdb.json and would otherwise strip these hand-authored annotations on every full-tree `go generate ./...`. See ent/schema/poc_policy.go for the original sibling-file precedent.
When adding a new allowlist entry, keep the `// Source: serializers.py:<line>` comments — they are load-bearing for future audits against upstream revisions.
Functions ¶
This section is empty.
Types ¶
type Campus ¶
Campus holds the schema definition for the Campus entity. Maps to the PeeringDB "campus" object type.
func (Campus) Annotations ¶
func (Campus) Annotations() []schema.Annotation
Annotations of the Campus.
type Carrier ¶
Carrier holds the schema definition for the Carrier entity. Maps to the PeeringDB "carrier" object type.
func (Carrier) Annotations ¶
func (Carrier) Annotations() []schema.Annotation
Annotations of the Carrier.
type CarrierFacility ¶
CarrierFacility holds the schema definition for the CarrierFacility entity. Maps to the PeeringDB "carrierfac" object type.
func (CarrierFacility) Annotations ¶
func (CarrierFacility) Annotations() []schema.Annotation
Annotations of the CarrierFacility.
func (CarrierFacility) Edges ¶
func (CarrierFacility) Edges() []ent.Edge
Edges of the CarrierFacility.
func (CarrierFacility) Fields ¶
func (CarrierFacility) Fields() []ent.Field
Fields of the CarrierFacility.
func (CarrierFacility) Hooks ¶
func (CarrierFacility) Hooks() []ent.Hook
Hooks returns CarrierFacility mutation hooks for OTel tracing per D-46.
func (CarrierFacility) Indexes ¶
func (CarrierFacility) Indexes() []ent.Index
Indexes of the CarrierFacility.
type Facility ¶
Facility holds the schema definition for the Facility entity. Maps to the PeeringDB "fac" object type.
func (Facility) Annotations ¶
func (Facility) Annotations() []schema.Annotation
Annotations of the Facility.
type InternetExchange ¶
InternetExchange holds the schema definition for the InternetExchange entity. Maps to the PeeringDB "ix" object type.
func (InternetExchange) Annotations ¶
func (InternetExchange) Annotations() []schema.Annotation
Annotations of the InternetExchange.
func (InternetExchange) Edges ¶
func (InternetExchange) Edges() []ent.Edge
Edges of the InternetExchange.
func (InternetExchange) Fields ¶
func (InternetExchange) Fields() []ent.Field
Fields of the InternetExchange.
func (InternetExchange) Hooks ¶
func (InternetExchange) Hooks() []ent.Hook
Hooks returns InternetExchange mutation hooks for OTel tracing per D-46.
func (InternetExchange) Indexes ¶
func (InternetExchange) Indexes() []ent.Index
Indexes of the InternetExchange.
func (InternetExchange) Mixin ¶ added in v1.17.0
func (InternetExchange) Mixin() []ent.Mixin
Mixin wires Phase 69 UNICODE-01 fold shadow columns onto InternetExchange. Sibling-file pattern — see network_fold.go for the rationale.
type IxFacility ¶
IxFacility holds the schema definition for the IxFacility entity. Maps to the PeeringDB "ixfac" object type.
func (IxFacility) Annotations ¶
func (IxFacility) Annotations() []schema.Annotation
Annotations of the IxFacility.
func (IxFacility) Hooks ¶
func (IxFacility) Hooks() []ent.Hook
Hooks returns IxFacility mutation hooks for OTel tracing per D-46.
type IxLan ¶
IxLan holds the schema definition for the IxLan entity. Maps to the PeeringDB "ixlan" object type.
type IxPrefix ¶
IxPrefix holds the schema definition for the IxPrefix entity. Maps to the PeeringDB "ixpfx" object type.
func (IxPrefix) Annotations ¶
func (IxPrefix) Annotations() []schema.Annotation
Annotations of the IxPrefix.
type Network ¶
Network holds the schema definition for the Network entity. Maps to the PeeringDB "net" object type.
func (Network) Annotations ¶
func (Network) Annotations() []schema.Annotation
Annotations of the Network.
func (Network) Mixin ¶ added in v1.17.0
Mixin wires Phase 69 UNICODE-01 fold shadow columns onto Network. Lives in this sibling file because network.go is regenerated by cmd/pdb-schema-generate from schema/peeringdb.json; the generator only touches files named after the model type (network.go) so this file is invisible to it. ent's codegen discovers the method via reflection on the Network schema type, so the file split is transparent to ent.
type NetworkFacility ¶
NetworkFacility holds the schema definition for the NetworkFacility entity. Maps to the PeeringDB "netfac" object type.
func (NetworkFacility) Annotations ¶
func (NetworkFacility) Annotations() []schema.Annotation
Annotations of the NetworkFacility.
func (NetworkFacility) Edges ¶
func (NetworkFacility) Edges() []ent.Edge
Edges of the NetworkFacility.
func (NetworkFacility) Fields ¶
func (NetworkFacility) Fields() []ent.Field
Fields of the NetworkFacility.
func (NetworkFacility) Hooks ¶
func (NetworkFacility) Hooks() []ent.Hook
Hooks returns NetworkFacility mutation hooks for OTel tracing per D-46.
func (NetworkFacility) Indexes ¶
func (NetworkFacility) Indexes() []ent.Index
Indexes of the NetworkFacility.
type NetworkIxLan ¶
NetworkIxLan holds the schema definition for the NetworkIxLan entity. Maps to the PeeringDB "netixlan" object type.
func (NetworkIxLan) Annotations ¶
func (NetworkIxLan) Annotations() []schema.Annotation
Annotations of the NetworkIxLan.
func (NetworkIxLan) Hooks ¶
func (NetworkIxLan) Hooks() []ent.Hook
Hooks returns NetworkIxLan mutation hooks for OTel tracing per D-46.
func (NetworkIxLan) Indexes ¶
func (NetworkIxLan) Indexes() []ent.Index
Indexes of the NetworkIxLan.
type Organization ¶
Organization holds the schema definition for the Organization entity. Maps to the PeeringDB "org" object type.
func (Organization) Annotations ¶
func (Organization) Annotations() []schema.Annotation
Annotations of the Organization.
func (Organization) Hooks ¶
func (Organization) Hooks() []ent.Hook
Hooks returns Organization mutation hooks for OTel tracing per D-46.
func (Organization) Indexes ¶
func (Organization) Indexes() []ent.Index
Indexes of the Organization.
func (Organization) Mixin ¶ added in v1.17.0
func (Organization) Mixin() []ent.Mixin
Mixin wires Phase 69 UNICODE-01 fold shadow columns onto Organization. Sibling-file pattern — see network_fold.go for the rationale.
type Poc ¶
Poc holds the schema definition for the Poc entity. Maps to the PeeringDB "poc" object type.
func (Poc) Policy ¶ added in v1.14.0
Policy returns the privacy policy for the Poc entity (Phase 59 VIS-04).
Lives in this separate file because `poc.go` is regenerated by `cmd/pdb-schema-generate` from `schema/peeringdb.json`, which would strip hand-added methods. The generator only touches files named after the generated type (`poc.go`), so `poc_policy.go` is invisible to it. ent's codegen still picks this method up via reflection on the Poc schema type — the Go file split is transparent to ent.
Query rule: rows with visible != "Public" (or NULL — see Pitfall 2 in 59-RESEARCH.md) are filtered out for any ctx whose tier is TierPublic. TierUsers callers (env-override PDBPLUS_PUBLIC_TIER=users, or a future OAuth session) see every row. Sync workers bypass the policy via privacy.DecisionContext(ctx, privacy.Allow) set at worker entry (internal/sync/worker.go — D-08/D-09), so ingest is unaffected.
No Mutation rule (D-03): sync writes travel the bypass; no other writers exist on this read-only mirror.
NULL-safety (Pitfall 2): SQL three-valued logic makes `visible = 'Public'` FALSE for NULL, so we OR with VisibleIsNil for defence-in-depth against any future migration that leaves rows with unset visibility. The schema's Default("Public") also backstops this on inserts — two independent safeguards, per threat T-59-04.
Source Files
¶
- campus.go
- campus_fold.go
- carrier.go
- carrier_fold.go
- carrierfacility.go
- facility.go
- facility_fold.go
- fold_mixin.go
- hooks.go
- internetexchange.go
- internetexchange_fold.go
- ixfacility.go
- ixlan.go
- ixprefix.go
- network.go
- network_fold.go
- networkfacility.go
- networkixlan.go
- organization.go
- organization_fold.go
- pdb_allowlists.go
- poc.go
- poc_policy.go
- types.go