Documentation
¶
Overview ¶
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
- func UnwrapResource(r *anypb.Any) (*anypb.Any, error)
- type ErrorType
- type Name
- type ResourceWatchState
- type ServiceStatus
- type UpdateErrorMetadata
- type UpdateMetadata
- type WatchState
Constants ¶
const ( V3ListenerURL = googleapiPrefix + "envoy.config.listener.v3.Listener" V3HTTPConnManagerURL = googleapiPrefix + "envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager" V3ResourceWrapperURL = googleapiPrefix + "envoy.service.discovery.v3.Resource" )
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.
Variables ¶
This section is empty.
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.
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 )
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.
type ResourceWatchState ¶ added in v1.74.0
type ResourceWatchState struct {
State WatchState // Watch state of the resource.
ExpiryTimer *time.Timer // Timer for the expiry of the watch.
}
ResourceWatchState is the state corresponding to a resource being watched.
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 WatchState ¶ added in v1.74.0
type WatchState int
WatchState is a enum that describes the watch state of a particular resource.
const ( // ResourceWatchStateStarted is the state where a watch for a resource was // started, but a request asking for that resource is yet to be sent to the // management server. ResourceWatchStateStarted WatchState = iota // ResourceWatchStateRequested is the state when a request has been sent for // the resource being watched. ResourceWatchStateRequested // ResourceWatchStateReceived is the state when a response has been received // for the resource being watched. ResourceWatchStateReceived // ResourceWatchStateTimeout is the state when the watch timer associated // with the resource expired because no response was received. ResourceWatchStateTimeout )