• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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.internal;
18 
19 import io.grpc.Attributes;
20 import io.grpc.EquivalentAddressGroup;
21 import io.grpc.Grpc;
22 import io.grpc.NameResolver;
23 import io.grpc.SecurityLevel;
24 import java.util.Map;
25 
26 /**
27  * Special attributes that are only useful to gRPC.
28  */
29 public final class GrpcAttributes {
30   /**
31    * Attribute key for service config.
32    */
33   @NameResolver.ResolutionResultAttr
34   public static final Attributes.Key<Map<String, Object>> NAME_RESOLVER_SERVICE_CONFIG =
35       Attributes.Key.create("service-config");
36 
37   /**
38    * The naming authority of a gRPC LB server address.  It is an address-group-level attribute,
39    * present when the address group is a LoadBalancer.
40    */
41   @EquivalentAddressGroup.Attr
42   public static final Attributes.Key<String> ATTR_LB_ADDR_AUTHORITY =
43       Attributes.Key.create("io.grpc.grpclb.lbAddrAuthority");
44 
45   /**
46    * Whether this EquivalentAddressGroup was provided by a GRPCLB server. It would be rare for this
47    * value to be {@code false}; generally it would be better to not have the key present at all.
48    */
49   @EquivalentAddressGroup.Attr
50   public static final Attributes.Key<Boolean> ATTR_LB_PROVIDED_BACKEND =
51       Attributes.Key.create("io.grpc.grpclb.lbProvidedBackend");
52 
53   /**
54    * The security level of the transport.  If it's not present, {@link SecurityLevel#NONE} should be
55    * assumed.
56    */
57   @SuppressWarnings("deprecation")
58   @Grpc.TransportAttr
59   public static final Attributes.Key<SecurityLevel> ATTR_SECURITY_LEVEL =
60       io.grpc.CallCredentials.ATTR_SECURITY_LEVEL;
61 
GrpcAttributes()62   private GrpcAttributes() {}
63 }
64