Documentation
¶
Overview ¶
Package grpcserver provides ConnectRPC service handlers for the PeeringDB gRPC API. Each handler implements the generated service interface and queries the ent database layer.
Index ¶
- func ListEntities[E any, P any](ctx context.Context, params ListParams[E, P]) ([]*P, string, error)
- func StreamEntities[E any, P any](ctx context.Context, params StreamParams[E, P], ...) error
- type CampusService
- func (s *CampusService) GetCampus(ctx context.Context, req *pb.GetCampusRequest) (*pb.GetCampusResponse, error)
- func (s *CampusService) ListCampuses(ctx context.Context, req *pb.ListCampusesRequest) (*pb.ListCampusesResponse, error)
- func (s *CampusService) StreamCampuses(ctx context.Context, req *pb.StreamCampusesRequest, ...) error
- type CarrierFacilityService
- func (s *CarrierFacilityService) GetCarrierFacility(ctx context.Context, req *pb.GetCarrierFacilityRequest) (*pb.GetCarrierFacilityResponse, error)
- func (s *CarrierFacilityService) ListCarrierFacilities(ctx context.Context, req *pb.ListCarrierFacilitiesRequest) (*pb.ListCarrierFacilitiesResponse, error)
- func (s *CarrierFacilityService) StreamCarrierFacilities(ctx context.Context, req *pb.StreamCarrierFacilitiesRequest, ...) error
- type CarrierService
- func (s *CarrierService) GetCarrier(ctx context.Context, req *pb.GetCarrierRequest) (*pb.GetCarrierResponse, error)
- func (s *CarrierService) ListCarriers(ctx context.Context, req *pb.ListCarriersRequest) (*pb.ListCarriersResponse, error)
- func (s *CarrierService) StreamCarriers(ctx context.Context, req *pb.StreamCarriersRequest, ...) error
- type FacilityService
- func (s *FacilityService) GetFacility(ctx context.Context, req *pb.GetFacilityRequest) (*pb.GetFacilityResponse, error)
- func (s *FacilityService) ListFacilities(ctx context.Context, req *pb.ListFacilitiesRequest) (*pb.ListFacilitiesResponse, error)
- func (s *FacilityService) StreamFacilities(ctx context.Context, req *pb.StreamFacilitiesRequest, ...) error
- type InternetExchangeService
- func (s *InternetExchangeService) GetInternetExchange(ctx context.Context, req *pb.GetInternetExchangeRequest) (*pb.GetInternetExchangeResponse, error)
- func (s *InternetExchangeService) ListInternetExchanges(ctx context.Context, req *pb.ListInternetExchangesRequest) (*pb.ListInternetExchangesResponse, error)
- func (s *InternetExchangeService) StreamInternetExchanges(ctx context.Context, req *pb.StreamInternetExchangesRequest, ...) error
- type IxFacilityService
- func (s *IxFacilityService) GetIxFacility(ctx context.Context, req *pb.GetIxFacilityRequest) (*pb.GetIxFacilityResponse, error)
- func (s *IxFacilityService) ListIxFacilities(ctx context.Context, req *pb.ListIxFacilitiesRequest) (*pb.ListIxFacilitiesResponse, error)
- func (s *IxFacilityService) StreamIxFacilities(ctx context.Context, req *pb.StreamIxFacilitiesRequest, ...) error
- type IxLanService
- func (s *IxLanService) GetIxLan(ctx context.Context, req *pb.GetIxLanRequest) (*pb.GetIxLanResponse, error)
- func (s *IxLanService) ListIxLans(ctx context.Context, req *pb.ListIxLansRequest) (*pb.ListIxLansResponse, error)
- func (s *IxLanService) StreamIxLans(ctx context.Context, req *pb.StreamIxLansRequest, ...) error
- type IxPrefixService
- func (s *IxPrefixService) GetIxPrefix(ctx context.Context, req *pb.GetIxPrefixRequest) (*pb.GetIxPrefixResponse, error)
- func (s *IxPrefixService) ListIxPrefixes(ctx context.Context, req *pb.ListIxPrefixesRequest) (*pb.ListIxPrefixesResponse, error)
- func (s *IxPrefixService) StreamIxPrefixes(ctx context.Context, req *pb.StreamIxPrefixesRequest, ...) error
- type ListParams
- type NetworkFacilityService
- func (s *NetworkFacilityService) GetNetworkFacility(ctx context.Context, req *pb.GetNetworkFacilityRequest) (*pb.GetNetworkFacilityResponse, error)
- func (s *NetworkFacilityService) ListNetworkFacilities(ctx context.Context, req *pb.ListNetworkFacilitiesRequest) (*pb.ListNetworkFacilitiesResponse, error)
- func (s *NetworkFacilityService) StreamNetworkFacilities(ctx context.Context, req *pb.StreamNetworkFacilitiesRequest, ...) error
- type NetworkIxLanService
- func (s *NetworkIxLanService) GetNetworkIxLan(ctx context.Context, req *pb.GetNetworkIxLanRequest) (*pb.GetNetworkIxLanResponse, error)
- func (s *NetworkIxLanService) ListNetworkIxLans(ctx context.Context, req *pb.ListNetworkIxLansRequest) (*pb.ListNetworkIxLansResponse, error)
- func (s *NetworkIxLanService) StreamNetworkIxLans(ctx context.Context, req *pb.StreamNetworkIxLansRequest, ...) error
- type NetworkService
- func (s *NetworkService) GetNetwork(ctx context.Context, req *pb.GetNetworkRequest) (*pb.GetNetworkResponse, error)
- func (s *NetworkService) ListNetworks(ctx context.Context, req *pb.ListNetworksRequest) (*pb.ListNetworksResponse, error)
- func (s *NetworkService) StreamNetworks(ctx context.Context, req *pb.StreamNetworksRequest, ...) error
- type OrganizationService
- func (s *OrganizationService) GetOrganization(ctx context.Context, req *pb.GetOrganizationRequest) (*pb.GetOrganizationResponse, error)
- func (s *OrganizationService) ListOrganizations(ctx context.Context, req *pb.ListOrganizationsRequest) (*pb.ListOrganizationsResponse, error)
- func (s *OrganizationService) StreamOrganizations(ctx context.Context, req *pb.StreamOrganizationsRequest, ...) error
- type PocService
- type StreamParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListEntities ¶ added in v1.9.0
ListEntities executes a paginated list query using type-specific callbacks. Returns converted proto items, next page token, and any error.
func StreamEntities ¶ added in v1.9.0
func StreamEntities[E any, P any](ctx context.Context, params StreamParams[E, P], stream *connect.ServerStream[P]) error
StreamEntities streams all matching entities using batched keyset pagination. Handles timeout, count header, SinceID/UpdatedSince, and batch iteration.
Header contract (PERF-06): on full streams (SinceID == nil AND UpdatedSince == nil) a SELECT COUNT(*) preflight runs and the grpc-total-count response header is set to the total matching row count. On delta streams (SinceID or UpdatedSince set) the COUNT preflight is skipped entirely and the grpc-total-count response header is absent — not "present with 0", not "present with -1". Delta clients pull incremental ranges and have no use for a full-table total, so we do not pay for the count.
Types ¶
type CampusService ¶
CampusService implements the peeringdb.v1.CampusService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*CampusService) GetCampus ¶
func (s *CampusService) GetCampus(ctx context.Context, req *pb.GetCampusRequest) (*pb.GetCampusResponse, error)
GetCampus returns a single campus by ID. Returns NOT_FOUND if the campus does not exist.
func (*CampusService) ListCampuses ¶
func (s *CampusService) ListCampuses(ctx context.Context, req *pb.ListCampusesRequest) (*pb.ListCampusesResponse, error)
ListCampuses returns a paginated list of campuses under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*CampusService) StreamCampuses ¶ added in v1.7.0
func (s *CampusService) StreamCampuses(ctx context.Context, req *pb.StreamCampusesRequest, stream *connect.ServerStream[pb.Campus]) error
StreamCampuses streams all matching campuses via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type CarrierFacilityService ¶
CarrierFacilityService implements the peeringdb.v1.CarrierFacilityService ConnectRPC handler interface.
func (*CarrierFacilityService) GetCarrierFacility ¶
func (s *CarrierFacilityService) GetCarrierFacility(ctx context.Context, req *pb.GetCarrierFacilityRequest) (*pb.GetCarrierFacilityResponse, error)
GetCarrierFacility returns a single carrier facility by ID.
func (*CarrierFacilityService) ListCarrierFacilities ¶
func (s *CarrierFacilityService) ListCarrierFacilities(ctx context.Context, req *pb.ListCarrierFacilitiesRequest) (*pb.ListCarrierFacilitiesResponse, error)
ListCarrierFacilities returns a paginated list of carrier facilities under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*CarrierFacilityService) StreamCarrierFacilities ¶ added in v1.7.0
func (s *CarrierFacilityService) StreamCarrierFacilities(ctx context.Context, req *pb.StreamCarrierFacilitiesRequest, stream *connect.ServerStream[pb.CarrierFacility]) error
StreamCarrierFacilities streams all matching carrier facilities via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type CarrierService ¶
CarrierService implements the peeringdb.v1.CarrierService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*CarrierService) GetCarrier ¶
func (s *CarrierService) GetCarrier(ctx context.Context, req *pb.GetCarrierRequest) (*pb.GetCarrierResponse, error)
GetCarrier returns a single carrier by ID. Returns NOT_FOUND if the carrier does not exist.
func (*CarrierService) ListCarriers ¶
func (s *CarrierService) ListCarriers(ctx context.Context, req *pb.ListCarriersRequest) (*pb.ListCarriersResponse, error)
ListCarriers returns a paginated list of carriers under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*CarrierService) StreamCarriers ¶ added in v1.7.0
func (s *CarrierService) StreamCarriers(ctx context.Context, req *pb.StreamCarriersRequest, stream *connect.ServerStream[pb.Carrier]) error
StreamCarriers streams all matching carriers via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type FacilityService ¶
FacilityService implements the peeringdb.v1.FacilityService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*FacilityService) GetFacility ¶
func (s *FacilityService) GetFacility(ctx context.Context, req *pb.GetFacilityRequest) (*pb.GetFacilityResponse, error)
GetFacility returns a single facility by ID. Returns NOT_FOUND if the facility does not exist.
func (*FacilityService) ListFacilities ¶
func (s *FacilityService) ListFacilities(ctx context.Context, req *pb.ListFacilitiesRequest) (*pb.ListFacilitiesResponse, error)
ListFacilities returns a paginated list of facilities under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*FacilityService) StreamFacilities ¶ added in v1.7.0
func (s *FacilityService) StreamFacilities(ctx context.Context, req *pb.StreamFacilitiesRequest, stream *connect.ServerStream[pb.Facility]) error
StreamFacilities streams all matching facilities via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type InternetExchangeService ¶
InternetExchangeService implements the peeringdb.v1.InternetExchangeService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*InternetExchangeService) GetInternetExchange ¶
func (s *InternetExchangeService) GetInternetExchange(ctx context.Context, req *pb.GetInternetExchangeRequest) (*pb.GetInternetExchangeResponse, error)
GetInternetExchange returns a single internet exchange by ID. Returns NOT_FOUND if the internet exchange does not exist.
func (*InternetExchangeService) ListInternetExchanges ¶
func (s *InternetExchangeService) ListInternetExchanges(ctx context.Context, req *pb.ListInternetExchangesRequest) (*pb.ListInternetExchangesResponse, error)
ListInternetExchanges returns a paginated list of internet exchanges under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*InternetExchangeService) StreamInternetExchanges ¶ added in v1.7.0
func (s *InternetExchangeService) StreamInternetExchanges(ctx context.Context, req *pb.StreamInternetExchangesRequest, stream *connect.ServerStream[pb.InternetExchange]) error
StreamInternetExchanges streams all matching internet exchanges via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type IxFacilityService ¶
IxFacilityService implements the peeringdb.v1.IxFacilityService ConnectRPC handler interface.
func (*IxFacilityService) GetIxFacility ¶
func (s *IxFacilityService) GetIxFacility(ctx context.Context, req *pb.GetIxFacilityRequest) (*pb.GetIxFacilityResponse, error)
GetIxFacility returns a single IX facility by ID.
func (*IxFacilityService) ListIxFacilities ¶
func (s *IxFacilityService) ListIxFacilities(ctx context.Context, req *pb.ListIxFacilitiesRequest) (*pb.ListIxFacilitiesResponse, error)
ListIxFacilities returns a paginated list of IX facilities under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*IxFacilityService) StreamIxFacilities ¶ added in v1.7.0
func (s *IxFacilityService) StreamIxFacilities(ctx context.Context, req *pb.StreamIxFacilitiesRequest, stream *connect.ServerStream[pb.IxFacility]) error
StreamIxFacilities streams all matching IX facilities via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type IxLanService ¶
IxLanService implements the peeringdb.v1.IxLanService ConnectRPC handler interface.
func (*IxLanService) GetIxLan ¶
func (s *IxLanService) GetIxLan(ctx context.Context, req *pb.GetIxLanRequest) (*pb.GetIxLanResponse, error)
GetIxLan returns a single IX LAN by ID.
func (*IxLanService) ListIxLans ¶
func (s *IxLanService) ListIxLans(ctx context.Context, req *pb.ListIxLansRequest) (*pb.ListIxLansResponse, error)
ListIxLans returns a paginated list of IX LANs under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*IxLanService) StreamIxLans ¶ added in v1.7.0
func (s *IxLanService) StreamIxLans(ctx context.Context, req *pb.StreamIxLansRequest, stream *connect.ServerStream[pb.IxLan]) error
StreamIxLans streams all matching IX LANs via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type IxPrefixService ¶
IxPrefixService implements the peeringdb.v1.IxPrefixService ConnectRPC handler interface.
func (*IxPrefixService) GetIxPrefix ¶
func (s *IxPrefixService) GetIxPrefix(ctx context.Context, req *pb.GetIxPrefixRequest) (*pb.GetIxPrefixResponse, error)
GetIxPrefix returns a single IX prefix by ID.
func (*IxPrefixService) ListIxPrefixes ¶
func (s *IxPrefixService) ListIxPrefixes(ctx context.Context, req *pb.ListIxPrefixesRequest) (*pb.ListIxPrefixesResponse, error)
ListIxPrefixes returns a paginated list of IX prefixes under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*IxPrefixService) StreamIxPrefixes ¶ added in v1.7.0
func (s *IxPrefixService) StreamIxPrefixes(ctx context.Context, req *pb.StreamIxPrefixesRequest, stream *connect.ServerStream[pb.IxPrefix]) error
StreamIxPrefixes streams all matching IX prefixes via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type ListParams ¶ added in v1.9.0
type ListParams[E any, P any] struct { EntityName string PageSize int32 PageToken string ApplyFilters func() ([]func(*sql.Selector), error) Query func(ctx context.Context, predicates []func(*sql.Selector), limit, offset int) ([]*E, error) Convert func(*E) *P }
ListParams holds type-specific callbacks for a paginated list query. E is the ent entity type, P is the proto message type.
type NetworkFacilityService ¶
NetworkFacilityService implements the peeringdb.v1.NetworkFacilityService ConnectRPC handler interface.
func (*NetworkFacilityService) GetNetworkFacility ¶
func (s *NetworkFacilityService) GetNetworkFacility(ctx context.Context, req *pb.GetNetworkFacilityRequest) (*pb.GetNetworkFacilityResponse, error)
GetNetworkFacility returns a single network facility by ID.
func (*NetworkFacilityService) ListNetworkFacilities ¶
func (s *NetworkFacilityService) ListNetworkFacilities(ctx context.Context, req *pb.ListNetworkFacilitiesRequest) (*pb.ListNetworkFacilitiesResponse, error)
ListNetworkFacilities returns a paginated list of network facilities under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*NetworkFacilityService) StreamNetworkFacilities ¶ added in v1.7.0
func (s *NetworkFacilityService) StreamNetworkFacilities(ctx context.Context, req *pb.StreamNetworkFacilitiesRequest, stream *connect.ServerStream[pb.NetworkFacility]) error
StreamNetworkFacilities streams all matching network facilities via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type NetworkIxLanService ¶
NetworkIxLanService implements the peeringdb.v1.NetworkIxLanService ConnectRPC handler interface.
func (*NetworkIxLanService) GetNetworkIxLan ¶
func (s *NetworkIxLanService) GetNetworkIxLan(ctx context.Context, req *pb.GetNetworkIxLanRequest) (*pb.GetNetworkIxLanResponse, error)
GetNetworkIxLan returns a single network IX LAN by ID.
func (*NetworkIxLanService) ListNetworkIxLans ¶
func (s *NetworkIxLanService) ListNetworkIxLans(ctx context.Context, req *pb.ListNetworkIxLansRequest) (*pb.ListNetworkIxLansResponse, error)
ListNetworkIxLans returns a paginated list of network IX LANs under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*NetworkIxLanService) StreamNetworkIxLans ¶ added in v1.7.0
func (s *NetworkIxLanService) StreamNetworkIxLans(ctx context.Context, req *pb.StreamNetworkIxLansRequest, stream *connect.ServerStream[pb.NetworkIxLan]) error
StreamNetworkIxLans streams all matching network IX LANs via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type NetworkService ¶
NetworkService implements the peeringdb.v1.NetworkService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*NetworkService) GetNetwork ¶
func (s *NetworkService) GetNetwork(ctx context.Context, req *pb.GetNetworkRequest) (*pb.GetNetworkResponse, error)
GetNetwork returns a single network by ID. Returns NOT_FOUND if the network does not exist.
func (*NetworkService) ListNetworks ¶
func (s *NetworkService) ListNetworks(ctx context.Context, req *pb.ListNetworksRequest) (*pb.ListNetworksResponse, error)
ListNetworks returns a paginated list of networks ordered by the compound default order (-updated, -created, -id) per Phase 67 ORDER-02. Supports all pdbcompat-parity filter fields with AND logic.
func (*NetworkService) StreamNetworks ¶ added in v1.7.0
func (s *NetworkService) StreamNetworks(ctx context.Context, req *pb.StreamNetworksRequest, stream *connect.ServerStream[pb.Network]) error
StreamNetworks streams all matching networks one message at a time using batched compound (updated, id) keyset pagination under the (-updated, -created, -id) default order. Supports all pdbcompat-parity filter fields.
type OrganizationService ¶
OrganizationService implements the peeringdb.v1.OrganizationService ConnectRPC handler interface. It queries the ent database layer and converts results to protobuf messages.
func (*OrganizationService) GetOrganization ¶
func (s *OrganizationService) GetOrganization(ctx context.Context, req *pb.GetOrganizationRequest) (*pb.GetOrganizationResponse, error)
GetOrganization returns a single organization by ID. Returns NOT_FOUND if the organization does not exist.
func (*OrganizationService) ListOrganizations ¶
func (s *OrganizationService) ListOrganizations(ctx context.Context, req *pb.ListOrganizationsRequest) (*pb.ListOrganizationsResponse, error)
ListOrganizations returns a paginated list of organizations under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02. Supports all pdbcompat-parity filter fields with AND logic.
func (*OrganizationService) StreamOrganizations ¶ added in v1.7.0
func (s *OrganizationService) StreamOrganizations(ctx context.Context, req *pb.StreamOrganizationsRequest, stream *connect.ServerStream[pb.Organization]) error
StreamOrganizations streams all matching organizations via compound (updated, id) keyset pagination under the (-updated, -created, -id) order.
type PocService ¶
PocService implements the peeringdb.v1.PocService ConnectRPC handler interface.
func (*PocService) GetPoc ¶
func (s *PocService) GetPoc(ctx context.Context, req *pb.GetPocRequest) (*pb.GetPocResponse, error)
GetPoc returns a single point of contact by ID.
func (*PocService) ListPocs ¶
func (s *PocService) ListPocs(ctx context.Context, req *pb.ListPocsRequest) (*pb.ListPocsResponse, error)
ListPocs returns a paginated list of points of contact under the compound default order (-updated, -created, -id) per Phase 67 ORDER-02.
func (*PocService) StreamPocs ¶ added in v1.7.0
func (s *PocService) StreamPocs(ctx context.Context, req *pb.StreamPocsRequest, stream *connect.ServerStream[pb.Poc]) error
StreamPocs streams all matching points of contact via compound (updated, id) keyset pagination under the (-updated, -created, -id) default order.
type StreamParams ¶ added in v1.9.0
type StreamParams[E any, P any] struct { EntityName string Timeout time.Duration SinceID *int64 UpdatedSince *timestamppb.Timestamp ApplyFilters func() ([]func(*sql.Selector), error) Count func(ctx context.Context, predicates []func(*sql.Selector)) (int, error) // QueryBatch fetches the next batch under compound keyset pagination. When // cursor.empty() the query runs without a cursor predicate; otherwise the // handler emits the compound keyset predicate // WHERE (updated < cursor.Updated) OR (updated = cursor.Updated AND id < cursor.ID) // under the `(-updated, -created, -id)` default order (Phase 67, CONTEXT.md // D-01 / D-05). QueryBatch func(ctx context.Context, predicates []func(*sql.Selector), cursor streamCursor, limit int) ([]*E, error) Convert func(*E) *P GetID func(*E) int // GetUpdated extracts the `updated` timestamp from an entity for the // compound cursor's primary key. Required by StreamEntities to emit the // next-batch cursor after each batch drains. GetUpdated func(*E) time.Time }
StreamParams holds type-specific callbacks for a streaming query. E is the ent entity type, P is the proto message type.