File tree Expand file tree Collapse file tree 8 files changed +24
-34
lines changed
main/java/io/grpc/alts/internal
test/java/io/grpc/alts/internal
core/src/main/java/io/grpc/internal Expand file tree Collapse file tree 8 files changed +24
-34
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ java_library(
11
11
":handshaker_java_proto" ,
12
12
"//api" ,
13
13
"//core:internal" ,
14
+ "//grpclb" ,
14
15
"//netty" ,
15
16
"//stub" ,
16
17
"@com_google_code_findbugs_jsr305//jar" ,
@@ -32,7 +33,6 @@ java_library(
32
33
"src/main/java/io/grpc/alts/*.java" ,
33
34
]),
34
35
visibility = ["//visibility:public" ],
35
- runtime_deps = ["//grpclb" ],
36
36
deps = [
37
37
":alts_internal" ,
38
38
":handshaker_java_grpc" ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ targetCompatibility = 1.7
15
15
dependencies {
16
16
compile project(' :grpc-auth' ),
17
17
project(' :grpc-core' ),
18
+ project(' :grpc-grpclb' ),
18
19
project(' :grpc-netty' ),
19
20
project(' :grpc-protobuf' ),
20
21
project(' :grpc-stub' ),
@@ -28,7 +29,6 @@ dependencies {
28
29
exclude group : ' io.grpc' , module : ' grpc-context'
29
30
}
30
31
compileOnly libraries. javax_annotation
31
- runtime project(' :grpc-grpclb' )
32
32
testCompile project(' :grpc-testing' ),
33
33
project(' :grpc-testing-proto' ),
34
34
libraries. guava,
Original file line number Diff line number Diff line change 29
29
import io .grpc .SecurityLevel ;
30
30
import io .grpc .Status ;
31
31
import io .grpc .alts .internal .RpcProtocolVersionsUtil .RpcVersionsCheckResult ;
32
- import io .grpc .internal . GrpcAttributes ;
32
+ import io .grpc .grpclb . GrpclbConstants ;
33
33
import io .grpc .internal .ObjectPool ;
34
34
import io .grpc .netty .GrpcHttp2ConnectionHandler ;
35
35
import io .grpc .netty .InternalNettyChannelBuilder ;
@@ -223,13 +223,13 @@ public AsciiString scheme() {
223
223
return SCHEME ;
224
224
}
225
225
226
- @ SuppressWarnings ("deprecation" )
227
226
@ Override
228
227
public ChannelHandler newHandler (GrpcHttp2ConnectionHandler grpcHandler ) {
229
228
ChannelHandler gnh = InternalProtocolNegotiators .grpcNegotiationHandler (grpcHandler );
230
229
ChannelHandler securityHandler ;
231
- if (grpcHandler .getEagAttributes ().get (GrpcAttributes .ATTR_LB_ADDR_AUTHORITY ) != null
232
- || grpcHandler .getEagAttributes ().get (GrpcAttributes .ATTR_LB_PROVIDED_BACKEND ) != null ) {
230
+ if (grpcHandler .getEagAttributes ().get (GrpclbConstants .ATTR_LB_ADDR_AUTHORITY ) != null
231
+ || grpcHandler .getEagAttributes ().get (
232
+ GrpclbConstants .ATTR_LB_PROVIDED_BACKEND ) != null ) {
233
233
TsiHandshaker handshaker = handshakerFactory .newHandshaker (grpcHandler .getAuthority ());
234
234
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker (handshaker );
235
235
securityHandler =
Original file line number Diff line number Diff line change 24
24
import io .grpc .Attributes ;
25
25
import io .grpc .Channel ;
26
26
import io .grpc .ManagedChannel ;
27
+ import io .grpc .grpclb .GrpclbConstants ;
27
28
import io .grpc .inprocess .InProcessChannelBuilder ;
28
- import io .grpc .internal .GrpcAttributes ;
29
29
import io .grpc .internal .ObjectPool ;
30
30
import io .grpc .netty .GrpcHttp2ConnectionHandler ;
31
31
import io .grpc .netty .GrpcSslContexts ;
@@ -80,7 +80,7 @@ public void tearDown() {
80
80
@ Test
81
81
public void altsHandler () {
82
82
Attributes eagAttributes =
83
- Attributes .newBuilder ().set (GrpcAttributes .ATTR_LB_PROVIDED_BACKEND , true ).build ();
83
+ Attributes .newBuilder ().set (GrpclbConstants .ATTR_LB_PROVIDED_BACKEND , true ).build ();
84
84
GrpcHttp2ConnectionHandler mockHandler = mock (GrpcHttp2ConnectionHandler .class );
85
85
when (mockHandler .getEagAttributes ()).thenReturn (eagAttributes );
86
86
Original file line number Diff line number Diff line change 25
25
* Special attributes that are only useful to gRPC.
26
26
*/
27
27
public final class GrpcAttributes {
28
- /**
29
- * The naming authority of a gRPC LB server address. It is an address-group-level attribute,
30
- * present when the address group is a LoadBalancer.
31
- *
32
- * <p>Deprecated: this will be used for grpclb specific logic, which will be moved out of core.
33
- */
34
- @ Deprecated
35
- @ EquivalentAddressGroup .Attr
36
- public static final Attributes .Key <String > ATTR_LB_ADDR_AUTHORITY =
37
- Attributes .Key .create ("io.grpc.grpclb.lbAddrAuthority" );
38
-
39
- /**
40
- * Whether this EquivalentAddressGroup was provided by a GRPCLB server. It would be rare for this
41
- * value to be {@code false}; generally it would be better to not have the key present at all.
42
- */
43
- @ EquivalentAddressGroup .Attr
44
- public static final Attributes .Key <Boolean > ATTR_LB_PROVIDED_BACKEND =
45
- Attributes .Key .create ("io.grpc.grpclb.lbProvidedBackend" );
46
-
47
28
/**
48
29
* The security level of the transport. If it's not present, {@link SecurityLevel#NONE} should be
49
30
* assumed.
Original file line number Diff line number Diff line change @@ -48,10 +48,21 @@ public final class GrpclbConstants {
48
48
static final Attributes .Key <List <EquivalentAddressGroup >> ATTR_LB_ADDRS =
49
49
Attributes .Key .create ("io.grpc.grpclb.lbAddrs" );
50
50
51
- @ SuppressWarnings ("deprecation" )
51
+ /**
52
+ * The naming authority of a gRPC LB server address. It is an address-group-level attribute,
53
+ * present when the address group is a LoadBalancer.
54
+ */
55
+ @ EquivalentAddressGroup .Attr
56
+ public static final Attributes .Key <String > ATTR_LB_ADDR_AUTHORITY =
57
+ Attributes .Key .create ("io.grpc.grpclb.lbAddrAuthority" );
58
+
59
+ /**
60
+ * Whether this EquivalentAddressGroup was provided by a GRPCLB server. It would be rare for this
61
+ * value to be {@code false}; generally it would be better to not have the key present at all.
62
+ */
52
63
@ EquivalentAddressGroup .Attr
53
- static final Attributes .Key <String > ATTR_LB_ADDR_AUTHORITY =
54
- io .grpc .internal . GrpcAttributes . ATTR_LB_ADDR_AUTHORITY ;
64
+ public static final Attributes .Key <Boolean > ATTR_LB_PROVIDED_BACKEND =
65
+ Attributes . Key . create ( " io.grpc.grpclb.lbProvidedBackend" ) ;
55
66
56
67
private GrpclbConstants () { }
57
68
}
Original file line number Diff line number Diff line change 47
47
import io .grpc .SynchronizationContext ;
48
48
import io .grpc .SynchronizationContext .ScheduledHandle ;
49
49
import io .grpc .internal .BackoffPolicy ;
50
- import io .grpc .internal .GrpcAttributes ;
51
50
import io .grpc .internal .TimeProvider ;
52
51
import io .grpc .lb .v1 .ClientStats ;
53
52
import io .grpc .lb .v1 .InitialLoadBalanceRequest ;
86
85
final class GrpclbState {
87
86
static final long FALLBACK_TIMEOUT_MS = TimeUnit .SECONDS .toMillis (10 );
88
87
private static final Attributes LB_PROVIDED_BACKEND_ATTRS =
89
- Attributes .newBuilder ().set (GrpcAttributes .ATTR_LB_PROVIDED_BACKEND , true ).build ();
88
+ Attributes .newBuilder ().set (GrpclbConstants .ATTR_LB_PROVIDED_BACKEND , true ).build ();
90
89
91
90
@ VisibleForTesting
92
91
static final PickResult DROP_PICK_RESULT =
Original file line number Diff line number Diff line change 76
76
import io .grpc .inprocess .InProcessServerBuilder ;
77
77
import io .grpc .internal .BackoffPolicy ;
78
78
import io .grpc .internal .FakeClock ;
79
- import io .grpc .internal .GrpcAttributes ;
80
79
import io .grpc .internal .JsonParser ;
81
80
import io .grpc .lb .v1 .ClientStats ;
82
81
import io .grpc .lb .v1 .ClientStatsPerToken ;
@@ -142,7 +141,7 @@ public boolean shouldAccept(Runnable command) {
142
141
}
143
142
};
144
143
private static final Attributes LB_BACKEND_ATTRS =
145
- Attributes .newBuilder ().set (GrpcAttributes .ATTR_LB_PROVIDED_BACKEND , true ).build ();
144
+ Attributes .newBuilder ().set (GrpclbConstants .ATTR_LB_PROVIDED_BACKEND , true ).build ();
146
145
147
146
@ Mock
148
147
private Helper helper ;
You can’t perform that action at this time.
0 commit comments