package xdsresource
import "google.golang.org/grpc/xds/internal/clients/xdsclient/internal/xdsresource"
Package xdsresource defines constants to distinguish between supported xDS API versions.
Index ¶
- Constants
- func IsHTTPConnManagerResource(url string) bool
- func IsListenerResource(url string) bool
- func NewError(t ErrorType, message string) error
- func NewErrorf(t ErrorType, format string, args ...any) error
- type ErrorType
- type Name
- type ServiceStatus
- type UpdateErrorMetadata
- type UpdateMetadata
- type UpdateWithMD
Constants ¶
const ( V3ListenerURL = googleapiPrefix + "envoy.config.listener.v3.Listener" V3HTTPConnManagerURL = googleapiPrefix + "envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager" )
Resource URLs. We need to be able to accept either version of the resource regardless of the version of the transport protocol in use.
const FederationScheme = "xdstp"
FederationScheme is the scheme of a federation resource name.
Functions ¶
func IsHTTPConnManagerResource ¶
IsHTTPConnManagerResource returns true if the provider URL corresponds to an xDS HTTPConnManager resource.
func IsListenerResource ¶
IsListenerResource returns true if the provider URL corresponds to an xDS Listener resource.
func NewError ¶
NewError creates an xDS client error. The callbacks are called with this error, to pass additional information about the error.
func NewErrorf ¶
NewErrorf creates an xDS client error. The callbacks are called with this error, to pass additional information about the error.
Types ¶
type ErrorType ¶
type ErrorType int
ErrorType is the type of the error that the watcher will receive from the xds client.
const ( // ErrorTypeUnknown indicates the error doesn't have a specific type. It is // the default value, and is returned if the error is not an xds error. ErrorTypeUnknown ErrorType = iota // ErrorTypeConnection indicates a connection error from the gRPC client. ErrorTypeConnection // ErrorTypeResourceNotFound indicates a resource is not found from the xds // response. It's typically returned if the resource is removed in the xds // server. ErrorTypeResourceNotFound // ErrorTypeResourceTypeUnsupported indicates the receipt of a message from // the management server with resources of an unsupported resource type. ErrorTypeResourceTypeUnsupported // ErrTypeStreamFailedAfterRecv indicates an ADS stream error, after // successful receipt of at least one message from the server. ErrTypeStreamFailedAfterRecv // ErrorTypeNACKed indicates that configuration provided by the xDS management // server was NACKed. ErrorTypeNACKed )
func ErrType ¶
ErrType returns the error's type.
type Name ¶
type Name struct { Scheme string Authority string Type string ID string ContextParams map[string]string // contains filtered or unexported fields }
Name contains the parsed component of an xDS resource name.
An xDS resource name is in the format of xdstp://[{authority}]/{resource type}/{id/*}?{context parameters}{#processing directive,*}
See https://github.com/cncf/xds/blob/main/proposals/TP1-xds-transport-next.md#uri-based-xds-resource-names for details, and examples.
func ParseName ¶
ParseName splits the name and returns a struct representation of the Name.
If the name isn't a valid new-style xDS name, field ID is set to the input. Note that this is not an error, because we still support the old-style resource names (those not starting with "xdstp:").
The caller can tell if the parsing is successful by checking the returned Scheme.
func (*Name) String ¶
String returns a canonicalized string of name. The context parameters are sorted by the keys.
type ServiceStatus ¶
type ServiceStatus int
ServiceStatus is the status of the update.
const ( // ServiceStatusUnknown is the default state, before a watch is started for // the resource. ServiceStatusUnknown ServiceStatus = iota // ServiceStatusRequested is when the watch is started, but before and // response is received. ServiceStatusRequested // ServiceStatusNotExist is when the resource doesn't exist in // state-of-the-world responses (e.g. LDS and CDS), which means the resource // is removed by the management server. ServiceStatusNotExist // Resource is removed in the server, in LDS/CDS. // ServiceStatusACKed is when the resource is ACKed. ServiceStatusACKed // ServiceStatusNACKed is when the resource is NACKed. ServiceStatusNACKed )
type UpdateErrorMetadata ¶
type UpdateErrorMetadata struct { // Version is the version of the NACKed response. Version string // Err contains why the response was NACKed. Err error // Timestamp is when the NACKed response was received. Timestamp time.Time }
UpdateErrorMetadata is part of UpdateMetadata. It contains the error state when a response is NACKed.
type UpdateMetadata ¶
type UpdateMetadata struct { // Status is the status of this resource, e.g. ACKed, NACKed, or // Not_exist(removed). Status ServiceStatus // Version is the version of the xds response. Note that this is the version // of the resource in use (previous ACKed). If a response is NACKed, the // NACKed version is in ErrState. Version string // Timestamp is when the response is received. Timestamp time.Time // ErrState is set when the update is NACKed. ErrState *UpdateErrorMetadata }
UpdateMetadata contains the metadata for each update, including timestamp, raw message, and so on.
type UpdateWithMD ¶
type UpdateWithMD struct { MD UpdateMetadata Raw *anypb.Any }
UpdateWithMD contains the raw message of the update and the metadata, including version, raw message, timestamp.
This is to be used for config dump and CSDS, not directly by users (like resolvers/balancers).
Source Files ¶
errors.go name.go type.go version.go
- Version
- v1.73.0-dev
- Published
- Apr 3, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 6 hours ago –
Tools for package owners.