/
HandshakerServiceGrpc.java
293 lines (258 loc) · 11.6 KB
/
HandshakerServiceGrpc.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
package io.grpc.alts.internal;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: grpc/gcp/handshaker.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class HandshakerServiceGrpc {
private HandshakerServiceGrpc() {}
public static final java.lang.String SERVICE_NAME = "grpc.gcp.HandshakerService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq,
io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "DoHandshake",
requestType = io.grpc.alts.internal.HandshakerReq.class,
responseType = io.grpc.alts.internal.HandshakerResp.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq,
io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod() {
io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod;
if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
synchronized (HandshakerServiceGrpc.class) {
if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
HandshakerServiceGrpc.getDoHandshakeMethod = getDoHandshakeMethod =
io.grpc.MethodDescriptor.<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "DoHandshake"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.alts.internal.HandshakerReq.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.alts.internal.HandshakerResp.getDefaultInstance()))
.setSchemaDescriptor(new HandshakerServiceMethodDescriptorSupplier("DoHandshake"))
.build();
}
}
}
return getDoHandshakeMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static HandshakerServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceStub>() {
@java.lang.Override
public HandshakerServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceStub(channel, callOptions);
}
};
return HandshakerServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static HandshakerServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingStub>() {
@java.lang.Override
public HandshakerServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceBlockingStub(channel, callOptions);
}
};
return HandshakerServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static HandshakerServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceFutureStub>() {
@java.lang.Override
public HandshakerServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceFutureStub(channel, callOptions);
}
};
return HandshakerServiceFutureStub.newStub(factory, channel);
}
/**
*/
public interface AsyncService {
/**
* <pre>
* Handshaker service accepts a stream of handshaker request, returning a
* stream of handshaker response. Client is expected to send exactly one
* message with either client_start or server_start followed by one or more
* messages with next. Each time client sends a request, the handshaker
* service expects to respond. Client does not have to wait for service's
* response before sending next request.
* </pre>
*/
default io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getDoHandshakeMethod(), responseObserver);
}
}
/**
* Base class for the server implementation of the service HandshakerService.
*/
public static abstract class HandshakerServiceImplBase
implements io.grpc.BindableService, AsyncService {
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return HandshakerServiceGrpc.bindService(this);
}
}
/**
* A stub to allow clients to do asynchronous rpc calls to service HandshakerService.
*/
public static final class HandshakerServiceStub
extends io.grpc.stub.AbstractAsyncStub<HandshakerServiceStub> {
private HandshakerServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected HandshakerServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceStub(channel, callOptions);
}
/**
* <pre>
* Handshaker service accepts a stream of handshaker request, returning a
* stream of handshaker response. Client is expected to send exactly one
* message with either client_start or server_start followed by one or more
* messages with next. Each time client sends a request, the handshaker
* service expects to respond. Client does not have to wait for service's
* response before sending next request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
getChannel().newCall(getDoHandshakeMethod(), getCallOptions()), responseObserver);
}
}
/**
* A stub to allow clients to do synchronous rpc calls to service HandshakerService.
*/
public static final class HandshakerServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingStub> {
private HandshakerServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected HandshakerServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceBlockingStub(channel, callOptions);
}
}
/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service HandshakerService.
*/
public static final class HandshakerServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<HandshakerServiceFutureStub> {
private HandshakerServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected HandshakerServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new HandshakerServiceFutureStub(channel, callOptions);
}
}
private static final int METHODID_DO_HANDSHAKE = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final AsyncService serviceImpl;
private final int methodId;
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_DO_HANDSHAKE:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.doHandshake(
(io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp>) responseObserver);
default:
throw new AssertionError();
}
}
}
public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getDoHandshakeMethod(),
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.alts.internal.HandshakerReq,
io.grpc.alts.internal.HandshakerResp>(
service, METHODID_DO_HANDSHAKE)))
.build();
}
private static abstract class HandshakerServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
HandshakerServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.alts.internal.HandshakerProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("HandshakerService");
}
}
private static final class HandshakerServiceFileDescriptorSupplier
extends HandshakerServiceBaseDescriptorSupplier {
HandshakerServiceFileDescriptorSupplier() {}
}
private static final class HandshakerServiceMethodDescriptorSupplier
extends HandshakerServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final java.lang.String methodName;
HandshakerServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (HandshakerServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new HandshakerServiceFileDescriptorSupplier())
.addMethod(getDoHandshakeMethod())
.build();
}
}
}
return result;
}
}