1 /* 2 * Copyright 2019 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.grpc.xds; 18 19 import io.grpc.Attributes; 20 import io.grpc.EquivalentAddressGroup; 21 import io.grpc.Grpc; 22 import io.grpc.Internal; 23 import io.grpc.NameResolver; 24 import io.grpc.internal.ObjectPool; 25 import io.grpc.xds.XdsNameResolverProvider.CallCounterProvider; 26 import io.grpc.xds.internal.security.SslContextProviderSupplier; 27 28 /** 29 * Internal attributes used for xDS implementation. Do not use. 30 */ 31 @Internal 32 public final class InternalXdsAttributes { 33 34 // TODO(sanjaypujare): move to xds internal package. 35 /** Attribute key for SslContextProviderSupplier (used from client) for a subchannel. */ 36 @Grpc.TransportAttr 37 public static final Attributes.Key<SslContextProviderSupplier> 38 ATTR_SSL_CONTEXT_PROVIDER_SUPPLIER = 39 Attributes.Key.create("io.grpc.xds.internal.security.SslContextProviderSupplier"); 40 41 /** 42 * Attribute key for passing around the XdsClient object pool across NameResolver/LoadBalancers. 43 */ 44 @NameResolver.ResolutionResultAttr 45 static final Attributes.Key<ObjectPool<XdsClient>> XDS_CLIENT_POOL = 46 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.xdsClientPool"); 47 48 /** 49 * Attribute key for obtaining the global provider that provides atomics for aggregating 50 * outstanding RPCs sent to each cluster. 51 */ 52 @NameResolver.ResolutionResultAttr 53 static final Attributes.Key<CallCounterProvider> CALL_COUNTER_PROVIDER = 54 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.callCounterProvider"); 55 56 /** 57 * Map from localities to their weights. 58 */ 59 @NameResolver.ResolutionResultAttr 60 static final Attributes.Key<Integer> ATTR_LOCALITY_WEIGHT = 61 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.localityWeight"); 62 63 /** 64 * Name of the cluster that provides this EquivalentAddressGroup. 65 */ 66 @Internal 67 @EquivalentAddressGroup.Attr 68 public static final Attributes.Key<String> ATTR_CLUSTER_NAME = 69 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.clusterName"); 70 71 /** 72 * The locality that this EquivalentAddressGroup is in. 73 */ 74 @EquivalentAddressGroup.Attr 75 static final Attributes.Key<Locality> ATTR_LOCALITY = 76 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.locality"); 77 78 /** 79 * Endpoint weight for load balancing purposes. 80 */ 81 @EquivalentAddressGroup.Attr 82 static final Attributes.Key<Long> ATTR_SERVER_WEIGHT = 83 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.serverWeight"); 84 85 /** 86 * Filter chain match for network filters. 87 */ 88 @Grpc.TransportAttr 89 static final Attributes.Key<FilterChainSelectorManager> 90 ATTR_FILTER_CHAIN_SELECTOR_MANAGER = Attributes.Key.create( 91 "io.grpc.xds.InternalXdsAttributes.filterChainSelectorManager"); 92 93 /** Grace time to use when draining. Null for an infinite grace time. */ 94 @Grpc.TransportAttr 95 static final Attributes.Key<Long> ATTR_DRAIN_GRACE_NANOS = 96 Attributes.Key.create("io.grpc.xds.InternalXdsAttributes.drainGraceTime"); 97 InternalXdsAttributes()98 private InternalXdsAttributes() {} 99 } 100