Documentation ¶
Overview ¶
Package transport implements the xDS transport protocol functionality required by the xdsclient.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // ServerCfg contains all the configuration required to connect to the xDS // management server. ServerCfg bootstrap.ServerConfig // UpdateHandler is the component which makes ACK/NACK decisions based on // the received resources. // // Invoked inline and implementations must not block. UpdateHandler UpdateHandlerFunc // StreamErrorHandler provides a way for the transport layer to report // underlying stream errors. These can be bubbled all the way up to the user // of the xdsClient. // // Invoked inline and implementations must not block. StreamErrorHandler func(error) // Backoff controls the amount of time to backoff before recreating failed // ADS streams. If unspecified, a default exponential backoff implementation // is used. For more details, see: // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Backoff func(retries int) time.Duration // Logger does logging with a prefix. Logger *grpclog.PrefixLogger }
Options specifies configuration knobs used when creating a new Transport.
type ResourceUpdate ¶
type ResourceUpdate struct { // Resources is the list of resources received from the management server. Resources []*anypb.Any // URL is the resource type URL for the above resources. URL string // Version is the resource version, for the above resources, as specified by // the management server. Version string }
ResourceUpdate is a representation of the configuration update received from the management server. It only contains fields which are useful to the data model layer, and layers above it.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport provides a resource-type agnostic implementation of the xDS transport protocol. At this layer, resource contents are supposed to be opaque blobs which should be be meaningful only to the xDS data model layer which is implemented by the `xdsresource` package.
Under the hood, it owns the gRPC connection to a single management server and manages the lifecycle of ADS/LRS streams. It uses the xDS v3 transport protocol version.
func (*Transport) ChannelConnectivityStateForTesting ¶
func (t *Transport) ChannelConnectivityStateForTesting() connectivity.State
ChannelConnectivityStateForTesting returns the connectivity state of the gRPC channel to the management server.
Only for testing purposes.
func (*Transport) Close ¶
func (t *Transport) Close()
Close closes the Transport and frees any associated resources.
func (*Transport) ReportLoad ¶
ReportLoad starts reporting loads to the management server the transport is configured to use.
It returns a Store for the user to report loads and a function to cancel the load reporting.
func (*Transport) SendRequest ¶
SendRequest sends out an ADS request for the provided resources of the specified resource type.
The request is sent out asynchronously. If no valid stream exists at the time of processing this request, it is queued and will be sent out once a valid stream exists.
If a successful response is received, the update handler callback provided at creation time is invoked. If an error is encountered, the stream error handler callback provided at creation time is invoked.
type UpdateHandlerFunc ¶
type UpdateHandlerFunc func(update ResourceUpdate) error
UpdateHandlerFunc is the implementation at the xDS data model layer, which determines if the configuration received from the management server can be applied locally or not.
A nil error is returned from this function when the data model layer believes that the received configuration is good and can be applied locally. This will cause the transport layer to send an ACK to the management server. A non-nil error is returned from this function when the data model layer believes otherwise, and this will cause the transport layer to send a NACK.