xdsResolver implements the resolver.Resolver interface. It manages the dependency manager which in turn manages all xDS resource watches. It receives the xDS resource config and passes them to ClientConn.
| 223 | // It manages the dependency manager which in turn manages all xDS resource |
| 224 | // watches. It receives the xDS resource config and passes them to ClientConn. |
| 225 | type xdsResolver struct { |
| 226 | // The following fields are initialized at creation time and are read-only |
| 227 | // after that. |
| 228 | cc resolver.ClientConn |
| 229 | logger *grpclog.PrefixLogger |
| 230 | ldsResourceName string |
| 231 | dm *xdsdepmgr.DependencyManager |
| 232 | xdsClient xdsclient.XDSClient |
| 233 | xdsClientClose func() |
| 234 | channelID uint64 // Unique random ID for the channel owning this resolver. |
| 235 | // All methods on the xdsResolver type except for the ones invoked by gRPC, |
| 236 | // i.e ResolveNow() and Close(), are guaranteed to execute in the context of |
| 237 | // this serializer's callback. We use the serializer because these shared |
| 238 | // states are accessed by each RPC when it is committed, and so |
| 239 | // serializer is preffered over a mutex. |
| 240 | serializer *grpcsync.CallbackSerializer |
| 241 | serializerCancel context.CancelFunc |
| 242 | |
| 243 | // The following fields are accessed only from within the serializer |
| 244 | // callbacks. |
| 245 | xdsConfig *xdsresource.XDSConfig |
| 246 | // activeClusters is a map from cluster name to information about the |
| 247 | // weighted cluster that includes a reference count and load balancing |
| 248 | // configuration. These counts are used only by the resolver. The current |
| 249 | // configSelector holds one reference, and each ongoing RPC holds an |
| 250 | // additional reference. When the count hits zero, the resolver removes the |
| 251 | // cluster from this map and calls unsubscribe. This signals the dependency |
| 252 | // manager to stop the xDS watch once its own reference count reaches zero. |
| 253 | activeClusters map[string]*clusterInfo |
| 254 | // activePlugins is a map from cluster specifier plugin name to information |
| 255 | // about the cluster specifier plugin that includes a ref count and load |
| 256 | // balancing configuration. These counts are used only by the resolver. The |
| 257 | // current configSelector holds one reference, and each ongoing RPC holds an |
| 258 | // additional reference. When the count hits zero, the resolver removes the |
| 259 | // plugin name from this map. |
| 260 | activePlugins map[string]*clusterInfo |
| 261 | curConfigSelector stoppableConfigSelector |
| 262 | // httpFilters is a map from client filter key to client filter instance. It |
| 263 | // lives here so that the resolver can reuse filter instances across config |
| 264 | // updates when the same filter is specified, and to be able to clean up |
| 265 | // filter instances that are no longer used. |
| 266 | httpFilters map[clientFilterKey]httpfilter.ClientFilter |
| 267 | } |
| 268 | |
| 269 | // ResolveNow calls RequestDNSReresolution on the dependency manager. |
| 270 | func (r *xdsResolver) ResolveNow(opts resolver.ResolveNowOptions) { |
nothing calls this directly
no outgoing calls
no test coverage detected