Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
cdf4ed0
Proposed changes to introduce interfaces in generated code.
larry-safran Oct 25, 2022
2dce4a5
Eliminate all added imports from generated file.
larry-safran Oct 25, 2022
93fa7e7
compiler: Checkpoint
larry-safran Oct 26, 2022
e1a8c5a
compiler: Checkpoint
larry-safran Oct 26, 2022
a217114
compiler: Checkpoint
larry-safran Oct 26, 2022
cf5f1e2
compiler: Checkpoint
larry-safran Oct 26, 2022
9b425fe
Use fully qualified class names, even for the current package.
larry-safran Nov 9, 2022
4d4fefc
Update generator logic to add in the interfaces and match what was ha…
larry-safran Nov 10, 2022
564f872
Fix some syntax errors.
larry-safran Nov 10, 2022
255b436
Fix some syntax errors.
larry-safran Nov 10, 2022
e6e84e4
fix syntax errors
larry-safran Nov 10, 2022
e701d2d
Fix some syntax errors.
larry-safran Nov 10, 2022
0e7c7e1
Final tweaks.
larry-safran Nov 11, 2022
32ad259
Final tweaks
larry-safran Nov 11, 2022
c48561c
update golden files to match output with interfaces
larry-safran Nov 11, 2022
611c1ae
Update all generated service files (*Grpc.java)
larry-safran Nov 12, 2022
a47baab
Add the generated java files from subprojects that aren't built by
larry-safran Nov 12, 2022
ab4a5a4
Remove interfaces from stubs (includes not creating BLOCKING and FUTU…
larry-safran Nov 14, 2022
995f940
regenerate service files with interface only for server
larry-safran Nov 15, 2022
c9ece18
update pom files to allow java 1.8
larry-safran Nov 15, 2022
ce4d6e3
Respond to reviewer comments:
larry-safran Nov 15, 2022
feb8f95
Fix generation of bind method
larry-safran Nov 15, 2022
440ab9b
more generated service files
larry-safran Nov 16, 2022
ef2e411
android interop testing generated files
larry-safran Nov 16, 2022
0f489a6
Update interface name from <service>Async to AsyncService
larry-safran Nov 18, 2022
f0c9bc1
Updated generated files to match change in interface name
larry-safran Nov 18, 2022
4b36098
Respond to code review
larry-safran Nov 18, 2022
41579cb
Fixed indenting, so regenerated all files
larry-safran Nov 18, 2022
a75862d
Fixed indenting, so regenerated all files
larry-safran Nov 19, 2022
2139419
Updated generated files to match change in interface name
larry-safran Nov 19, 2022
3703403
Add @Experimental flag and regenerate files
larry-safran Nov 21, 2022
0290880
Add a test case using a class that implements the interface directly …
larry-safran Nov 23, 2022
b921216
Respond to code review.
larry-safran Jan 4, 2023
07f8711
Fix syntax error
larry-safran Jan 7, 2023
d40354a
fix syntax errors
larry-safran Jan 7, 2023
2c1899a
regenerate android-interop-testing service files
larry-safran Jan 7, 2023
abcd5ec
Address code review comments
larry-safran Jan 7, 2023
a7ba9fd
Regenerated with period at end of method descriptions
larry-safran Jan 7, 2023
e0f1af4
Remove ExperimentalApi annotation from generated files
larry-safran Feb 14, 2023
1e4888a
Merge branch 'master' into service-interfaces
larry-safran Feb 14, 2023
e7d3084
squash! Remove ExperimentalApi annotation
larry-safran Feb 14, 2023
fc040d6
missed generated file
larry-safran Feb 14, 2023
27254ff
Move testing with interface to the main interop test class instead of…
larry-safran Feb 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public HandshakerServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.Call

/**
*/
public static abstract class HandshakerServiceImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
* <pre>
Expand All @@ -104,27 +104,28 @@ public static abstract class HandshakerServiceImplBase implements io.grpc.Bindab
* response before sending next request.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
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 io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getDoHandshakeMethod(),
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.alts.internal.HandshakerReq,
io.grpc.alts.internal.HandshakerResp>(
this, METHODID_DO_HANDSHAKE)))
.build();
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> {
public static final class HandshakerServiceStub
extends io.grpc.stub.AbstractAsyncStub<HandshakerServiceStub> {
private HandshakerServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -154,8 +155,10 @@ public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandsh
}

/**
* A stub to allow clients to do synchronous rpc calls to service HandshakerService.
*/
public static final class HandshakerServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingStub> {
public static final class HandshakerServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingStub> {
private HandshakerServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand All @@ -169,8 +172,10 @@ protected HandshakerServiceBlockingStub build(
}

/**
* 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> {
public static final class HandshakerServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<HandshakerServiceFutureStub> {
private HandshakerServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand All @@ -190,10 +195,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final HandshakerServiceImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(HandshakerServiceImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -221,6 +226,18 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

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() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void unaryRpc(SimpleRequest request, StreamObserver<SimpleResponse> so) {
so.onCompleted();
}
})
.build());
.build());
private Resource<Channel> resource;

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ public LoadBalancerStatsServiceFutureStub newStub(io.grpc.Channel channel, io.gr
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static abstract class LoadBalancerStatsServiceImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
* <pre>
* Gets the backend distribution for RPCs sent by a test client.
* </pre>
*/
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
default void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetClientStatsMethod(), responseObserver);
}
Expand All @@ -144,37 +144,34 @@ public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStat
* Gets the accumulated stats for RPCs sent by a test client.
* </pre>
*/
public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request,
default void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetClientAccumulatedStatsMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service LoadBalancerStatsService.
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static abstract class LoadBalancerStatsServiceImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetClientStatsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>(
this, METHODID_GET_CLIENT_STATS)))
.addMethod(
getGetClientAccumulatedStatsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse>(
this, METHODID_GET_CLIENT_ACCUMULATED_STATS)))
.build();
return LoadBalancerStatsServiceGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service LoadBalancerStatsService.
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceStub extends io.grpc.stub.AbstractAsyncStub<LoadBalancerStatsServiceStub> {
public static final class LoadBalancerStatsServiceStub
extends io.grpc.stub.AbstractAsyncStub<LoadBalancerStatsServiceStub> {
private LoadBalancerStatsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -210,11 +207,13 @@ public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadB
}

/**
* A stub to allow clients to do synchronous rpc calls to service LoadBalancerStatsService.
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
public static final class LoadBalancerStatsServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<LoadBalancerStatsServiceBlockingStub> {
private LoadBalancerStatsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -248,11 +247,13 @@ public io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service LoadBalancerStatsService.
* <pre>
* A service used to obtain stats for verifying LB behavior.
* </pre>
*/
public static final class LoadBalancerStatsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<LoadBalancerStatsServiceFutureStub> {
public static final class LoadBalancerStatsServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<LoadBalancerStatsServiceFutureStub> {
private LoadBalancerStatsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -295,10 +296,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LoadBalancerStatsServiceImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(LoadBalancerStatsServiceImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -331,6 +332,25 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetClientStatsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>(
service, METHODID_GET_CLIENT_STATS)))
.addMethod(
getGetClientAccumulatedStatsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest,
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse>(
service, METHODID_GET_CLIENT_ACCUMULATED_STATS)))
.build();
}

private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

public static io.grpc.ServiceDescriptor getServiceDescriptor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ public MetricsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOpt

/**
*/
public static abstract class MetricsServiceImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
default void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
}
Expand All @@ -139,34 +139,28 @@ public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage reques
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
default void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service MetricsService.
*/
public static abstract class MetricsServiceImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetAllGaugesMethod(),
io.grpc.stub.ServerCalls.asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_ALL_GAUGES)))
.addMethod(
getGetGaugeMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
this, METHODID_GET_GAUGE)))
.build();
return MetricsServiceGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service MetricsService.
*/
public static final class MetricsServiceStub extends io.grpc.stub.AbstractAsyncStub<MetricsServiceStub> {
public static final class MetricsServiceStub
extends io.grpc.stub.AbstractAsyncStub<MetricsServiceStub> {
private MetricsServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -203,8 +197,10 @@ public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
}

/**
* A stub to allow clients to do synchronous rpc calls to service MetricsService.
*/
public static final class MetricsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
public static final class MetricsServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<MetricsServiceBlockingStub> {
private MetricsServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -240,8 +236,10 @@ public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testin
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service MetricsService.
*/
public static final class MetricsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<MetricsServiceFutureStub> {
public static final class MetricsServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<MetricsServiceFutureStub> {
private MetricsServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -273,10 +271,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MetricsServiceImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -309,6 +307,25 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetAllGaugesMethod(),
io.grpc.stub.ServerCalls.asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
service, METHODID_GET_ALL_GAUGES)))
.addMethod(
getGetGaugeMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
service, METHODID_GET_GAUGE)))
.build();
}

private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

public static io.grpc.ServiceDescriptor getServiceDescriptor() {
Expand Down
Loading