pdbtypes

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package pdbtypes is the leaf source of truth for the 13 PeeringDB object types. It imports nothing, so every layer of the tree — codegen tools, sync, observability, operator tooling — can share one canonical list instead of hand-copying it.

Each type is named in three domains:

  • Name: the PeeringDB API path segment ("net", "ixpfx") used in URLs, pdbcompat Registry keys, and metric attributes
  • GoName: the ent Go type name ("Network", "IxPrefix")
  • DjangoModel: the upstream django-peeringdb model class ("Network", "IXLanPrefix") used when parsing upstream source

internal/sync deliberately keeps its own ordered step list (worker.go canonicalStepOrder): cmd/loadtest's ordering parity test cross-checks it against Names(), so the two lists guard each other rather than one deriving from the other.

Index

Constants

This section is empty.

Variables

View Source
var All = []Type{
	{Name: "org", GoName: "Organization", DjangoModel: "Organization"},
	{Name: "campus", GoName: "Campus", DjangoModel: "Campus"},
	{Name: "fac", GoName: "Facility", DjangoModel: "Facility"},
	{Name: "carrier", GoName: "Carrier", DjangoModel: "Carrier"},
	{Name: "carrierfac", GoName: "CarrierFacility", DjangoModel: "CarrierFacility"},
	{Name: "ix", GoName: "InternetExchange", DjangoModel: "InternetExchange"},
	{Name: "ixlan", GoName: "IxLan", DjangoModel: "IXLan"},
	{Name: "ixpfx", GoName: "IxPrefix", DjangoModel: "IXLanPrefix"},
	{Name: "ixfac", GoName: "IxFacility", DjangoModel: "InternetExchangeFacility"},
	{Name: "net", GoName: "Network", DjangoModel: "Network"},
	{Name: "poc", GoName: "Poc", DjangoModel: "NetworkContact"},
	{Name: "netfac", GoName: "NetworkFacility", DjangoModel: "NetworkFacility"},
	{Name: "netixlan", GoName: "NetworkIxLan", DjangoModel: "NetworkIXLan"},
}

All lists the 13 PeeringDB object types in canonical parent-before-child order (the order sync steps run in).

Functions

func FromDjangoModel

func FromDjangoModel(model string) (name string, ok bool)

FromDjangoModel maps an upstream Django model class ("IXLanPrefix") to its PeeringDB type name ("ixpfx"). ok is false for unknown names.

func FromGoName

func FromGoName(goName string) (name string, ok bool)

FromGoName maps an ent Go type name ("Network") to its PeeringDB type name ("net"). ok is false for unknown names.

func GoNameOf

func GoNameOf(name string) (goName string, ok bool)

GoNameOf maps a PeeringDB type name ("net") to its ent Go type name ("Network"). ok is false for unknown names.

func Names

func Names() []string

Names returns the 13 PeeringDB type names in canonical parent-before-child order. The slice is a fresh copy.

func SortedNames

func SortedNames() []string

SortedNames returns the 13 PeeringDB type names in alphabetical order. The slice is a fresh copy.

func Valid

func Valid(name string) bool

Valid reports whether name is one of the 13 PeeringDB type names.

Types

type Type

type Type struct {
	Name        string // PeeringDB API path segment, e.g. "net"
	GoName      string // ent Go type name, e.g. "Network"
	DjangoModel string // upstream Django model class, e.g. "Network"
}

Type names one PeeringDB object type across the three naming domains used in this repo and upstream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL