io.etcd.jetcd.api.VertxWatchGrpc Maven / Gradle / Ivy
The newest version!
package io.etcd.jetcd.api;
import static io.etcd.jetcd.api.WatchGrpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
@javax.annotation.Generated(
value = "by VertxGrpc generator",
comments = "Source: rpc.proto")
public final class VertxWatchGrpc {
private VertxWatchGrpc() {}
public static WatchVertxStub newVertxStub(io.grpc.Channel channel) {
return new WatchVertxStub(channel);
}
public static final class WatchVertxStub extends io.grpc.stub.AbstractStub {
private final io.vertx.core.impl.ContextInternal ctx;
private WatchGrpc.WatchStub delegateStub;
private WatchVertxStub(io.grpc.Channel channel) {
super(channel);
delegateStub = WatchGrpc.newStub(channel);
this.ctx = (io.vertx.core.impl.ContextInternal) io.vertx.core.Vertx.currentContext();
}
private WatchVertxStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
delegateStub = WatchGrpc.newStub(channel).build(channel, callOptions);
this.ctx = (io.vertx.core.impl.ContextInternal) io.vertx.core.Vertx.currentContext();
}
@Override
protected WatchVertxStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new WatchVertxStub(channel, callOptions);
}
/**
*
* Range gets the keys in the range from the key-value store.
*
*/
public io.vertx.core.Future progress(io.etcd.jetcd.api.WatchProgressRequest request) {
return io.vertx.grpc.stub.ClientCalls.oneToOne(ctx, request, delegateStub::progress);
}
/**
*
* Put puts the given key into the key-value store.
* A put request increments the revision of the key-value store
* and generates one event in the event history.
*
*/
public io.vertx.core.streams.ReadStream watch(io.vertx.core.Handler> hdlr) {
return io.vertx.grpc.stub.ClientCalls.manyToMany(ctx, hdlr, delegateStub::watch);
}
public io.vertx.core.streams.ReadStream watchWithExceptionHandler(io.vertx.core.Handler> hdlr, io.vertx.core.Handler exceptionHandler) {
return io.vertx.grpc.stub.ClientCalls.manyToMany(ctx, hdlr, delegateStub::watch, exceptionHandler);
}
public io.vertx.core.streams.ReadStream watchWithHandler(io.vertx.core.Handler> hdlr, io.vertx.core.Handler handler, io.vertx.core.Handler endHandler, io.vertx.core.Handler exceptionHandler) {
return io.vertx.grpc.stub.ClientCalls.manyToMany(ctx, hdlr, delegateStub::watch, handler, endHandler, exceptionHandler);
}
}
public static abstract class WatchVertxImplBase implements io.grpc.BindableService {
private String compression;
/**
* Set whether the server will try to use a compressed response.
*
* @param compression the compression, e.g {@code gzip}
*/
public WatchVertxImplBase withCompression(String compression) {
this.compression = compression;
return this;
}
/**
*
* Range gets the keys in the range from the key-value store.
*
*/
public io.vertx.core.Future progress(io.etcd.jetcd.api.WatchProgressRequest request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
/**
*
* Put puts the given key into the key-value store.
* A put request increments the revision of the key-value store
* and generates one event in the event history.
*
*/
public void watch(io.vertx.core.streams.ReadStream request, io.vertx.core.streams.WriteStream response) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
io.etcd.jetcd.api.WatchGrpc.getProgressMethod(),
asyncUnaryCall(
new MethodHandlers<
io.etcd.jetcd.api.WatchProgressRequest,
io.etcd.jetcd.api.WatchResponse>(
this, METHODID_PROGRESS, compression)))
.addMethod(
io.etcd.jetcd.api.WatchGrpc.getWatchMethod(),
asyncBidiStreamingCall(
new MethodHandlers<
io.etcd.jetcd.api.WatchRequest,
io.etcd.jetcd.api.WatchResponse>(
this, METHODID_WATCH, compression)))
.build();
}
}
private static final int METHODID_PROGRESS = 0;
private static final int METHODID_WATCH = 1;
private static final class MethodHandlers implements
io.grpc.stub.ServerCalls.UnaryMethod,
io.grpc.stub.ServerCalls.ServerStreamingMethod,
io.grpc.stub.ServerCalls.ClientStreamingMethod,
io.grpc.stub.ServerCalls.BidiStreamingMethod {
private final WatchVertxImplBase serviceImpl;
private final int methodId;
private final String compression;
MethodHandlers(WatchVertxImplBase serviceImpl, int methodId, String compression) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
this.compression = compression;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_PROGRESS:
io.vertx.grpc.stub.ServerCalls.oneToOne(
(io.etcd.jetcd.api.WatchProgressRequest) request,
(io.grpc.stub.StreamObserver) responseObserver,
compression,
serviceImpl::progress);
break;
default:
throw new java.lang.AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_WATCH:
return (io.grpc.stub.StreamObserver) io.vertx.grpc.stub.ServerCalls.manyToMany(
(io.grpc.stub.StreamObserver) responseObserver,
compression,
serviceImpl::watch);
default:
throw new java.lang.AssertionError();
}
}
}
}