From a70c90776892d9063a595e4cdacb64e4c66098d7 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 15 Nov 2023 17:48:09 -0800 Subject: [PATCH] Client clean up. Signed-off-by: Yury-Fridlyand --- java/benchmarks/build.gradle | 12 +- .../benchmarks/BenchmarkingApp.java | 22 +- .../benchmarks/clients/AsyncClient.java | 3 +- .../clients/babushka/ChannelHandler.java | 18 - .../clients/babushka/JniNettyClient.java | 475 +- .../clients/babushka/JniSyncClient.java | 316 - .../clients/jedis/JedisPseudoAsyncClient.java | 1 - .../clients/lettuce/LettuceAsyncClient.java | 20 +- .../benchmarks/utils/Benchmarking.java | 5 +- .../client/ConnectionRequestOuterClass.java | 4289 ---------- .../java/javababushka/client/RedisClient.java | 29 - .../client/RedisRequestOuterClass.java | 6972 ----------------- .../client/ResponseOuterClass.java | 2283 ------ .../benchmarks/JniNettyTests.java | 180 - java/client/build.gradle | 18 +- .../src/main/java/javababushka/Client.java | 388 + .../main/java/javababushka/RustWrapper.java | 11 + java/javababushka_client_RedisClient.h | 37 - java/src/lib.rs | 34 +- 19 files changed, 464 insertions(+), 14649 deletions(-) delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java delete mode 100644 java/benchmarks/src/main/java/javababushka/client/RedisClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java delete mode 100644 java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java delete mode 100644 java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java create mode 100644 java/client/src/main/java/javababushka/Client.java create mode 100644 java/client/src/main/java/javababushka/RustWrapper.java delete mode 100644 java/javababushka_client_RedisClient.h diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index 90c633d9f1..3f1f0f0608 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -10,6 +10,8 @@ repositories { } dependencies { + implementation project(':client') + // Use JUnit test framework. testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' @@ -24,13 +26,6 @@ dependencies { implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.24.3' implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' - implementation group: 'io.netty', name: 'netty-handler', version: '4.1.100.Final' - // https://github.com/netty/netty/wiki/Native-transports - // Windows is not supported, because babushka does not support windows, because tokio does not support windows, because ... 42 - implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.100.Final', classifier: 'linux-x86_64' - implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-x86_64' - implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-aarch_64' - //testImplementation group: 'org.slf4j', name: 'slf4j-reload4j', version: '2.0.9' //testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.9' @@ -50,8 +45,7 @@ java { application { // Define the main class for the application. mainClass = 'javababushka.benchmarks.BenchmarkingApp' - mainClass = 'javababushka.benchmarks.clients.babushka.JniNettyClient' - applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/debug" + applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/release" } tasks.withType(Test) { diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index b3d269cf35..14242b472a 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -5,9 +5,7 @@ import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; - import javababushka.benchmarks.clients.babushka.JniNettyClient; -import javababushka.benchmarks.clients.babushka.JniSyncClient; import javababushka.benchmarks.clients.jedis.JedisClient; import javababushka.benchmarks.clients.jedis.JedisPseudoAsyncClient; import javababushka.benchmarks.clients.lettuce.LettuceAsyncClient; @@ -63,15 +61,11 @@ public static void main(String[] args) { case LETTUCE_ASYNC: testClientSetGet(LettuceAsyncClient::new, runConfiguration, true); break; - case BABUSHKA_JNI: - testClientSetGet(JniSyncClient::new, runConfiguration, false); - break; - case JNI_NETTY: + case BABUSHKA: testClientSetGet(() -> new JniNettyClient(false), runConfiguration, false); - testClientSetGet(() -> new JniNettyClient(true), runConfiguration, true); break; case BABUSHKA_ASYNC: - System.out.println("Babushka async not yet configured"); + testClientSetGet(() -> new JniNettyClient(true), runConfiguration, true); break; } } @@ -147,7 +141,6 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce ClientName.JEDIS_ASYNC, // ClientName.BABUSHKA_ASYNC, ClientName.BABUSHKA, - ClientName.BABUSHKA_JNI, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC); case ALL_ASYNC: @@ -159,7 +152,6 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce return Stream.of( ClientName.JEDIS, // ClientName.BABUSHKA, - ClientName.BABUSHKA_JNI, ClientName.LETTUCE); default: return Stream.of(e); @@ -201,12 +193,10 @@ private static int[] parseIntListOption(String line) throws ParseException { } public enum ClientName { - JNI_NETTY("JNI netty"), JEDIS("Jedis"), JEDIS_ASYNC("Jedis async"), LETTUCE("Lettuce"), LETTUCE_ASYNC("Lettuce async"), - BABUSHKA_JNI("JNI sync"), BABUSHKA_ASYNC("Babushka async"), BABUSHKA("Babushka"), ALL("All"), @@ -243,14 +233,16 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; - resultsFile = Optional.of("res_java.json");//Optional.empty(); + resultsFile = Optional.of("res_java.json"); // Optional.empty(); dataSize = new int[] {100}; concurrentTasks = new int[] {100}; clients = new ClientName[] { // ClientName.BABUSHKA_ASYNC, - //ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC - ClientName.JNI_NETTY//, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + // ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, + // ClientName.LETTUCE_ASYNC + ClientName.BABUSHKA_ASYNC, + ClientName.BABUSHKA // , ClientName.LETTUCE, ClientName.LETTUCE_ASYNC }; host = "localhost"; port = 6379; diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java index 0181cc052e..5255f63287 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java @@ -1,9 +1,8 @@ package javababushka.benchmarks.clients; -import javababushka.benchmarks.utils.ConnectionSettings; - import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import javababushka.benchmarks.utils.ConnectionSettings; /** A Redis client with async capabilities */ public interface AsyncClient extends Client { diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java deleted file mode 100644 index a49229db89..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package javababushka.benchmarks.clients.babushka; - -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.ChannelPromise; -import io.netty.channel.CombinedChannelDuplexHandler; - -public class ChannelHandler extends CombinedChannelDuplexHandler { - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - super.channelRead(ctx, msg); - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - super.write(ctx, msg, promise); - } -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java index eef968e343..0a98478fef 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -1,495 +1,66 @@ package javababushka.benchmarks.clients.babushka; -import static connection_request.ConnectionRequestOuterClass.ConnectionRequest; -import static connection_request.ConnectionRequestOuterClass.AddressInfo; -import static connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy; -import static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy; -import static connection_request.ConnectionRequestOuterClass.AuthenticationInfo; -import static connection_request.ConnectionRequestOuterClass.TlsMode; import static response.ResponseOuterClass.Response; -import static redis_request.RedisRequestOuterClass.Command.ArgsArray; -import static redis_request.RedisRequestOuterClass.Command; -import static redis_request.RedisRequestOuterClass.RequestType; -import static redis_request.RedisRequestOuterClass.RedisRequest; -import static redis_request.RedisRequestOuterClass.SimpleRoutes; -import static redis_request.RedisRequestOuterClass.Routes; -import com.google.common.annotations.VisibleForTesting; -import io.netty.bootstrap.Bootstrap; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelOption; -import io.netty.channel.ChannelOutboundHandlerAdapter; -import io.netty.channel.ChannelPromise; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.WriteBufferWaterMark; -import io.netty.channel.epoll.EpollDomainSocketChannel; -import io.netty.channel.epoll.EpollEventLoopGroup; -import io.netty.channel.kqueue.KQueue; -import io.netty.channel.kqueue.KQueueDomainSocketChannel; -import io.netty.channel.kqueue.KQueueEventLoopGroup; -import io.netty.channel.unix.UnixChannel; -import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; -import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; -import io.netty.util.internal.logging.InternalLoggerFactory; -import io.netty.util.internal.logging.Slf4JLoggerFactory; +import java.util.concurrent.Future; +import javababushka.Client; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.SyncClient; import javababushka.benchmarks.utils.ConnectionSettings; -import io.netty.channel.unix.DomainSocketAddress; -import javababushka.client.RedisClient; - -import java.net.SocketAddress; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicInteger; - -@VisibleForTesting -public class JniNettyClient implements SyncClient, AsyncClient, AutoCloseable { - - public static boolean ALWAYS_FLUSH_ON_WRITE = false; - - // https://netty.io/3.6/api/org/jboss/netty/handler/queue/BufferedWriteHandler.html - // Flush every N bytes if !ALWAYS_FLUSH_ON_WRITE - public static int AUTO_FLUSH_THRESHOLD_BYTES = 512;//1024; - private final AtomicInteger nonFlushedBytesCounter = new AtomicInteger(0); - - // Flush every N writes if !ALWAYS_FLUSH_ON_WRITE - public static int AUTO_FLUSH_THRESHOLD_WRITES = 10; - private final AtomicInteger nonFlushedWritesCounter = new AtomicInteger(0); - - // If !ALWAYS_FLUSH_ON_WRITE and a command has no response in N millis, flush (probably it wasn't send) - public static int AUTO_FLUSH_RESPONSE_TIMEOUT_MILLIS = 100; - // If !ALWAYS_FLUSH_ON_WRITE flush on timer (like a cron) - public static int AUTO_FLUSH_TIMER_MILLIS = 200; - - public static int PENDING_RESPONSES_ON_CLOSE_TIMEOUT_MILLIS = 1000; - - // Futures to handle responses. Index is callback id, starting from 1 (0 index is for connection request always). - // TODO clean up completed futures - private final List> responses = Collections.synchronizedList(new ArrayList<>()); - private final String unixSocket = getSocket(); +public class JniNettyClient implements SyncClient, AsyncClient { - // TODO static or move to constructor? - private static String getSocket() { - try { - return RedisClient.startSocketListenerExternal(); - } catch (Exception | UnsatisfiedLinkError e) { - System.err.printf("Failed to get UDS from babushka and dedushka: %s%n%n", e); - throw new RuntimeException(e); - } - } - - private Channel channel = null; - private EventLoopGroup group = null; - - // We support MacOS and Linux only, because Babushka does not support Windows, because tokio does not support it. - // Probably we should use NIO (NioEventLoopGroup) for Windows. - private final static boolean isMacOs = isMacOs(); - private static boolean isMacOs() { - try { - Class.forName("io.netty.channel.kqueue.KQueue"); - return KQueue.isAvailable(); - } catch (ClassNotFoundException e) { - return false; - } - } - - static { - // TODO fix: netty still doesn't use slf4j nor log4j - InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); - } + private final Client testClient; + private String name = "JNI Netty"; public JniNettyClient(boolean async) { name += async ? " async" : " sync"; + testClient = new Client(); } - public JniNettyClient() {} - - private String name = "JNI Netty"; - @Override public String getName() { return name; } - @Override - public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); - } - - @Override - public void connectToRedis(ConnectionSettings connectionSettings) { - - Response connected = null; - try { - connected = waitForResult(asyncConnectToRedis(connectionSettings)); - //System.out.printf("Connection %s%n", connected != null ? connected.getConstantResponse() : null); - } catch (Exception e) { - System.err.println("Connection time out"); - } - - int a = 5; - } - - private void createChannel() { - // TODO maybe move to constructor or to static? - // ====== - try { - channel = new Bootstrap() - .option(ChannelOption.WRITE_BUFFER_WATER_MARK, - new WriteBufferWaterMark(1024, 4096)) - .option(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT) - .group(group = isMacOs ? new KQueueEventLoopGroup() : new EpollEventLoopGroup()) - .channel(isMacOs ? KQueueDomainSocketChannel.class : EpollDomainSocketChannel.class) - .handler(new ChannelInitializer() { - @Override - public void initChannel(UnixChannel ch) throws Exception { - ch - .pipeline() - .addLast("logger", new LoggingHandler(LogLevel.DEBUG)) - //https://netty.io/4.1/api/io/netty/handler/codec/protobuf/ProtobufEncoder.html - .addLast("protobufDecoder", new ProtobufVarint32FrameDecoder()) - .addLast("protobufEncoder", new ProtobufVarint32LengthFieldPrepender()) - - .addLast(new ChannelInboundHandlerAdapter() { - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - //System.out.printf("=== channelRead %s %s %n", ctx, msg); - var buf = (ByteBuf) msg; - var bytes = new byte[buf.readableBytes()]; - buf.readBytes(bytes); - // TODO surround parsing with try-catch - var response = Response.parseFrom(bytes); - //System.out.printf("== Received response with callback %d%n", response.getCallbackIdx()); - responses.get(response.getCallbackIdx()).complete(response); - super.channelRead(ctx, bytes); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - System.out.printf("=== exceptionCaught %s %s %n", ctx, cause); - cause.printStackTrace(); - super.exceptionCaught(ctx, cause); - } - }) - .addLast(new ChannelOutboundHandlerAdapter() { - @Override - public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception { - //System.out.printf("=== bind %s %s %s %n", ctx, localAddress, promise); - super.bind(ctx, localAddress, promise); - } - - @Override - public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception { - //System.out.printf("=== connect %s %s %s %s %n", ctx, remoteAddress, localAddress, promise); - super.connect(ctx, remoteAddress, localAddress, promise); - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - //System.out.printf("=== write %s %s %s %n", ctx, msg, promise); - var bytes = (byte[])msg; - - boolean needFlush = false; - if (!ALWAYS_FLUSH_ON_WRITE) { - synchronized (nonFlushedBytesCounter) { - if (nonFlushedBytesCounter.addAndGet(bytes.length) >= AUTO_FLUSH_THRESHOLD_BYTES - || nonFlushedWritesCounter.incrementAndGet() >= AUTO_FLUSH_THRESHOLD_WRITES) { - nonFlushedBytesCounter.set(0); - nonFlushedWritesCounter.set(0); - needFlush = true; - } - } - } - super.write(ctx, Unpooled.copiedBuffer(bytes), promise); - if (needFlush) { - // flush outside the sync block - flush(ctx); - //System.out.println("-- auto flush - buffer"); - } - } - - @Override - public void flush(ChannelHandlerContext ctx) throws Exception { - //System.out.printf("=== flush %s %n", ctx); - super.flush(ctx); - } - }); - /* - .addLast(new SimpleUserEventChannelHandler() { - @Override - protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Exception { - - } - }); - */ - //.addLast(new CombinedChannelDuplexHandler(new ChannelInboundHandler(), new ChannelOutboundHandler())); - } - }) - .connect(new DomainSocketAddress(unixSocket)).sync().channel(); - - } - catch (Exception e) { - System.err.printf("Failed to create a channel %s: %s%n", e.getClass().getSimpleName(), e.getMessage()); - e.printStackTrace(System.err); - } - - if (!ALWAYS_FLUSH_ON_WRITE) { - new Timer(true).scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - channel.flush(); - nonFlushedBytesCounter.set(0); - nonFlushedWritesCounter.set(0); - } - }, 0, AUTO_FLUSH_TIMER_MILLIS); - } - } - @Override public void closeConnection() { - try { - channel.flush(); - - long waitStarted = System.nanoTime(); - long waitUntil = waitStarted + PENDING_RESPONSES_ON_CLOSE_TIMEOUT_MILLIS * 100_000; // in nanos - for (var future : responses) { - if (future.isDone()) { - continue; - } - try { - future.get(waitUntil - System.nanoTime(), TimeUnit.NANOSECONDS); - } catch (InterruptedException | ExecutionException ignored) { - } catch (TimeoutException e) { - future.cancel(true); - // TODO cancel the rest - break; - } - } - -// channel.closeFuture().sync(); -// } catch (InterruptedException ignored) { - } finally { - group.shutdownGracefully(); - } + testClient.closeConnection(); } @Override - public void set(String key, String value) { - waitForResult(asyncSet(key, value)); - // TODO parse response and rethrow an exception if there is an error - } - - @Override - public String get(String key) { - return waitForResult(asyncGet(key)); - /* - try { - var response = responses.get(callbackId).get(DEFAULT_FUTURE_TIMEOUT_SEC, TimeUnit.SECONDS); - return response.hasRespPointer() - ? RedisClient.valueFromPointer(response.getRespPointer()).toString() - : null; - } catch (Exception e) { - System.err.printf("Failed to process `get` response, callback = %d: %s %s%n", - callbackId, e.getClass().getSimpleName(), e.getMessage()); - e.printStackTrace(System.err); - return null; - } - */ - } - - // TODO use reentrant lock - // https://www.geeksforgeeks.org/reentrant-lock-java/ - private synchronized int getNextCallbackId() { - responses.add(new CompletableFuture<>()); - return responses.size() - 1; - } - - public static void main(String[] args) { - var client = new JniNettyClient(); - client.connectToRedis(); - - var get_ne = client.get("sdf"); - var key = String.valueOf(ProcessHandle.current().pid()); - client.set(key, "asfsdf"); - var get_e = client.get(key); - - var get_nea = client.asyncGet("sdf"); - var set_a = client.asyncSet(key, "asfsdf"); - var get_ea = client.asyncGet(key); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - } - var res1 = client.waitForResult(get_nea); - var res2 = client.waitForResult(set_a); - var res3 = client.waitForResult(get_ea); - - long beforeSet = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.set("name", "value"); - } - long afterSet = System.nanoTime(); - System.out.printf("++++ set: %d%n", afterSet - beforeSet); - - long beforeGetNE = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.get("namevalue"); - } - long afterGetNE = System.nanoTime(); - System.out.printf("++++ get NE: %d%n", afterGetNE - beforeGetNE); - - long beforeGetE = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.get(key); - } - long afterGetE = System.nanoTime(); - System.out.printf("++++ get E: %d%n", afterGetE - beforeGetE); - - /////// - - long beforeSetA = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.asyncSet("name", "value"); - } - long afterSetA = System.nanoTime(); - System.out.printf("++++ set: %d%n", afterSetA - beforeSetA); - - long beforeGetNEA = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.asyncGet("namevalue"); - } - long afterGetNEA = System.nanoTime(); - System.out.printf("++++ get NE: %d%n", afterGetNEA - beforeGetNEA); - - long beforeGetEA = System.nanoTime(); - for (int i = 0; i < 1000; i++) { - client.asyncGet(key); - } - long afterGetEA = System.nanoTime(); - System.out.printf("++++ get E: %d%n", afterGetEA - beforeGetEA); - - client.closeConnection(); + public void connectToRedis() { + connectToRedis(new ConnectionSettings("localhost", 6379, false)); } @Override - public void close() throws Exception { - closeConnection(); + public void connectToRedis(ConnectionSettings connectionSettings) { +waitForResult(asyncConnectToRedis(connectionSettings)); } @Override public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { - createChannel(); - - var request = ConnectionRequest.newBuilder() - .addAddresses( - AddressInfo.newBuilder() - .setHost(connectionSettings.host) - .setPort(connectionSettings.port) - .build()) - .setTlsMode(connectionSettings.useSsl // TODO: secure or insecure TLS? - ? TlsMode.SecureTls - : TlsMode.NoTls) - .setClusterModeEnabled(false) - // In millis - .setResponseTimeout(250) - // In millis - .setClientCreationTimeout(2500) - .setReadFromReplicaStrategy(ReadFromReplicaStrategy.AlwaysFromPrimary) - .setConnectionRetryStrategy( - ConnectionRetryStrategy.newBuilder() - .setNumberOfRetries(1) - .setFactor(1) - .setExponentBase(1) - .build()) - .setAuthenticationInfo( - AuthenticationInfo.newBuilder() - .setPassword("") - .setUsername("default") - .build()) - .setDatabaseId(0) - .build(); - - var future = new CompletableFuture(); - responses.add(future); - channel.writeAndFlush(request.toByteArray()); - return future; + return testClient.asyncConnectToRedis( + connectionSettings.host, connectionSettings.port, connectionSettings.useSsl, false); } - private CompletableFuture submitNewCommand(RequestType command, List args) { - int callbackId = getNextCallbackId(); - //System.out.printf("== %s(%s), callback %d%n", command, String.join(", ", args), callbackId); - RedisRequest request = - RedisRequest.newBuilder() - .setCallbackIdx(callbackId) - .setSingleCommand( - Command.newBuilder() - .setRequestType(command) - .setArgsArray(ArgsArray.newBuilder().addAllArgs(args).build()) - .build()) - .setRoute( - Routes.newBuilder() - .setSimpleRoutes(SimpleRoutes.AllNodes) - .build()) - .build(); - if (ALWAYS_FLUSH_ON_WRITE) { - channel.writeAndFlush(request.toByteArray()); - return responses.get(callbackId); - } - channel.write(request.toByteArray()); - return autoFlushFutureWrapper(responses.get(callbackId)); + @Override + public Future asyncSet(String key, String value) { + return testClient.asyncSet(key, value); } - private CompletableFuture autoFlushFutureWrapper(Future future) { - return CompletableFuture.supplyAsync(() -> { - try { - return future.get(AUTO_FLUSH_RESPONSE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } catch (TimeoutException e) { - //System.out.println("-- auto flush - timeout"); - channel.flush(); - nonFlushedBytesCounter.set(0); - nonFlushedWritesCounter.set(0); - } - try { - return future.get(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - }); + @Override + public Future asyncGet(String key) { + return testClient.asyncGet(key); } @Override - public Future asyncSet(String key, String value) { - //System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); - return submitNewCommand(RequestType.SetString, List.of(key, value)); + public void set(String key, String value) { + testClient.set(key, value); } @Override - public Future asyncGet(String key) { - //System.out.printf("== get(%s), callback %d%n", key, callbackId); - return submitNewCommand(RequestType.GetString, List.of(key)) - .thenApply(response -> response.hasRespPointer() - ? RedisClient.valueFromPointer(response.getRespPointer()).toString() - : null); + public String get(String key) { + return testClient.get(key); } } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java deleted file mode 100644 index bf9b94b352..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java +++ /dev/null @@ -1,316 +0,0 @@ -package javababushka.benchmarks.clients.babushka; - -import java.io.IOException; -import java.net.StandardProtocolFamily; -import java.net.UnixDomainSocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.SocketChannel; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javababushka.benchmarks.clients.SyncClient; -import javababushka.benchmarks.utils.ConnectionSettings; -import javababushka.client.RedisClient; -import org.apache.commons.lang3.tuple.MutablePair; -import org.apache.commons.lang3.tuple.Pair; -import redis_request.RedisRequestOuterClass; -import response.ResponseOuterClass; - -/** A JNI-built client using Unix Domain Sockets with async capabilities */ -public class JniSyncClient implements SyncClient { - - private static int MAX_TIMEOUT = 1000; - private static int TIMEOUT_INTERVAL = 100; - - private RedisClient client; - - private SocketChannel channel; - - @Override - public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); - } - - @Override - public void connectToRedis(ConnectionSettings connectionSettings) { - - // Create redis client - client = new RedisClient(); - - // Get socket listener address/path - RedisClient.startSocketListenerExternal(client); - - int timeout = 0; - int maxTimeout = MAX_TIMEOUT; - while (client.socketPath == null && timeout < maxTimeout) { - timeout += TIMEOUT_INTERVAL; - try { - Thread.sleep(TIMEOUT_INTERVAL); - } catch (InterruptedException exception) { - // ignored - } - } - - System.out.println("Socket Path: " + client.socketPath); - UnixDomainSocketAddress socketAddress = UnixDomainSocketAddress.of(client.socketPath); - - // Start the socket listener - try { - channel = SocketChannel.open(StandardProtocolFamily.UNIX); - channel.connect(socketAddress); - } catch (IOException ioException) { - ioException.printStackTrace(); - return; - } - - String host = connectionSettings.host; - int port = connectionSettings.port; - connection_request.ConnectionRequestOuterClass.TlsMode tls = - connectionSettings.useSsl - ? - // TODO: secure or insecure TLS? - connection_request.ConnectionRequestOuterClass.TlsMode.SecureTls - : connection_request.ConnectionRequestOuterClass.TlsMode.NoTls; - - connection_request.ConnectionRequestOuterClass.ConnectionRequest request = - connection_request.ConnectionRequestOuterClass.ConnectionRequest.newBuilder() - .addAddresses( - connection_request.ConnectionRequestOuterClass.AddressInfo.newBuilder() - .setHost(host) - .setPort(port)) - .setTlsMode(tls) - .setClusterModeEnabled(false) - // In millis - .setResponseTimeout(250) - // In millis - .setClientCreationTimeout(2500) - .setReadFromReplicaStrategy( - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - .AlwaysFromPrimary) - .setConnectionRetryStrategy( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.newBuilder() - .setNumberOfRetries(1) - .setFactor(1) - .setExponentBase(1)) - .setAuthenticationInfo( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.newBuilder() - .setPassword("") - .setUsername("default")) - .setDatabaseId(0) - .build(); - - makeRedisRequest(request.toByteArray()); - receiveRedisResponse(); - } - - @Override - public void set(String key, String value) { - - int futureIdx = 1; - RedisRequestOuterClass.Command.ArgsArray args = - RedisRequestOuterClass.Command.ArgsArray.newBuilder().addArgs(key).addArgs(value).build(); - RedisRequestOuterClass.RedisRequest request = - RedisRequestOuterClass.RedisRequest.newBuilder() - .setCallbackIdx(futureIdx) - .setSingleCommand( - RedisRequestOuterClass.Command.newBuilder() - .setRequestType(RedisRequestOuterClass.RequestType.SetString) - .setArgsArray(args)) - .setRoute( - RedisRequestOuterClass.Routes.newBuilder() - .setSimpleRoutes(RedisRequestOuterClass.SimpleRoutes.AllNodes)) - .build(); - - makeRedisRequest(request.toByteArray()); - receiveRedisResponse(); - } - - @Override - public String get(String key) { - int futureIdx = 1; - RedisRequestOuterClass.RedisRequest getStringRequest = - RedisRequestOuterClass.RedisRequest.newBuilder() - .setCallbackIdx(futureIdx) - .setSingleCommand( - RedisRequestOuterClass.Command.newBuilder() - .setRequestType(RedisRequestOuterClass.RequestType.GetString) - .setArgsArray( - RedisRequestOuterClass.Command.ArgsArray.newBuilder().addArgs(key))) - .setRoute( - RedisRequestOuterClass.Routes.newBuilder() - .setSimpleRoutes(RedisRequestOuterClass.SimpleRoutes.AllNodes)) - .build(); - - makeRedisRequest(getStringRequest.toByteArray()); - ResponseOuterClass.Response response = receiveRedisResponse(); - return response == null ? null : response.toString(); - } - - @Override - public void closeConnection() {} - - @Override - public String getName() { - return "JNI (with UDS) Sync"; - } - - // Left is length of message, right is position - private static Pair decodeVarint(byte[] buffer, int pos) throws Exception { - long mask = ((long) 1 << 32) - 1; - int shift = 0; - long result = 0; - while (true) { - byte b = buffer[pos]; - result |= (long) (b & 0x7F) << shift; - pos += 1; - if ((b & 0x80) == 0) { - result &= mask; - // result = (int) result; - return new MutablePair<>(result, pos); - } - shift += 7; - if (shift >= 64) { - throw new Exception("Too many bytes when decoding varint."); - } - } - } - - private static ResponseOuterClass.Response decodeMessage(byte[] buffer) throws Exception { - Pair pair = decodeVarint(buffer, 0); - int startIdx = pair.getRight(); - byte[] responseBytes = - Arrays.copyOfRange(buffer, startIdx, startIdx + (int) (long) pair.getLeft()); - return ResponseOuterClass.Response.parseFrom(responseBytes); - } - - private static Byte[] varintBytes(int value) { - List output = new ArrayList<>(); - int bits = value & 0x7F; - value >>= 7; - while (value > 0) { - output.add((byte) (0x80 | bits)); - bits = value & 0x7F; - value >>= 7; - } - output.add((byte) bits); - Byte[] arr = new Byte[] {}; - return output.toArray(arr); - } - - private void makeRedisRequest(byte[] request) { - Byte[] varint = varintBytes(request.length); - - // System.out.println("Request: \n" + request.toString()); - // javadocs: https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#putInt%28int%29 - // BufferOverflowException - If there are fewer than four bytes remaining in this buffer - ByteBuffer buffer = ByteBuffer.allocate(request.length + 4); - buffer.clear(); - for (Byte b : varint) { - buffer.put(b); - } - buffer.put(request); - buffer.flip(); - try { - // TODO: check that this is the most performant mutex solution - synchronized (channel) { - while (buffer.hasRemaining()) { - channel.write(buffer); - } - } - } catch (IOException ioException) { - // ignore... - } - } - - private ResponseOuterClass.Response receiveRedisResponse() { - // TODO what if buffer is too small? re-allocate? - ByteBuffer readBuffer = ByteBuffer.allocate(1024); - - int timeout = 0; - int bytesRead = 0; - try { - synchronized (channel) { - bytesRead = channel.read(readBuffer); - while (bytesRead <= 0) { - timeout += TIMEOUT_INTERVAL; - if (timeout > MAX_TIMEOUT) { - throw new RuntimeException("Max timeout reached"); - } - - bytesRead += channel.read(readBuffer); - Thread.sleep(TIMEOUT_INTERVAL); - } - } - } catch (IOException | InterruptedException exception) { - // ignore... - } - byte[] bytes = new byte[bytesRead]; - readBuffer.flip(); - readBuffer.get(bytes); - ResponseOuterClass.Response response = null; - try { - response = decodeMessage(bytes); - } catch (Exception e) { - // e.printStackTrace(); - } - return response; - } - - private static byte[] readSocketMessage(SocketChannel channel) throws IOException { - ByteBuffer buffer = ByteBuffer.allocate(1024); - int bytesRead = channel.read(buffer); - if (bytesRead <= 0) { - return null; - } - - byte[] bytes = new byte[bytesRead]; - buffer.flip(); - buffer.get(bytes); - return bytes; - } - - private ResponseOuterClass.Response makeRedisRequest( - RedisRequestOuterClass.RedisRequest request) { - Byte[] varint = varintBytes(request.toByteArray().length); - - // System.out.println("Request: \n" + request.toString()); - ByteBuffer buffer = ByteBuffer.allocate(1024); - buffer.clear(); - for (Byte b : varint) { - buffer.put(b); - } - buffer.put(request.toByteArray()); - buffer.flip(); - try { - // TODO: check that this is the most performant mutex solution - synchronized (buffer) { - while (buffer.hasRemaining()) { - channel.write(buffer); - } - } - } catch (IOException ioException) { - // ignore... - } - - int timeout = 0; - byte[] responseBuffer = null; - while (responseBuffer == null && timeout < MAX_TIMEOUT) { - timeout++; - try { - responseBuffer = readSocketMessage(channel); - Thread.sleep(250); - } catch (IOException | InterruptedException exception) { - // ignore... - } - } - - // nothing to do with the responseBuffer message - ResponseOuterClass.Response response = null; - try { - response = decodeMessage(responseBuffer); - } catch (Exception e) { - // e.printStackTrace(); - } - return response; - } -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java index d3776663e1..dbd8c8bbd2 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java @@ -2,7 +2,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.utils.ConnectionSettings; diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java index bf5bc08117..4722c40129 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java @@ -5,10 +5,8 @@ import io.lettuce.core.RedisURI; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.async.RedisAsyncCommands; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - import io.lettuce.core.codec.StringCodec; +import java.util.concurrent.Future; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.utils.ConnectionSettings; @@ -40,13 +38,15 @@ public void connectToRedis(ConnectionSettings connectionSettings) { @Override public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { client = RedisClient.create(); - var asyncConnection = client.connectAsync( - new StringCodec(), - RedisURI.create(String.format( - "%s://%s:%d", - connectionSettings.useSsl ? "rediss" : "redis", - connectionSettings.host, - connectionSettings.port))); + var asyncConnection = + client.connectAsync( + new StringCodec(), + RedisURI.create( + String.format( + "%s://%s:%d", + connectionSettings.useSsl ? "rediss" : "redis", + connectionSettings.host, + connectionSettings.port))); asyncConnection.whenComplete((connection, exception) -> asyncCommands = connection.async()); return asyncConnection.thenApply((connection) -> "OK"); } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java index 95d3a8ffac..b94b9544fa 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -149,7 +149,7 @@ public static void testClientSetGet( Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { int iterations = 100000; - Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); + Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { System.out.printf( @@ -265,7 +265,8 @@ public static void testClientSetGet( printResults(calculatedResults, (after - before) / TPS_NORMALIZATION, iterations); try { Thread.sleep(2000); - } catch (InterruptedException ignored) {} + } catch (InterruptedException ignored) { + } } } } diff --git a/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java b/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java deleted file mode 100644 index 3a9d695168..0000000000 --- a/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java +++ /dev/null @@ -1,4289 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: connection_request.proto - -package connection_request; - -public final class ConnectionRequestOuterClass { - private ConnectionRequestOuterClass() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - - /** Protobuf enum {@code connection_request.ReadFromReplicaStrategy} */ - public enum ReadFromReplicaStrategy implements com.google.protobuf.ProtocolMessageEnum { - /** AlwaysFromPrimary = 0; */ - AlwaysFromPrimary(0), - /** RoundRobin = 1; */ - RoundRobin(1), - /** LowestLatency = 2; */ - LowestLatency(2), - /** AZAffinity = 3; */ - AZAffinity(3), - UNRECOGNIZED(-1), - ; - - /** AlwaysFromPrimary = 0; */ - public static final int AlwaysFromPrimary_VALUE = 0; - - /** RoundRobin = 1; */ - public static final int RoundRobin_VALUE = 1; - - /** LowestLatency = 2; */ - public static final int LowestLatency_VALUE = 2; - - /** AZAffinity = 3; */ - public static final int AZAffinity_VALUE = 3; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ReadFromReplicaStrategy valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static ReadFromReplicaStrategy forNumber(int value) { - switch (value) { - case 0: - return AlwaysFromPrimary; - case 1: - return RoundRobin; - case 2: - return LowestLatency; - case 3: - return AZAffinity; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ReadFromReplicaStrategy findValueByNumber(int number) { - return ReadFromReplicaStrategy.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } - - private static final ReadFromReplicaStrategy[] VALUES = values(); - - public static ReadFromReplicaStrategy valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private ReadFromReplicaStrategy(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:connection_request.ReadFromReplicaStrategy) - } - - /** Protobuf enum {@code connection_request.TlsMode} */ - public enum TlsMode implements com.google.protobuf.ProtocolMessageEnum { - /** NoTls = 0; */ - NoTls(0), - /** SecureTls = 1; */ - SecureTls(1), - /** InsecureTls = 2; */ - InsecureTls(2), - UNRECOGNIZED(-1), - ; - - /** NoTls = 0; */ - public static final int NoTls_VALUE = 0; - - /** SecureTls = 1; */ - public static final int SecureTls_VALUE = 1; - - /** InsecureTls = 2; */ - public static final int InsecureTls_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static TlsMode valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static TlsMode forNumber(int value) { - switch (value) { - case 0: - return NoTls; - case 1: - return SecureTls; - case 2: - return InsecureTls; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public TlsMode findValueByNumber(int number) { - return TlsMode.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass.getDescriptor().getEnumTypes().get(1); - } - - private static final TlsMode[] VALUES = values(); - - public static TlsMode valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private TlsMode(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:connection_request.TlsMode) - } - - public interface AddressInfoOrBuilder - extends - // @@protoc_insertion_point(interface_extends:connection_request.AddressInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * string host = 1; - * - * @return The host. - */ - java.lang.String getHost(); - - /** - * string host = 1; - * - * @return The bytes for host. - */ - com.google.protobuf.ByteString getHostBytes(); - - /** - * uint32 port = 2; - * - * @return The port. - */ - int getPort(); - } - - /** Protobuf type {@code connection_request.AddressInfo} */ - public static final class AddressInfo extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:connection_request.AddressInfo) - AddressInfoOrBuilder { - private static final long serialVersionUID = 0L; - - // Use AddressInfo.newBuilder() to construct. - private AddressInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AddressInfo() { - host_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AddressInfo(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AddressInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AddressInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.AddressInfo.class, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder.class); - } - - public static final int HOST_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private volatile java.lang.Object host_ = ""; - - /** - * string host = 1; - * - * @return The host. - */ - @java.lang.Override - public java.lang.String getHost() { - java.lang.Object ref = host_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - host_ = s; - return s; - } - } - - /** - * string host = 1; - * - * @return The bytes for host. - */ - @java.lang.Override - public com.google.protobuf.ByteString getHostBytes() { - java.lang.Object ref = host_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - host_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PORT_FIELD_NUMBER = 2; - private int port_ = 0; - - /** - * uint32 port = 2; - * - * @return The port. - */ - @java.lang.Override - public int getPort() { - return port_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(host_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, host_); - } - if (port_ != 0) { - output.writeUInt32(2, port_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(host_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, host_); - } - if (port_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, port_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof connection_request.ConnectionRequestOuterClass.AddressInfo)) { - return super.equals(obj); - } - connection_request.ConnectionRequestOuterClass.AddressInfo other = - (connection_request.ConnectionRequestOuterClass.AddressInfo) obj; - - if (!getHost().equals(other.getHost())) return false; - if (getPort() != other.getPort()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + HOST_FIELD_NUMBER; - hash = (53 * hash) + getHost().hashCode(); - hash = (37 * hash) + PORT_FIELD_NUMBER; - hash = (53 * hash) + getPort(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - connection_request.ConnectionRequestOuterClass.AddressInfo prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code connection_request.AddressInfo} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:connection_request.AddressInfo) - connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AddressInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AddressInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.AddressInfo.class, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder.class); - } - - // Construct using connection_request.ConnectionRequestOuterClass.AddressInfo.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - host_ = ""; - port_ = 0; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AddressInfo_descriptor; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfo - getDefaultInstanceForType() { - return connection_request.ConnectionRequestOuterClass.AddressInfo.getDefaultInstance(); - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfo build() { - connection_request.ConnectionRequestOuterClass.AddressInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfo buildPartial() { - connection_request.ConnectionRequestOuterClass.AddressInfo result = - new connection_request.ConnectionRequestOuterClass.AddressInfo(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0( - connection_request.ConnectionRequestOuterClass.AddressInfo result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.host_ = host_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.port_ = port_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof connection_request.ConnectionRequestOuterClass.AddressInfo) { - return mergeFrom((connection_request.ConnectionRequestOuterClass.AddressInfo) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(connection_request.ConnectionRequestOuterClass.AddressInfo other) { - if (other - == connection_request.ConnectionRequestOuterClass.AddressInfo.getDefaultInstance()) - return this; - if (!other.getHost().isEmpty()) { - host_ = other.host_; - bitField0_ |= 0x00000001; - onChanged(); - } - if (other.getPort() != 0) { - setPort(other.getPort()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - host_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 16: - { - port_ = input.readUInt32(); - bitField0_ |= 0x00000002; - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.lang.Object host_ = ""; - - /** - * string host = 1; - * - * @return The host. - */ - public java.lang.String getHost() { - java.lang.Object ref = host_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - host_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string host = 1; - * - * @return The bytes for host. - */ - public com.google.protobuf.ByteString getHostBytes() { - java.lang.Object ref = host_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - host_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string host = 1; - * - * @param value The host to set. - * @return This builder for chaining. - */ - public Builder setHost(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - host_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * string host = 1; - * - * @return This builder for chaining. - */ - public Builder clearHost() { - host_ = getDefaultInstance().getHost(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - - /** - * string host = 1; - * - * @param value The bytes for host to set. - * @return This builder for chaining. - */ - public Builder setHostBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - host_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - private int port_; - - /** - * uint32 port = 2; - * - * @return The port. - */ - @java.lang.Override - public int getPort() { - return port_; - } - - /** - * uint32 port = 2; - * - * @param value The port to set. - * @return This builder for chaining. - */ - public Builder setPort(int value) { - - port_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * uint32 port = 2; - * - * @return This builder for chaining. - */ - public Builder clearPort() { - bitField0_ = (bitField0_ & ~0x00000002); - port_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:connection_request.AddressInfo) - } - - // @@protoc_insertion_point(class_scope:connection_request.AddressInfo) - private static final connection_request.ConnectionRequestOuterClass.AddressInfo - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new connection_request.ConnectionRequestOuterClass.AddressInfo(); - } - - public static connection_request.ConnectionRequestOuterClass.AddressInfo getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AddressInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfo getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface AuthenticationInfoOrBuilder - extends - // @@protoc_insertion_point(interface_extends:connection_request.AuthenticationInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * string password = 1; - * - * @return The password. - */ - java.lang.String getPassword(); - - /** - * string password = 1; - * - * @return The bytes for password. - */ - com.google.protobuf.ByteString getPasswordBytes(); - - /** - * string username = 2; - * - * @return The username. - */ - java.lang.String getUsername(); - - /** - * string username = 2; - * - * @return The bytes for username. - */ - com.google.protobuf.ByteString getUsernameBytes(); - } - - /** Protobuf type {@code connection_request.AuthenticationInfo} */ - public static final class AuthenticationInfo extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:connection_request.AuthenticationInfo) - AuthenticationInfoOrBuilder { - private static final long serialVersionUID = 0L; - - // Use AuthenticationInfo.newBuilder() to construct. - private AuthenticationInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AuthenticationInfo() { - password_ = ""; - username_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AuthenticationInfo(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AuthenticationInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AuthenticationInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.class, - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder.class); - } - - public static final int PASSWORD_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private volatile java.lang.Object password_ = ""; - - /** - * string password = 1; - * - * @return The password. - */ - @java.lang.Override - public java.lang.String getPassword() { - java.lang.Object ref = password_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - password_ = s; - return s; - } - } - - /** - * string password = 1; - * - * @return The bytes for password. - */ - @java.lang.Override - public com.google.protobuf.ByteString getPasswordBytes() { - java.lang.Object ref = password_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - password_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int USERNAME_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private volatile java.lang.Object username_ = ""; - - /** - * string username = 2; - * - * @return The username. - */ - @java.lang.Override - public java.lang.String getUsername() { - java.lang.Object ref = username_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - username_ = s; - return s; - } - } - - /** - * string username = 2; - * - * @return The bytes for username. - */ - @java.lang.Override - public com.google.protobuf.ByteString getUsernameBytes() { - java.lang.Object ref = username_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - username_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(password_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, password_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(username_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, username_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(password_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, password_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(username_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, username_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof connection_request.ConnectionRequestOuterClass.AuthenticationInfo)) { - return super.equals(obj); - } - connection_request.ConnectionRequestOuterClass.AuthenticationInfo other = - (connection_request.ConnectionRequestOuterClass.AuthenticationInfo) obj; - - if (!getPassword().equals(other.getPassword())) return false; - if (!getUsername().equals(other.getUsername())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PASSWORD_FIELD_NUMBER; - hash = (53 * hash) + getPassword().hashCode(); - hash = (37 * hash) + USERNAME_FIELD_NUMBER; - hash = (53 * hash) + getUsername().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo - parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code connection_request.AuthenticationInfo} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:connection_request.AuthenticationInfo) - connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AuthenticationInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AuthenticationInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.class, - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder.class); - } - - // Construct using - // connection_request.ConnectionRequestOuterClass.AuthenticationInfo.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - password_ = ""; - username_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_AuthenticationInfo_descriptor; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo - getDefaultInstanceForType() { - return connection_request.ConnectionRequestOuterClass.AuthenticationInfo - .getDefaultInstance(); - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo build() { - connection_request.ConnectionRequestOuterClass.AuthenticationInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo buildPartial() { - connection_request.ConnectionRequestOuterClass.AuthenticationInfo result = - new connection_request.ConnectionRequestOuterClass.AuthenticationInfo(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.password_ = password_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.username_ = username_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof connection_request.ConnectionRequestOuterClass.AuthenticationInfo) { - return mergeFrom( - (connection_request.ConnectionRequestOuterClass.AuthenticationInfo) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo other) { - if (other - == connection_request.ConnectionRequestOuterClass.AuthenticationInfo - .getDefaultInstance()) return this; - if (!other.getPassword().isEmpty()) { - password_ = other.password_; - bitField0_ |= 0x00000001; - onChanged(); - } - if (!other.getUsername().isEmpty()) { - username_ = other.username_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - password_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 18: - { - username_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.lang.Object password_ = ""; - - /** - * string password = 1; - * - * @return The password. - */ - public java.lang.String getPassword() { - java.lang.Object ref = password_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - password_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string password = 1; - * - * @return The bytes for password. - */ - public com.google.protobuf.ByteString getPasswordBytes() { - java.lang.Object ref = password_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - password_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string password = 1; - * - * @param value The password to set. - * @return This builder for chaining. - */ - public Builder setPassword(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - password_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * string password = 1; - * - * @return This builder for chaining. - */ - public Builder clearPassword() { - password_ = getDefaultInstance().getPassword(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - - /** - * string password = 1; - * - * @param value The bytes for password to set. - * @return This builder for chaining. - */ - public Builder setPasswordBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - password_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - private java.lang.Object username_ = ""; - - /** - * string username = 2; - * - * @return The username. - */ - public java.lang.String getUsername() { - java.lang.Object ref = username_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - username_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string username = 2; - * - * @return The bytes for username. - */ - public com.google.protobuf.ByteString getUsernameBytes() { - java.lang.Object ref = username_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - username_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string username = 2; - * - * @param value The username to set. - * @return This builder for chaining. - */ - public Builder setUsername(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - username_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * string username = 2; - * - * @return This builder for chaining. - */ - public Builder clearUsername() { - username_ = getDefaultInstance().getUsername(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - /** - * string username = 2; - * - * @param value The bytes for username to set. - * @return This builder for chaining. - */ - public Builder setUsernameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - username_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:connection_request.AuthenticationInfo) - } - - // @@protoc_insertion_point(class_scope:connection_request.AuthenticationInfo) - private static final connection_request.ConnectionRequestOuterClass.AuthenticationInfo - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new connection_request.ConnectionRequestOuterClass.AuthenticationInfo(); - } - - public static connection_request.ConnectionRequestOuterClass.AuthenticationInfo - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AuthenticationInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface ConnectionRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:connection_request.ConnectionRequest) - com.google.protobuf.MessageOrBuilder { - - /** repeated .connection_request.AddressInfo addresses = 1; */ - java.util.List getAddressesList(); - - /** repeated .connection_request.AddressInfo addresses = 1; */ - connection_request.ConnectionRequestOuterClass.AddressInfo getAddresses(int index); - - /** repeated .connection_request.AddressInfo addresses = 1; */ - int getAddressesCount(); - - /** repeated .connection_request.AddressInfo addresses = 1; */ - java.util.List - getAddressesOrBuilderList(); - - /** repeated .connection_request.AddressInfo addresses = 1; */ - connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder getAddressesOrBuilder( - int index); - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The enum numeric value on the wire for tlsMode. - */ - int getTlsModeValue(); - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The tlsMode. - */ - connection_request.ConnectionRequestOuterClass.TlsMode getTlsMode(); - - /** - * bool cluster_mode_enabled = 3; - * - * @return The clusterModeEnabled. - */ - boolean getClusterModeEnabled(); - - /** - * uint32 response_timeout = 4; - * - * @return The responseTimeout. - */ - int getResponseTimeout(); - - /** - * uint32 client_creation_timeout = 5; - * - * @return The clientCreationTimeout. - */ - int getClientCreationTimeout(); - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The enum numeric value on the wire for readFromReplicaStrategy. - */ - int getReadFromReplicaStrategyValue(); - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The readFromReplicaStrategy. - */ - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - getReadFromReplicaStrategy(); - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return Whether the connectionRetryStrategy field is set. - */ - boolean hasConnectionRetryStrategy(); - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return The connectionRetryStrategy. - */ - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getConnectionRetryStrategy(); - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder - getConnectionRetryStrategyOrBuilder(); - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return Whether the authenticationInfo field is set. - */ - boolean hasAuthenticationInfo(); - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return The authenticationInfo. - */ - connection_request.ConnectionRequestOuterClass.AuthenticationInfo getAuthenticationInfo(); - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder - getAuthenticationInfoOrBuilder(); - - /** - * uint32 database_id = 9; - * - * @return The databaseId. - */ - int getDatabaseId(); - } - - /** - * - * - *
-   * IMPORTANT - if you add fields here, you probably need to add them also in client/mod.rs:`sanitized_request_string`.
-   * 
- * - * Protobuf type {@code connection_request.ConnectionRequest} - */ - public static final class ConnectionRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:connection_request.ConnectionRequest) - ConnectionRequestOrBuilder { - private static final long serialVersionUID = 0L; - - // Use ConnectionRequest.newBuilder() to construct. - private ConnectionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ConnectionRequest() { - addresses_ = java.util.Collections.emptyList(); - tlsMode_ = 0; - readFromReplicaStrategy_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ConnectionRequest(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.ConnectionRequest.class, - connection_request.ConnectionRequestOuterClass.ConnectionRequest.Builder.class); - } - - public static final int ADDRESSES_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private java.util.List addresses_; - - /** repeated .connection_request.AddressInfo addresses = 1; */ - @java.lang.Override - public java.util.List - getAddressesList() { - return addresses_; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - @java.lang.Override - public java.util.List< - ? extends connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder> - getAddressesOrBuilderList() { - return addresses_; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - @java.lang.Override - public int getAddressesCount() { - return addresses_.size(); - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfo getAddresses(int index) { - return addresses_.get(index); - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder - getAddressesOrBuilder(int index) { - return addresses_.get(index); - } - - public static final int TLS_MODE_FIELD_NUMBER = 2; - private int tlsMode_ = 0; - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The enum numeric value on the wire for tlsMode. - */ - @java.lang.Override - public int getTlsModeValue() { - return tlsMode_; - } - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The tlsMode. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.TlsMode getTlsMode() { - connection_request.ConnectionRequestOuterClass.TlsMode result = - connection_request.ConnectionRequestOuterClass.TlsMode.forNumber(tlsMode_); - return result == null - ? connection_request.ConnectionRequestOuterClass.TlsMode.UNRECOGNIZED - : result; - } - - public static final int CLUSTER_MODE_ENABLED_FIELD_NUMBER = 3; - private boolean clusterModeEnabled_ = false; - - /** - * bool cluster_mode_enabled = 3; - * - * @return The clusterModeEnabled. - */ - @java.lang.Override - public boolean getClusterModeEnabled() { - return clusterModeEnabled_; - } - - public static final int RESPONSE_TIMEOUT_FIELD_NUMBER = 4; - private int responseTimeout_ = 0; - - /** - * uint32 response_timeout = 4; - * - * @return The responseTimeout. - */ - @java.lang.Override - public int getResponseTimeout() { - return responseTimeout_; - } - - public static final int CLIENT_CREATION_TIMEOUT_FIELD_NUMBER = 5; - private int clientCreationTimeout_ = 0; - - /** - * uint32 client_creation_timeout = 5; - * - * @return The clientCreationTimeout. - */ - @java.lang.Override - public int getClientCreationTimeout() { - return clientCreationTimeout_; - } - - public static final int READ_FROM_REPLICA_STRATEGY_FIELD_NUMBER = 6; - private int readFromReplicaStrategy_ = 0; - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The enum numeric value on the wire for readFromReplicaStrategy. - */ - @java.lang.Override - public int getReadFromReplicaStrategyValue() { - return readFromReplicaStrategy_; - } - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The readFromReplicaStrategy. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - getReadFromReplicaStrategy() { - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy result = - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy.forNumber( - readFromReplicaStrategy_); - return result == null - ? connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy.UNRECOGNIZED - : result; - } - - public static final int CONNECTION_RETRY_STRATEGY_FIELD_NUMBER = 7; - private connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - connectionRetryStrategy_; - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return Whether the connectionRetryStrategy field is set. - */ - @java.lang.Override - public boolean hasConnectionRetryStrategy() { - return connectionRetryStrategy_ != null; - } - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return The connectionRetryStrategy. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getConnectionRetryStrategy() { - return connectionRetryStrategy_ == null - ? connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance() - : connectionRetryStrategy_; - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder - getConnectionRetryStrategyOrBuilder() { - return connectionRetryStrategy_ == null - ? connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance() - : connectionRetryStrategy_; - } - - public static final int AUTHENTICATION_INFO_FIELD_NUMBER = 8; - private connection_request.ConnectionRequestOuterClass.AuthenticationInfo authenticationInfo_; - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return Whether the authenticationInfo field is set. - */ - @java.lang.Override - public boolean hasAuthenticationInfo() { - return authenticationInfo_ != null; - } - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return The authenticationInfo. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo - getAuthenticationInfo() { - return authenticationInfo_ == null - ? connection_request.ConnectionRequestOuterClass.AuthenticationInfo.getDefaultInstance() - : authenticationInfo_; - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder - getAuthenticationInfoOrBuilder() { - return authenticationInfo_ == null - ? connection_request.ConnectionRequestOuterClass.AuthenticationInfo.getDefaultInstance() - : authenticationInfo_; - } - - public static final int DATABASE_ID_FIELD_NUMBER = 9; - private int databaseId_ = 0; - - /** - * uint32 database_id = 9; - * - * @return The databaseId. - */ - @java.lang.Override - public int getDatabaseId() { - return databaseId_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < addresses_.size(); i++) { - output.writeMessage(1, addresses_.get(i)); - } - if (tlsMode_ != connection_request.ConnectionRequestOuterClass.TlsMode.NoTls.getNumber()) { - output.writeEnum(2, tlsMode_); - } - if (clusterModeEnabled_ != false) { - output.writeBool(3, clusterModeEnabled_); - } - if (responseTimeout_ != 0) { - output.writeUInt32(4, responseTimeout_); - } - if (clientCreationTimeout_ != 0) { - output.writeUInt32(5, clientCreationTimeout_); - } - if (readFromReplicaStrategy_ - != connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - .AlwaysFromPrimary.getNumber()) { - output.writeEnum(6, readFromReplicaStrategy_); - } - if (connectionRetryStrategy_ != null) { - output.writeMessage(7, getConnectionRetryStrategy()); - } - if (authenticationInfo_ != null) { - output.writeMessage(8, getAuthenticationInfo()); - } - if (databaseId_ != 0) { - output.writeUInt32(9, databaseId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < addresses_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, addresses_.get(i)); - } - if (tlsMode_ != connection_request.ConnectionRequestOuterClass.TlsMode.NoTls.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, tlsMode_); - } - if (clusterModeEnabled_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, clusterModeEnabled_); - } - if (responseTimeout_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(4, responseTimeout_); - } - if (clientCreationTimeout_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(5, clientCreationTimeout_); - } - if (readFromReplicaStrategy_ - != connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - .AlwaysFromPrimary.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, readFromReplicaStrategy_); - } - if (connectionRetryStrategy_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 7, getConnectionRetryStrategy()); - } - if (authenticationInfo_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize(8, getAuthenticationInfo()); - } - if (databaseId_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(9, databaseId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof connection_request.ConnectionRequestOuterClass.ConnectionRequest)) { - return super.equals(obj); - } - connection_request.ConnectionRequestOuterClass.ConnectionRequest other = - (connection_request.ConnectionRequestOuterClass.ConnectionRequest) obj; - - if (!getAddressesList().equals(other.getAddressesList())) return false; - if (tlsMode_ != other.tlsMode_) return false; - if (getClusterModeEnabled() != other.getClusterModeEnabled()) return false; - if (getResponseTimeout() != other.getResponseTimeout()) return false; - if (getClientCreationTimeout() != other.getClientCreationTimeout()) return false; - if (readFromReplicaStrategy_ != other.readFromReplicaStrategy_) return false; - if (hasConnectionRetryStrategy() != other.hasConnectionRetryStrategy()) return false; - if (hasConnectionRetryStrategy()) { - if (!getConnectionRetryStrategy().equals(other.getConnectionRetryStrategy())) return false; - } - if (hasAuthenticationInfo() != other.hasAuthenticationInfo()) return false; - if (hasAuthenticationInfo()) { - if (!getAuthenticationInfo().equals(other.getAuthenticationInfo())) return false; - } - if (getDatabaseId() != other.getDatabaseId()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getAddressesCount() > 0) { - hash = (37 * hash) + ADDRESSES_FIELD_NUMBER; - hash = (53 * hash) + getAddressesList().hashCode(); - } - hash = (37 * hash) + TLS_MODE_FIELD_NUMBER; - hash = (53 * hash) + tlsMode_; - hash = (37 * hash) + CLUSTER_MODE_ENABLED_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getClusterModeEnabled()); - hash = (37 * hash) + RESPONSE_TIMEOUT_FIELD_NUMBER; - hash = (53 * hash) + getResponseTimeout(); - hash = (37 * hash) + CLIENT_CREATION_TIMEOUT_FIELD_NUMBER; - hash = (53 * hash) + getClientCreationTimeout(); - hash = (37 * hash) + READ_FROM_REPLICA_STRATEGY_FIELD_NUMBER; - hash = (53 * hash) + readFromReplicaStrategy_; - if (hasConnectionRetryStrategy()) { - hash = (37 * hash) + CONNECTION_RETRY_STRATEGY_FIELD_NUMBER; - hash = (53 * hash) + getConnectionRetryStrategy().hashCode(); - } - if (hasAuthenticationInfo()) { - hash = (37 * hash) + AUTHENTICATION_INFO_FIELD_NUMBER; - hash = (53 * hash) + getAuthenticationInfo().hashCode(); - } - hash = (37 * hash) + DATABASE_ID_FIELD_NUMBER; - hash = (53 * hash) + getDatabaseId(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest - parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - connection_request.ConnectionRequestOuterClass.ConnectionRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * - * - *
-     * IMPORTANT - if you add fields here, you probably need to add them also in client/mod.rs:`sanitized_request_string`.
-     * 
- * - * Protobuf type {@code connection_request.ConnectionRequest} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:connection_request.ConnectionRequest) - connection_request.ConnectionRequestOuterClass.ConnectionRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.ConnectionRequest.class, - connection_request.ConnectionRequestOuterClass.ConnectionRequest.Builder.class); - } - - // Construct using - // connection_request.ConnectionRequestOuterClass.ConnectionRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (addressesBuilder_ == null) { - addresses_ = java.util.Collections.emptyList(); - } else { - addresses_ = null; - addressesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - tlsMode_ = 0; - clusterModeEnabled_ = false; - responseTimeout_ = 0; - clientCreationTimeout_ = 0; - readFromReplicaStrategy_ = 0; - connectionRetryStrategy_ = null; - if (connectionRetryStrategyBuilder_ != null) { - connectionRetryStrategyBuilder_.dispose(); - connectionRetryStrategyBuilder_ = null; - } - authenticationInfo_ = null; - if (authenticationInfoBuilder_ != null) { - authenticationInfoBuilder_.dispose(); - authenticationInfoBuilder_ = null; - } - databaseId_ = 0; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRequest_descriptor; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRequest - getDefaultInstanceForType() { - return connection_request.ConnectionRequestOuterClass.ConnectionRequest - .getDefaultInstance(); - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRequest build() { - connection_request.ConnectionRequestOuterClass.ConnectionRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRequest buildPartial() { - connection_request.ConnectionRequestOuterClass.ConnectionRequest result = - new connection_request.ConnectionRequestOuterClass.ConnectionRequest(this); - buildPartialRepeatedFields(result); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartialRepeatedFields( - connection_request.ConnectionRequestOuterClass.ConnectionRequest result) { - if (addressesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - addresses_ = java.util.Collections.unmodifiableList(addresses_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.addresses_ = addresses_; - } else { - result.addresses_ = addressesBuilder_.build(); - } - } - - private void buildPartial0( - connection_request.ConnectionRequestOuterClass.ConnectionRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000002) != 0)) { - result.tlsMode_ = tlsMode_; - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.clusterModeEnabled_ = clusterModeEnabled_; - } - if (((from_bitField0_ & 0x00000008) != 0)) { - result.responseTimeout_ = responseTimeout_; - } - if (((from_bitField0_ & 0x00000010) != 0)) { - result.clientCreationTimeout_ = clientCreationTimeout_; - } - if (((from_bitField0_ & 0x00000020) != 0)) { - result.readFromReplicaStrategy_ = readFromReplicaStrategy_; - } - if (((from_bitField0_ & 0x00000040) != 0)) { - result.connectionRetryStrategy_ = - connectionRetryStrategyBuilder_ == null - ? connectionRetryStrategy_ - : connectionRetryStrategyBuilder_.build(); - } - if (((from_bitField0_ & 0x00000080) != 0)) { - result.authenticationInfo_ = - authenticationInfoBuilder_ == null - ? authenticationInfo_ - : authenticationInfoBuilder_.build(); - } - if (((from_bitField0_ & 0x00000100) != 0)) { - result.databaseId_ = databaseId_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof connection_request.ConnectionRequestOuterClass.ConnectionRequest) { - return mergeFrom( - (connection_request.ConnectionRequestOuterClass.ConnectionRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - connection_request.ConnectionRequestOuterClass.ConnectionRequest other) { - if (other - == connection_request.ConnectionRequestOuterClass.ConnectionRequest - .getDefaultInstance()) return this; - if (addressesBuilder_ == null) { - if (!other.addresses_.isEmpty()) { - if (addresses_.isEmpty()) { - addresses_ = other.addresses_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureAddressesIsMutable(); - addresses_.addAll(other.addresses_); - } - onChanged(); - } - } else { - if (!other.addresses_.isEmpty()) { - if (addressesBuilder_.isEmpty()) { - addressesBuilder_.dispose(); - addressesBuilder_ = null; - addresses_ = other.addresses_; - bitField0_ = (bitField0_ & ~0x00000001); - addressesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getAddressesFieldBuilder() - : null; - } else { - addressesBuilder_.addAllMessages(other.addresses_); - } - } - } - if (other.tlsMode_ != 0) { - setTlsModeValue(other.getTlsModeValue()); - } - if (other.getClusterModeEnabled() != false) { - setClusterModeEnabled(other.getClusterModeEnabled()); - } - if (other.getResponseTimeout() != 0) { - setResponseTimeout(other.getResponseTimeout()); - } - if (other.getClientCreationTimeout() != 0) { - setClientCreationTimeout(other.getClientCreationTimeout()); - } - if (other.readFromReplicaStrategy_ != 0) { - setReadFromReplicaStrategyValue(other.getReadFromReplicaStrategyValue()); - } - if (other.hasConnectionRetryStrategy()) { - mergeConnectionRetryStrategy(other.getConnectionRetryStrategy()); - } - if (other.hasAuthenticationInfo()) { - mergeAuthenticationInfo(other.getAuthenticationInfo()); - } - if (other.getDatabaseId() != 0) { - setDatabaseId(other.getDatabaseId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - connection_request.ConnectionRequestOuterClass.AddressInfo m = - input.readMessage( - connection_request.ConnectionRequestOuterClass.AddressInfo.parser(), - extensionRegistry); - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - addresses_.add(m); - } else { - addressesBuilder_.addMessage(m); - } - break; - } // case 10 - case 16: - { - tlsMode_ = input.readEnum(); - bitField0_ |= 0x00000002; - break; - } // case 16 - case 24: - { - clusterModeEnabled_ = input.readBool(); - bitField0_ |= 0x00000004; - break; - } // case 24 - case 32: - { - responseTimeout_ = input.readUInt32(); - bitField0_ |= 0x00000008; - break; - } // case 32 - case 40: - { - clientCreationTimeout_ = input.readUInt32(); - bitField0_ |= 0x00000010; - break; - } // case 40 - case 48: - { - readFromReplicaStrategy_ = input.readEnum(); - bitField0_ |= 0x00000020; - break; - } // case 48 - case 58: - { - input.readMessage( - getConnectionRetryStrategyFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000040; - break; - } // case 58 - case 66: - { - input.readMessage( - getAuthenticationInfoFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000080; - break; - } // case 66 - case 72: - { - databaseId_ = input.readUInt32(); - bitField0_ |= 0x00000100; - break; - } // case 72 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List - addresses_ = java.util.Collections.emptyList(); - - private void ensureAddressesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - addresses_ = - new java.util.ArrayList( - addresses_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AddressInfo, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder, - connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder> - addressesBuilder_; - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public java.util.List - getAddressesList() { - if (addressesBuilder_ == null) { - return java.util.Collections.unmodifiableList(addresses_); - } else { - return addressesBuilder_.getMessageList(); - } - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public int getAddressesCount() { - if (addressesBuilder_ == null) { - return addresses_.size(); - } else { - return addressesBuilder_.getCount(); - } - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public connection_request.ConnectionRequestOuterClass.AddressInfo getAddresses(int index) { - if (addressesBuilder_ == null) { - return addresses_.get(index); - } else { - return addressesBuilder_.getMessage(index); - } - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder setAddresses( - int index, connection_request.ConnectionRequestOuterClass.AddressInfo value) { - if (addressesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAddressesIsMutable(); - addresses_.set(index, value); - onChanged(); - } else { - addressesBuilder_.setMessage(index, value); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder setAddresses( - int index, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder builderForValue) { - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - addresses_.set(index, builderForValue.build()); - onChanged(); - } else { - addressesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder addAddresses( - connection_request.ConnectionRequestOuterClass.AddressInfo value) { - if (addressesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAddressesIsMutable(); - addresses_.add(value); - onChanged(); - } else { - addressesBuilder_.addMessage(value); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder addAddresses( - int index, connection_request.ConnectionRequestOuterClass.AddressInfo value) { - if (addressesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAddressesIsMutable(); - addresses_.add(index, value); - onChanged(); - } else { - addressesBuilder_.addMessage(index, value); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder addAddresses( - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder builderForValue) { - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - addresses_.add(builderForValue.build()); - onChanged(); - } else { - addressesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder addAddresses( - int index, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder builderForValue) { - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - addresses_.add(index, builderForValue.build()); - onChanged(); - } else { - addressesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder addAllAddresses( - java.lang.Iterable - values) { - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, addresses_); - onChanged(); - } else { - addressesBuilder_.addAllMessages(values); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder clearAddresses() { - if (addressesBuilder_ == null) { - addresses_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - addressesBuilder_.clear(); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public Builder removeAddresses(int index) { - if (addressesBuilder_ == null) { - ensureAddressesIsMutable(); - addresses_.remove(index); - onChanged(); - } else { - addressesBuilder_.remove(index); - } - return this; - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public connection_request.ConnectionRequestOuterClass.AddressInfo.Builder getAddressesBuilder( - int index) { - return getAddressesFieldBuilder().getBuilder(index); - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder - getAddressesOrBuilder(int index) { - if (addressesBuilder_ == null) { - return addresses_.get(index); - } else { - return addressesBuilder_.getMessageOrBuilder(index); - } - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public java.util.List< - ? extends connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder> - getAddressesOrBuilderList() { - if (addressesBuilder_ != null) { - return addressesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(addresses_); - } - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public connection_request.ConnectionRequestOuterClass.AddressInfo.Builder - addAddressesBuilder() { - return getAddressesFieldBuilder() - .addBuilder( - connection_request.ConnectionRequestOuterClass.AddressInfo.getDefaultInstance()); - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public connection_request.ConnectionRequestOuterClass.AddressInfo.Builder addAddressesBuilder( - int index) { - return getAddressesFieldBuilder() - .addBuilder( - index, - connection_request.ConnectionRequestOuterClass.AddressInfo.getDefaultInstance()); - } - - /** repeated .connection_request.AddressInfo addresses = 1; */ - public java.util.List - getAddressesBuilderList() { - return getAddressesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AddressInfo, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder, - connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder> - getAddressesFieldBuilder() { - if (addressesBuilder_ == null) { - addressesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AddressInfo, - connection_request.ConnectionRequestOuterClass.AddressInfo.Builder, - connection_request.ConnectionRequestOuterClass.AddressInfoOrBuilder>( - addresses_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - addresses_ = null; - } - return addressesBuilder_; - } - - private int tlsMode_ = 0; - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The enum numeric value on the wire for tlsMode. - */ - @java.lang.Override - public int getTlsModeValue() { - return tlsMode_; - } - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @param value The enum numeric value on the wire for tlsMode to set. - * @return This builder for chaining. - */ - public Builder setTlsModeValue(int value) { - tlsMode_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return The tlsMode. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.TlsMode getTlsMode() { - connection_request.ConnectionRequestOuterClass.TlsMode result = - connection_request.ConnectionRequestOuterClass.TlsMode.forNumber(tlsMode_); - return result == null - ? connection_request.ConnectionRequestOuterClass.TlsMode.UNRECOGNIZED - : result; - } - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @param value The tlsMode to set. - * @return This builder for chaining. - */ - public Builder setTlsMode(connection_request.ConnectionRequestOuterClass.TlsMode value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - tlsMode_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .connection_request.TlsMode tls_mode = 2; - * - * @return This builder for chaining. - */ - public Builder clearTlsMode() { - bitField0_ = (bitField0_ & ~0x00000002); - tlsMode_ = 0; - onChanged(); - return this; - } - - private boolean clusterModeEnabled_; - - /** - * bool cluster_mode_enabled = 3; - * - * @return The clusterModeEnabled. - */ - @java.lang.Override - public boolean getClusterModeEnabled() { - return clusterModeEnabled_; - } - - /** - * bool cluster_mode_enabled = 3; - * - * @param value The clusterModeEnabled to set. - * @return This builder for chaining. - */ - public Builder setClusterModeEnabled(boolean value) { - - clusterModeEnabled_ = value; - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - - /** - * bool cluster_mode_enabled = 3; - * - * @return This builder for chaining. - */ - public Builder clearClusterModeEnabled() { - bitField0_ = (bitField0_ & ~0x00000004); - clusterModeEnabled_ = false; - onChanged(); - return this; - } - - private int responseTimeout_; - - /** - * uint32 response_timeout = 4; - * - * @return The responseTimeout. - */ - @java.lang.Override - public int getResponseTimeout() { - return responseTimeout_; - } - - /** - * uint32 response_timeout = 4; - * - * @param value The responseTimeout to set. - * @return This builder for chaining. - */ - public Builder setResponseTimeout(int value) { - - responseTimeout_ = value; - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - - /** - * uint32 response_timeout = 4; - * - * @return This builder for chaining. - */ - public Builder clearResponseTimeout() { - bitField0_ = (bitField0_ & ~0x00000008); - responseTimeout_ = 0; - onChanged(); - return this; - } - - private int clientCreationTimeout_; - - /** - * uint32 client_creation_timeout = 5; - * - * @return The clientCreationTimeout. - */ - @java.lang.Override - public int getClientCreationTimeout() { - return clientCreationTimeout_; - } - - /** - * uint32 client_creation_timeout = 5; - * - * @param value The clientCreationTimeout to set. - * @return This builder for chaining. - */ - public Builder setClientCreationTimeout(int value) { - - clientCreationTimeout_ = value; - bitField0_ |= 0x00000010; - onChanged(); - return this; - } - - /** - * uint32 client_creation_timeout = 5; - * - * @return This builder for chaining. - */ - public Builder clearClientCreationTimeout() { - bitField0_ = (bitField0_ & ~0x00000010); - clientCreationTimeout_ = 0; - onChanged(); - return this; - } - - private int readFromReplicaStrategy_ = 0; - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The enum numeric value on the wire for readFromReplicaStrategy. - */ - @java.lang.Override - public int getReadFromReplicaStrategyValue() { - return readFromReplicaStrategy_; - } - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @param value The enum numeric value on the wire for readFromReplicaStrategy to set. - * @return This builder for chaining. - */ - public Builder setReadFromReplicaStrategyValue(int value) { - readFromReplicaStrategy_ = value; - bitField0_ |= 0x00000020; - onChanged(); - return this; - } - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return The readFromReplicaStrategy. - */ - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy - getReadFromReplicaStrategy() { - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy result = - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy.forNumber( - readFromReplicaStrategy_); - return result == null - ? connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy.UNRECOGNIZED - : result; - } - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @param value The readFromReplicaStrategy to set. - * @return This builder for chaining. - */ - public Builder setReadFromReplicaStrategy( - connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - readFromReplicaStrategy_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .connection_request.ReadFromReplicaStrategy read_from_replica_strategy = 6; - * - * @return This builder for chaining. - */ - public Builder clearReadFromReplicaStrategy() { - bitField0_ = (bitField0_ & ~0x00000020); - readFromReplicaStrategy_ = 0; - onChanged(); - return this; - } - - private connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - connectionRetryStrategy_; - private com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder> - connectionRetryStrategyBuilder_; - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return Whether the connectionRetryStrategy field is set. - */ - public boolean hasConnectionRetryStrategy() { - return ((bitField0_ & 0x00000040) != 0); - } - - /** - * .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; - * - * @return The connectionRetryStrategy. - */ - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getConnectionRetryStrategy() { - if (connectionRetryStrategyBuilder_ == null) { - return connectionRetryStrategy_ == null - ? connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance() - : connectionRetryStrategy_; - } else { - return connectionRetryStrategyBuilder_.getMessage(); - } - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public Builder setConnectionRetryStrategy( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy value) { - if (connectionRetryStrategyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - connectionRetryStrategy_ = value; - } else { - connectionRetryStrategyBuilder_.setMessage(value); - } - bitField0_ |= 0x00000040; - onChanged(); - return this; - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public Builder setConnectionRetryStrategy( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder - builderForValue) { - if (connectionRetryStrategyBuilder_ == null) { - connectionRetryStrategy_ = builderForValue.build(); - } else { - connectionRetryStrategyBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000040; - onChanged(); - return this; - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public Builder mergeConnectionRetryStrategy( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy value) { - if (connectionRetryStrategyBuilder_ == null) { - if (((bitField0_ & 0x00000040) != 0) - && connectionRetryStrategy_ != null - && connectionRetryStrategy_ - != connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance()) { - getConnectionRetryStrategyBuilder().mergeFrom(value); - } else { - connectionRetryStrategy_ = value; - } - } else { - connectionRetryStrategyBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000040; - onChanged(); - return this; - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public Builder clearConnectionRetryStrategy() { - bitField0_ = (bitField0_ & ~0x00000040); - connectionRetryStrategy_ = null; - if (connectionRetryStrategyBuilder_ != null) { - connectionRetryStrategyBuilder_.dispose(); - connectionRetryStrategyBuilder_ = null; - } - onChanged(); - return this; - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder - getConnectionRetryStrategyBuilder() { - bitField0_ |= 0x00000040; - onChanged(); - return getConnectionRetryStrategyFieldBuilder().getBuilder(); - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder - getConnectionRetryStrategyOrBuilder() { - if (connectionRetryStrategyBuilder_ != null) { - return connectionRetryStrategyBuilder_.getMessageOrBuilder(); - } else { - return connectionRetryStrategy_ == null - ? connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance() - : connectionRetryStrategy_; - } - } - - /** .connection_request.ConnectionRetryStrategy connection_retry_strategy = 7; */ - private com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder> - getConnectionRetryStrategyFieldBuilder() { - if (connectionRetryStrategyBuilder_ == null) { - connectionRetryStrategyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder>( - getConnectionRetryStrategy(), getParentForChildren(), isClean()); - connectionRetryStrategy_ = null; - } - return connectionRetryStrategyBuilder_; - } - - private connection_request.ConnectionRequestOuterClass.AuthenticationInfo authenticationInfo_; - private com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AuthenticationInfo, - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder, - connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder> - authenticationInfoBuilder_; - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return Whether the authenticationInfo field is set. - */ - public boolean hasAuthenticationInfo() { - return ((bitField0_ & 0x00000080) != 0); - } - - /** - * .connection_request.AuthenticationInfo authentication_info = 8; - * - * @return The authenticationInfo. - */ - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo - getAuthenticationInfo() { - if (authenticationInfoBuilder_ == null) { - return authenticationInfo_ == null - ? connection_request.ConnectionRequestOuterClass.AuthenticationInfo - .getDefaultInstance() - : authenticationInfo_; - } else { - return authenticationInfoBuilder_.getMessage(); - } - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public Builder setAuthenticationInfo( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo value) { - if (authenticationInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - authenticationInfo_ = value; - } else { - authenticationInfoBuilder_.setMessage(value); - } - bitField0_ |= 0x00000080; - onChanged(); - return this; - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public Builder setAuthenticationInfo( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder - builderForValue) { - if (authenticationInfoBuilder_ == null) { - authenticationInfo_ = builderForValue.build(); - } else { - authenticationInfoBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000080; - onChanged(); - return this; - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public Builder mergeAuthenticationInfo( - connection_request.ConnectionRequestOuterClass.AuthenticationInfo value) { - if (authenticationInfoBuilder_ == null) { - if (((bitField0_ & 0x00000080) != 0) - && authenticationInfo_ != null - && authenticationInfo_ - != connection_request.ConnectionRequestOuterClass.AuthenticationInfo - .getDefaultInstance()) { - getAuthenticationInfoBuilder().mergeFrom(value); - } else { - authenticationInfo_ = value; - } - } else { - authenticationInfoBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000080; - onChanged(); - return this; - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public Builder clearAuthenticationInfo() { - bitField0_ = (bitField0_ & ~0x00000080); - authenticationInfo_ = null; - if (authenticationInfoBuilder_ != null) { - authenticationInfoBuilder_.dispose(); - authenticationInfoBuilder_ = null; - } - onChanged(); - return this; - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder - getAuthenticationInfoBuilder() { - bitField0_ |= 0x00000080; - onChanged(); - return getAuthenticationInfoFieldBuilder().getBuilder(); - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - public connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder - getAuthenticationInfoOrBuilder() { - if (authenticationInfoBuilder_ != null) { - return authenticationInfoBuilder_.getMessageOrBuilder(); - } else { - return authenticationInfo_ == null - ? connection_request.ConnectionRequestOuterClass.AuthenticationInfo - .getDefaultInstance() - : authenticationInfo_; - } - } - - /** .connection_request.AuthenticationInfo authentication_info = 8; */ - private com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AuthenticationInfo, - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder, - connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder> - getAuthenticationInfoFieldBuilder() { - if (authenticationInfoBuilder_ == null) { - authenticationInfoBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - connection_request.ConnectionRequestOuterClass.AuthenticationInfo, - connection_request.ConnectionRequestOuterClass.AuthenticationInfo.Builder, - connection_request.ConnectionRequestOuterClass.AuthenticationInfoOrBuilder>( - getAuthenticationInfo(), getParentForChildren(), isClean()); - authenticationInfo_ = null; - } - return authenticationInfoBuilder_; - } - - private int databaseId_; - - /** - * uint32 database_id = 9; - * - * @return The databaseId. - */ - @java.lang.Override - public int getDatabaseId() { - return databaseId_; - } - - /** - * uint32 database_id = 9; - * - * @param value The databaseId to set. - * @return This builder for chaining. - */ - public Builder setDatabaseId(int value) { - - databaseId_ = value; - bitField0_ |= 0x00000100; - onChanged(); - return this; - } - - /** - * uint32 database_id = 9; - * - * @return This builder for chaining. - */ - public Builder clearDatabaseId() { - bitField0_ = (bitField0_ & ~0x00000100); - databaseId_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:connection_request.ConnectionRequest) - } - - // @@protoc_insertion_point(class_scope:connection_request.ConnectionRequest) - private static final connection_request.ConnectionRequestOuterClass.ConnectionRequest - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new connection_request.ConnectionRequestOuterClass.ConnectionRequest(); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRequest - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ConnectionRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRequest - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface ConnectionRetryStrategyOrBuilder - extends - // @@protoc_insertion_point(interface_extends:connection_request.ConnectionRetryStrategy) - com.google.protobuf.MessageOrBuilder { - - /** - * uint32 number_of_retries = 1; - * - * @return The numberOfRetries. - */ - int getNumberOfRetries(); - - /** - * uint32 factor = 2; - * - * @return The factor. - */ - int getFactor(); - - /** - * uint32 exponent_base = 3; - * - * @return The exponentBase. - */ - int getExponentBase(); - } - - /** Protobuf type {@code connection_request.ConnectionRetryStrategy} */ - public static final class ConnectionRetryStrategy extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:connection_request.ConnectionRetryStrategy) - ConnectionRetryStrategyOrBuilder { - private static final long serialVersionUID = 0L; - - // Use ConnectionRetryStrategy.newBuilder() to construct. - private ConnectionRetryStrategy(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ConnectionRetryStrategy() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ConnectionRetryStrategy(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRetryStrategy_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRetryStrategy_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.class, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder.class); - } - - public static final int NUMBER_OF_RETRIES_FIELD_NUMBER = 1; - private int numberOfRetries_ = 0; - - /** - * uint32 number_of_retries = 1; - * - * @return The numberOfRetries. - */ - @java.lang.Override - public int getNumberOfRetries() { - return numberOfRetries_; - } - - public static final int FACTOR_FIELD_NUMBER = 2; - private int factor_ = 0; - - /** - * uint32 factor = 2; - * - * @return The factor. - */ - @java.lang.Override - public int getFactor() { - return factor_; - } - - public static final int EXPONENT_BASE_FIELD_NUMBER = 3; - private int exponentBase_ = 0; - - /** - * uint32 exponent_base = 3; - * - * @return The exponentBase. - */ - @java.lang.Override - public int getExponentBase() { - return exponentBase_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (numberOfRetries_ != 0) { - output.writeUInt32(1, numberOfRetries_); - } - if (factor_ != 0) { - output.writeUInt32(2, factor_); - } - if (exponentBase_ != 0) { - output.writeUInt32(3, exponentBase_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (numberOfRetries_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(1, numberOfRetries_); - } - if (factor_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, factor_); - } - if (exponentBase_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(3, exponentBase_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj - instanceof connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy)) { - return super.equals(obj); - } - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy other = - (connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy) obj; - - if (getNumberOfRetries() != other.getNumberOfRetries()) return false; - if (getFactor() != other.getFactor()) return false; - if (getExponentBase() != other.getExponentBase()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NUMBER_OF_RETRIES_FIELD_NUMBER; - hash = (53 * hash) + getNumberOfRetries(); - hash = (37 * hash) + FACTOR_FIELD_NUMBER; - hash = (53 * hash) + getFactor(); - hash = (37 * hash) + EXPONENT_BASE_FIELD_NUMBER; - hash = (53 * hash) + getExponentBase(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code connection_request.ConnectionRetryStrategy} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:connection_request.ConnectionRetryStrategy) - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategyOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRetryStrategy_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRetryStrategy_fieldAccessorTable - .ensureFieldAccessorsInitialized( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.class, - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.Builder - .class); - } - - // Construct using - // connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - numberOfRetries_ = 0; - factor_ = 0; - exponentBase_ = 0; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return connection_request.ConnectionRequestOuterClass - .internal_static_connection_request_ConnectionRetryStrategy_descriptor; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getDefaultInstanceForType() { - return connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance(); - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy build() { - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy result = - buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy buildPartial() { - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy result = - new connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.numberOfRetries_ = numberOfRetries_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.factor_ = factor_; - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.exponentBase_ = exponentBase_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other - instanceof connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy) { - return mergeFrom( - (connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy other) { - if (other - == connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - .getDefaultInstance()) return this; - if (other.getNumberOfRetries() != 0) { - setNumberOfRetries(other.getNumberOfRetries()); - } - if (other.getFactor() != 0) { - setFactor(other.getFactor()); - } - if (other.getExponentBase() != 0) { - setExponentBase(other.getExponentBase()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - numberOfRetries_ = input.readUInt32(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 16: - { - factor_ = input.readUInt32(); - bitField0_ |= 0x00000002; - break; - } // case 16 - case 24: - { - exponentBase_ = input.readUInt32(); - bitField0_ |= 0x00000004; - break; - } // case 24 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private int numberOfRetries_; - - /** - * uint32 number_of_retries = 1; - * - * @return The numberOfRetries. - */ - @java.lang.Override - public int getNumberOfRetries() { - return numberOfRetries_; - } - - /** - * uint32 number_of_retries = 1; - * - * @param value The numberOfRetries to set. - * @return This builder for chaining. - */ - public Builder setNumberOfRetries(int value) { - - numberOfRetries_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * uint32 number_of_retries = 1; - * - * @return This builder for chaining. - */ - public Builder clearNumberOfRetries() { - bitField0_ = (bitField0_ & ~0x00000001); - numberOfRetries_ = 0; - onChanged(); - return this; - } - - private int factor_; - - /** - * uint32 factor = 2; - * - * @return The factor. - */ - @java.lang.Override - public int getFactor() { - return factor_; - } - - /** - * uint32 factor = 2; - * - * @param value The factor to set. - * @return This builder for chaining. - */ - public Builder setFactor(int value) { - - factor_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * uint32 factor = 2; - * - * @return This builder for chaining. - */ - public Builder clearFactor() { - bitField0_ = (bitField0_ & ~0x00000002); - factor_ = 0; - onChanged(); - return this; - } - - private int exponentBase_; - - /** - * uint32 exponent_base = 3; - * - * @return The exponentBase. - */ - @java.lang.Override - public int getExponentBase() { - return exponentBase_; - } - - /** - * uint32 exponent_base = 3; - * - * @param value The exponentBase to set. - * @return This builder for chaining. - */ - public Builder setExponentBase(int value) { - - exponentBase_ = value; - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - - /** - * uint32 exponent_base = 3; - * - * @return This builder for chaining. - */ - public Builder clearExponentBase() { - bitField0_ = (bitField0_ & ~0x00000004); - exponentBase_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:connection_request.ConnectionRetryStrategy) - } - - // @@protoc_insertion_point(class_scope:connection_request.ConnectionRetryStrategy) - private static final connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = - new connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy(); - } - - public static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ConnectionRetryStrategy parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_connection_request_AddressInfo_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_connection_request_AddressInfo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_connection_request_AuthenticationInfo_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_connection_request_AuthenticationInfo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_connection_request_ConnectionRequest_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_connection_request_ConnectionRequest_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_connection_request_ConnectionRetryStrategy_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_connection_request_ConnectionRetryStrategy_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - - static { - java.lang.String[] descriptorData = { - "\n\030connection_request.proto\022\022connection_r" - + "equest\")\n\013AddressInfo\022\014\n\004host\030\001 \001(\t\022\014\n\004p" - + "ort\030\002 \001(\r\"8\n\022AuthenticationInfo\022\020\n\010passw" - + "ord\030\001 \001(\t\022\020\n\010username\030\002 \001(\t\"\312\003\n\021Connecti" - + "onRequest\0222\n\taddresses\030\001 \003(\0132\037.connectio" - + "n_request.AddressInfo\022-\n\010tls_mode\030\002 \001(\0162" - + "\033.connection_request.TlsMode\022\034\n\024cluster_" - + "mode_enabled\030\003 \001(\010\022\030\n\020response_timeout\030\004" - + " \001(\r\022\037\n\027client_creation_timeout\030\005 \001(\r\022O\n" - + "\032read_from_replica_strategy\030\006 \001(\0162+.conn" - + "ection_request.ReadFromReplicaStrategy\022N" - + "\n\031connection_retry_strategy\030\007 \001(\0132+.conn" - + "ection_request.ConnectionRetryStrategy\022C" - + "\n\023authentication_info\030\010 \001(\0132&.connection" - + "_request.AuthenticationInfo\022\023\n\013database_" - + "id\030\t \001(\r\"[\n\027ConnectionRetryStrategy\022\031\n\021n" - + "umber_of_retries\030\001 \001(\r\022\016\n\006factor\030\002 \001(\r\022\025" - + "\n\rexponent_base\030\003 \001(\r*c\n\027ReadFromReplica" - + "Strategy\022\025\n\021AlwaysFromPrimary\020\000\022\016\n\nRound" - + "Robin\020\001\022\021\n\rLowestLatency\020\002\022\016\n\nAZAffinity" - + "\020\003*4\n\007TlsMode\022\t\n\005NoTls\020\000\022\r\n\tSecureTls\020\001\022" - + "\017\n\013InsecureTls\020\002b\006proto3" - }; - descriptor = - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); - internal_static_connection_request_AddressInfo_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_connection_request_AddressInfo_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_connection_request_AddressInfo_descriptor, - new java.lang.String[] { - "Host", "Port", - }); - internal_static_connection_request_AuthenticationInfo_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_connection_request_AuthenticationInfo_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_connection_request_AuthenticationInfo_descriptor, - new java.lang.String[] { - "Password", "Username", - }); - internal_static_connection_request_ConnectionRequest_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_connection_request_ConnectionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_connection_request_ConnectionRequest_descriptor, - new java.lang.String[] { - "Addresses", - "TlsMode", - "ClusterModeEnabled", - "ResponseTimeout", - "ClientCreationTimeout", - "ReadFromReplicaStrategy", - "ConnectionRetryStrategy", - "AuthenticationInfo", - "DatabaseId", - }); - internal_static_connection_request_ConnectionRetryStrategy_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_connection_request_ConnectionRetryStrategy_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_connection_request_ConnectionRetryStrategy_descriptor, - new java.lang.String[] { - "NumberOfRetries", "Factor", "ExponentBase", - }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/java/benchmarks/src/main/java/javababushka/client/RedisClient.java b/java/benchmarks/src/main/java/javababushka/client/RedisClient.java deleted file mode 100644 index 423f1a9992..0000000000 --- a/java/benchmarks/src/main/java/javababushka/client/RedisClient.java +++ /dev/null @@ -1,29 +0,0 @@ -package javababushka.client; - -public class RedisClient { - public static native void startSocketListenerExternal(RedisClient callback); - - public static native String startSocketListenerExternal() throws Exception; - - public static native Object valueFromPointer(long pointer); - - static { - System.loadLibrary("javababushka"); - } - - public String socketPath; - - public void startSocketListener(RedisClient client) { - client.startSocketListenerExternal(client); - } - - public void initCallback(String socketPath, String errorMessage) throws Exception { - if (errorMessage != null) { - throw new Exception("Failed to initialize the socket connection: " + errorMessage); - } else if (socketPath == null) { - throw new Exception("Received null as the socketPath"); - } else { - this.socketPath = socketPath; - } - } -} diff --git a/java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java b/java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java deleted file mode 100644 index 3b5022e1bb..0000000000 --- a/java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java +++ /dev/null @@ -1,6972 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: redis_request.proto - -package redis_request; - -public final class RedisRequestOuterClass { - private RedisRequestOuterClass() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - - /** Protobuf enum {@code redis_request.SimpleRoutes} */ - public enum SimpleRoutes implements com.google.protobuf.ProtocolMessageEnum { - /** AllNodes = 0; */ - AllNodes(0), - /** AllPrimaries = 1; */ - AllPrimaries(1), - /** Random = 2; */ - Random(2), - UNRECOGNIZED(-1), - ; - - /** AllNodes = 0; */ - public static final int AllNodes_VALUE = 0; - - /** AllPrimaries = 1; */ - public static final int AllPrimaries_VALUE = 1; - - /** Random = 2; */ - public static final int Random_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static SimpleRoutes valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static SimpleRoutes forNumber(int value) { - switch (value) { - case 0: - return AllNodes; - case 1: - return AllPrimaries; - case 2: - return Random; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public SimpleRoutes findValueByNumber(int number) { - return SimpleRoutes.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } - - private static final SimpleRoutes[] VALUES = values(); - - public static SimpleRoutes valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private SimpleRoutes(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:redis_request.SimpleRoutes) - } - - /** Protobuf enum {@code redis_request.SlotTypes} */ - public enum SlotTypes implements com.google.protobuf.ProtocolMessageEnum { - /** Primary = 0; */ - Primary(0), - /** Replica = 1; */ - Replica(1), - UNRECOGNIZED(-1), - ; - - /** Primary = 0; */ - public static final int Primary_VALUE = 0; - - /** Replica = 1; */ - public static final int Replica_VALUE = 1; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static SlotTypes valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static SlotTypes forNumber(int value) { - switch (value) { - case 0: - return Primary; - case 1: - return Replica; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public SlotTypes findValueByNumber(int number) { - return SlotTypes.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.getDescriptor().getEnumTypes().get(1); - } - - private static final SlotTypes[] VALUES = values(); - - public static SlotTypes valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private SlotTypes(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:redis_request.SlotTypes) - } - - /** Protobuf enum {@code redis_request.RequestType} */ - public enum RequestType implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-     * / Invalid request type
-     * 
- * - * InvalidRequest = 0; - */ - InvalidRequest(0), - /** - * - * - *
-     * / An unknown command, where all arguments are defined by the user.
-     * 
- * - * CustomCommand = 1; - */ - CustomCommand(1), - /** - * - * - *
-     * / Type of a get string request.
-     * 
- * - * GetString = 2; - */ - GetString(2), - /** - * - * - *
-     * / Type of a set string request.
-     * 
- * - * SetString = 3; - */ - SetString(3), - /** Ping = 4; */ - Ping(4), - /** Info = 5; */ - Info(5), - /** Del = 6; */ - Del(6), - /** Select = 7; */ - Select(7), - /** ConfigGet = 8; */ - ConfigGet(8), - /** ConfigSet = 9; */ - ConfigSet(9), - /** ConfigResetStat = 10; */ - ConfigResetStat(10), - /** ConfigRewrite = 11; */ - ConfigRewrite(11), - /** ClientGetName = 12; */ - ClientGetName(12), - /** ClientGetRedir = 13; */ - ClientGetRedir(13), - /** ClientId = 14; */ - ClientId(14), - /** ClientInfo = 15; */ - ClientInfo(15), - /** ClientKill = 16; */ - ClientKill(16), - /** ClientList = 17; */ - ClientList(17), - /** ClientNoEvict = 18; */ - ClientNoEvict(18), - /** ClientNoTouch = 19; */ - ClientNoTouch(19), - /** ClientPause = 20; */ - ClientPause(20), - /** ClientReply = 21; */ - ClientReply(21), - /** ClientSetInfo = 22; */ - ClientSetInfo(22), - /** ClientSetName = 23; */ - ClientSetName(23), - /** ClientUnblock = 24; */ - ClientUnblock(24), - /** ClientUnpause = 25; */ - ClientUnpause(25), - /** Expire = 26; */ - Expire(26), - /** HashSet = 27; */ - HashSet(27), - /** HashGet = 28; */ - HashGet(28), - /** HashDel = 29; */ - HashDel(29), - /** HashExists = 30; */ - HashExists(30), - /** MGet = 31; */ - MGet(31), - /** MSet = 32; */ - MSet(32), - /** Incr = 33; */ - Incr(33), - /** IncrBy = 34; */ - IncrBy(34), - /** Decr = 35; */ - Decr(35), - /** IncrByFloat = 36; */ - IncrByFloat(36), - /** DecrBy = 37; */ - DecrBy(37), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-     * / Invalid request type
-     * 
- * - * InvalidRequest = 0; - */ - public static final int InvalidRequest_VALUE = 0; - - /** - * - * - *
-     * / An unknown command, where all arguments are defined by the user.
-     * 
- * - * CustomCommand = 1; - */ - public static final int CustomCommand_VALUE = 1; - - /** - * - * - *
-     * / Type of a get string request.
-     * 
- * - * GetString = 2; - */ - public static final int GetString_VALUE = 2; - - /** - * - * - *
-     * / Type of a set string request.
-     * 
- * - * SetString = 3; - */ - public static final int SetString_VALUE = 3; - - /** Ping = 4; */ - public static final int Ping_VALUE = 4; - - /** Info = 5; */ - public static final int Info_VALUE = 5; - - /** Del = 6; */ - public static final int Del_VALUE = 6; - - /** Select = 7; */ - public static final int Select_VALUE = 7; - - /** ConfigGet = 8; */ - public static final int ConfigGet_VALUE = 8; - - /** ConfigSet = 9; */ - public static final int ConfigSet_VALUE = 9; - - /** ConfigResetStat = 10; */ - public static final int ConfigResetStat_VALUE = 10; - - /** ConfigRewrite = 11; */ - public static final int ConfigRewrite_VALUE = 11; - - /** ClientGetName = 12; */ - public static final int ClientGetName_VALUE = 12; - - /** ClientGetRedir = 13; */ - public static final int ClientGetRedir_VALUE = 13; - - /** ClientId = 14; */ - public static final int ClientId_VALUE = 14; - - /** ClientInfo = 15; */ - public static final int ClientInfo_VALUE = 15; - - /** ClientKill = 16; */ - public static final int ClientKill_VALUE = 16; - - /** ClientList = 17; */ - public static final int ClientList_VALUE = 17; - - /** ClientNoEvict = 18; */ - public static final int ClientNoEvict_VALUE = 18; - - /** ClientNoTouch = 19; */ - public static final int ClientNoTouch_VALUE = 19; - - /** ClientPause = 20; */ - public static final int ClientPause_VALUE = 20; - - /** ClientReply = 21; */ - public static final int ClientReply_VALUE = 21; - - /** ClientSetInfo = 22; */ - public static final int ClientSetInfo_VALUE = 22; - - /** ClientSetName = 23; */ - public static final int ClientSetName_VALUE = 23; - - /** ClientUnblock = 24; */ - public static final int ClientUnblock_VALUE = 24; - - /** ClientUnpause = 25; */ - public static final int ClientUnpause_VALUE = 25; - - /** Expire = 26; */ - public static final int Expire_VALUE = 26; - - /** HashSet = 27; */ - public static final int HashSet_VALUE = 27; - - /** HashGet = 28; */ - public static final int HashGet_VALUE = 28; - - /** HashDel = 29; */ - public static final int HashDel_VALUE = 29; - - /** HashExists = 30; */ - public static final int HashExists_VALUE = 30; - - /** MGet = 31; */ - public static final int MGet_VALUE = 31; - - /** MSet = 32; */ - public static final int MSet_VALUE = 32; - - /** Incr = 33; */ - public static final int Incr_VALUE = 33; - - /** IncrBy = 34; */ - public static final int IncrBy_VALUE = 34; - - /** Decr = 35; */ - public static final int Decr_VALUE = 35; - - /** IncrByFloat = 36; */ - public static final int IncrByFloat_VALUE = 36; - - /** DecrBy = 37; */ - public static final int DecrBy_VALUE = 37; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static RequestType valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestType forNumber(int value) { - switch (value) { - case 0: - return InvalidRequest; - case 1: - return CustomCommand; - case 2: - return GetString; - case 3: - return SetString; - case 4: - return Ping; - case 5: - return Info; - case 6: - return Del; - case 7: - return Select; - case 8: - return ConfigGet; - case 9: - return ConfigSet; - case 10: - return ConfigResetStat; - case 11: - return ConfigRewrite; - case 12: - return ClientGetName; - case 13: - return ClientGetRedir; - case 14: - return ClientId; - case 15: - return ClientInfo; - case 16: - return ClientKill; - case 17: - return ClientList; - case 18: - return ClientNoEvict; - case 19: - return ClientNoTouch; - case 20: - return ClientPause; - case 21: - return ClientReply; - case 22: - return ClientSetInfo; - case 23: - return ClientSetName; - case 24: - return ClientUnblock; - case 25: - return ClientUnpause; - case 26: - return Expire; - case 27: - return HashSet; - case 28: - return HashGet; - case 29: - return HashDel; - case 30: - return HashExists; - case 31: - return MGet; - case 32: - return MSet; - case 33: - return Incr; - case 34: - return IncrBy; - case 35: - return Decr; - case 36: - return IncrByFloat; - case 37: - return DecrBy; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestType findValueByNumber(int number) { - return RequestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.getDescriptor().getEnumTypes().get(2); - } - - private static final RequestType[] VALUES = values(); - - public static RequestType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private RequestType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:redis_request.RequestType) - } - - public interface SlotIdRouteOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.SlotIdRoute) - com.google.protobuf.MessageOrBuilder { - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - int getSlotTypeValue(); - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - redis_request.RedisRequestOuterClass.SlotTypes getSlotType(); - - /** - * int32 slot_id = 2; - * - * @return The slotId. - */ - int getSlotId(); - } - - /** Protobuf type {@code redis_request.SlotIdRoute} */ - public static final class SlotIdRoute extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.SlotIdRoute) - SlotIdRouteOrBuilder { - private static final long serialVersionUID = 0L; - - // Use SlotIdRoute.newBuilder() to construct. - private SlotIdRoute(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private SlotIdRoute() { - slotType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SlotIdRoute(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotIdRoute_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotIdRoute_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.SlotIdRoute.class, - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder.class); - } - - public static final int SLOT_TYPE_FIELD_NUMBER = 1; - private int slotType_ = 0; - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - @java.lang.Override - public int getSlotTypeValue() { - return slotType_; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotTypes getSlotType() { - redis_request.RedisRequestOuterClass.SlotTypes result = - redis_request.RedisRequestOuterClass.SlotTypes.forNumber(slotType_); - return result == null ? redis_request.RedisRequestOuterClass.SlotTypes.UNRECOGNIZED : result; - } - - public static final int SLOT_ID_FIELD_NUMBER = 2; - private int slotId_ = 0; - - /** - * int32 slot_id = 2; - * - * @return The slotId. - */ - @java.lang.Override - public int getSlotId() { - return slotId_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (slotType_ != redis_request.RedisRequestOuterClass.SlotTypes.Primary.getNumber()) { - output.writeEnum(1, slotType_); - } - if (slotId_ != 0) { - output.writeInt32(2, slotId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (slotType_ != redis_request.RedisRequestOuterClass.SlotTypes.Primary.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, slotType_); - } - if (slotId_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, slotId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.SlotIdRoute)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.SlotIdRoute other = - (redis_request.RedisRequestOuterClass.SlotIdRoute) obj; - - if (slotType_ != other.slotType_) return false; - if (getSlotId() != other.getSlotId()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + SLOT_TYPE_FIELD_NUMBER; - hash = (53 * hash) + slotType_; - hash = (37 * hash) + SLOT_ID_FIELD_NUMBER; - hash = (53 * hash) + getSlotId(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.SlotIdRoute prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.SlotIdRoute} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.SlotIdRoute) - redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotIdRoute_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotIdRoute_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.SlotIdRoute.class, - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.SlotIdRoute.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - slotType_ = 0; - slotId_ = 0; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotIdRoute_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute build() { - redis_request.RedisRequestOuterClass.SlotIdRoute result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute buildPartial() { - redis_request.RedisRequestOuterClass.SlotIdRoute result = - new redis_request.RedisRequestOuterClass.SlotIdRoute(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.SlotIdRoute result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.slotType_ = slotType_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.slotId_ = slotId_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.SlotIdRoute) { - return mergeFrom((redis_request.RedisRequestOuterClass.SlotIdRoute) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.SlotIdRoute other) { - if (other == redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance()) - return this; - if (other.slotType_ != 0) { - setSlotTypeValue(other.getSlotTypeValue()); - } - if (other.getSlotId() != 0) { - setSlotId(other.getSlotId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - slotType_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 16: - { - slotId_ = input.readInt32(); - bitField0_ |= 0x00000002; - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private int slotType_ = 0; - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - @java.lang.Override - public int getSlotTypeValue() { - return slotType_; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @param value The enum numeric value on the wire for slotType to set. - * @return This builder for chaining. - */ - public Builder setSlotTypeValue(int value) { - slotType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotTypes getSlotType() { - redis_request.RedisRequestOuterClass.SlotTypes result = - redis_request.RedisRequestOuterClass.SlotTypes.forNumber(slotType_); - return result == null - ? redis_request.RedisRequestOuterClass.SlotTypes.UNRECOGNIZED - : result; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @param value The slotType to set. - * @return This builder for chaining. - */ - public Builder setSlotType(redis_request.RedisRequestOuterClass.SlotTypes value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - slotType_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return This builder for chaining. - */ - public Builder clearSlotType() { - bitField0_ = (bitField0_ & ~0x00000001); - slotType_ = 0; - onChanged(); - return this; - } - - private int slotId_; - - /** - * int32 slot_id = 2; - * - * @return The slotId. - */ - @java.lang.Override - public int getSlotId() { - return slotId_; - } - - /** - * int32 slot_id = 2; - * - * @param value The slotId to set. - * @return This builder for chaining. - */ - public Builder setSlotId(int value) { - - slotId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * int32 slot_id = 2; - * - * @return This builder for chaining. - */ - public Builder clearSlotId() { - bitField0_ = (bitField0_ & ~0x00000002); - slotId_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.SlotIdRoute) - } - - // @@protoc_insertion_point(class_scope:redis_request.SlotIdRoute) - private static final redis_request.RedisRequestOuterClass.SlotIdRoute DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.SlotIdRoute(); - } - - public static redis_request.RedisRequestOuterClass.SlotIdRoute getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SlotIdRoute parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface SlotKeyRouteOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.SlotKeyRoute) - com.google.protobuf.MessageOrBuilder { - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - int getSlotTypeValue(); - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - redis_request.RedisRequestOuterClass.SlotTypes getSlotType(); - - /** - * string slot_key = 2; - * - * @return The slotKey. - */ - java.lang.String getSlotKey(); - - /** - * string slot_key = 2; - * - * @return The bytes for slotKey. - */ - com.google.protobuf.ByteString getSlotKeyBytes(); - } - - /** Protobuf type {@code redis_request.SlotKeyRoute} */ - public static final class SlotKeyRoute extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.SlotKeyRoute) - SlotKeyRouteOrBuilder { - private static final long serialVersionUID = 0L; - - // Use SlotKeyRoute.newBuilder() to construct. - private SlotKeyRoute(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private SlotKeyRoute() { - slotType_ = 0; - slotKey_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SlotKeyRoute(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotKeyRoute_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotKeyRoute_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.SlotKeyRoute.class, - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder.class); - } - - public static final int SLOT_TYPE_FIELD_NUMBER = 1; - private int slotType_ = 0; - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - @java.lang.Override - public int getSlotTypeValue() { - return slotType_; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotTypes getSlotType() { - redis_request.RedisRequestOuterClass.SlotTypes result = - redis_request.RedisRequestOuterClass.SlotTypes.forNumber(slotType_); - return result == null ? redis_request.RedisRequestOuterClass.SlotTypes.UNRECOGNIZED : result; - } - - public static final int SLOT_KEY_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private volatile java.lang.Object slotKey_ = ""; - - /** - * string slot_key = 2; - * - * @return The slotKey. - */ - @java.lang.Override - public java.lang.String getSlotKey() { - java.lang.Object ref = slotKey_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - slotKey_ = s; - return s; - } - } - - /** - * string slot_key = 2; - * - * @return The bytes for slotKey. - */ - @java.lang.Override - public com.google.protobuf.ByteString getSlotKeyBytes() { - java.lang.Object ref = slotKey_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - slotKey_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (slotType_ != redis_request.RedisRequestOuterClass.SlotTypes.Primary.getNumber()) { - output.writeEnum(1, slotType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(slotKey_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, slotKey_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (slotType_ != redis_request.RedisRequestOuterClass.SlotTypes.Primary.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, slotType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(slotKey_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, slotKey_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.SlotKeyRoute)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.SlotKeyRoute other = - (redis_request.RedisRequestOuterClass.SlotKeyRoute) obj; - - if (slotType_ != other.slotType_) return false; - if (!getSlotKey().equals(other.getSlotKey())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + SLOT_TYPE_FIELD_NUMBER; - hash = (53 * hash) + slotType_; - hash = (37 * hash) + SLOT_KEY_FIELD_NUMBER; - hash = (53 * hash) + getSlotKey().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.SlotKeyRoute prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.SlotKeyRoute} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.SlotKeyRoute) - redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotKeyRoute_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotKeyRoute_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.SlotKeyRoute.class, - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.SlotKeyRoute.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - slotType_ = 0; - slotKey_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_SlotKeyRoute_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute build() { - redis_request.RedisRequestOuterClass.SlotKeyRoute result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute buildPartial() { - redis_request.RedisRequestOuterClass.SlotKeyRoute result = - new redis_request.RedisRequestOuterClass.SlotKeyRoute(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.SlotKeyRoute result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.slotType_ = slotType_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.slotKey_ = slotKey_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.SlotKeyRoute) { - return mergeFrom((redis_request.RedisRequestOuterClass.SlotKeyRoute) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.SlotKeyRoute other) { - if (other == redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance()) - return this; - if (other.slotType_ != 0) { - setSlotTypeValue(other.getSlotTypeValue()); - } - if (!other.getSlotKey().isEmpty()) { - slotKey_ = other.slotKey_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - slotType_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: - { - slotKey_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private int slotType_ = 0; - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The enum numeric value on the wire for slotType. - */ - @java.lang.Override - public int getSlotTypeValue() { - return slotType_; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @param value The enum numeric value on the wire for slotType to set. - * @return This builder for chaining. - */ - public Builder setSlotTypeValue(int value) { - slotType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return The slotType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotTypes getSlotType() { - redis_request.RedisRequestOuterClass.SlotTypes result = - redis_request.RedisRequestOuterClass.SlotTypes.forNumber(slotType_); - return result == null - ? redis_request.RedisRequestOuterClass.SlotTypes.UNRECOGNIZED - : result; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @param value The slotType to set. - * @return This builder for chaining. - */ - public Builder setSlotType(redis_request.RedisRequestOuterClass.SlotTypes value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - slotType_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .redis_request.SlotTypes slot_type = 1; - * - * @return This builder for chaining. - */ - public Builder clearSlotType() { - bitField0_ = (bitField0_ & ~0x00000001); - slotType_ = 0; - onChanged(); - return this; - } - - private java.lang.Object slotKey_ = ""; - - /** - * string slot_key = 2; - * - * @return The slotKey. - */ - public java.lang.String getSlotKey() { - java.lang.Object ref = slotKey_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - slotKey_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string slot_key = 2; - * - * @return The bytes for slotKey. - */ - public com.google.protobuf.ByteString getSlotKeyBytes() { - java.lang.Object ref = slotKey_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - slotKey_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string slot_key = 2; - * - * @param value The slotKey to set. - * @return This builder for chaining. - */ - public Builder setSlotKey(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - slotKey_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * string slot_key = 2; - * - * @return This builder for chaining. - */ - public Builder clearSlotKey() { - slotKey_ = getDefaultInstance().getSlotKey(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - /** - * string slot_key = 2; - * - * @param value The bytes for slotKey to set. - * @return This builder for chaining. - */ - public Builder setSlotKeyBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - slotKey_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.SlotKeyRoute) - } - - // @@protoc_insertion_point(class_scope:redis_request.SlotKeyRoute) - private static final redis_request.RedisRequestOuterClass.SlotKeyRoute DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.SlotKeyRoute(); - } - - public static redis_request.RedisRequestOuterClass.SlotKeyRoute getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SlotKeyRoute parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface RoutesOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.Routes) - com.google.protobuf.MessageOrBuilder { - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return Whether the simpleRoutes field is set. - */ - boolean hasSimpleRoutes(); - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The enum numeric value on the wire for simpleRoutes. - */ - int getSimpleRoutesValue(); - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The simpleRoutes. - */ - redis_request.RedisRequestOuterClass.SimpleRoutes getSimpleRoutes(); - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return Whether the slotKeyRoute field is set. - */ - boolean hasSlotKeyRoute(); - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return The slotKeyRoute. - */ - redis_request.RedisRequestOuterClass.SlotKeyRoute getSlotKeyRoute(); - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder getSlotKeyRouteOrBuilder(); - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return Whether the slotIdRoute field is set. - */ - boolean hasSlotIdRoute(); - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return The slotIdRoute. - */ - redis_request.RedisRequestOuterClass.SlotIdRoute getSlotIdRoute(); - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder getSlotIdRouteOrBuilder(); - - redis_request.RedisRequestOuterClass.Routes.ValueCase getValueCase(); - } - - /** Protobuf type {@code redis_request.Routes} */ - public static final class Routes extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.Routes) - RoutesOrBuilder { - private static final long serialVersionUID = 0L; - - // Use Routes.newBuilder() to construct. - private Routes(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Routes() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Routes(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.internal_static_redis_request_Routes_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Routes_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Routes.class, - redis_request.RedisRequestOuterClass.Routes.Builder.class); - } - - private int valueCase_ = 0; - - @SuppressWarnings("serial") - private java.lang.Object value_; - - public enum ValueCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - SIMPLE_ROUTES(1), - SLOT_KEY_ROUTE(2), - SLOT_ID_ROUTE(3), - VALUE_NOT_SET(0); - private final int value; - - private ValueCase(int value) { - this.value = value; - } - - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ValueCase valueOf(int value) { - return forNumber(value); - } - - public static ValueCase forNumber(int value) { - switch (value) { - case 1: - return SIMPLE_ROUTES; - case 2: - return SLOT_KEY_ROUTE; - case 3: - return SLOT_ID_ROUTE; - case 0: - return VALUE_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public ValueCase getValueCase() { - return ValueCase.forNumber(valueCase_); - } - - public static final int SIMPLE_ROUTES_FIELD_NUMBER = 1; - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return Whether the simpleRoutes field is set. - */ - public boolean hasSimpleRoutes() { - return valueCase_ == 1; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The enum numeric value on the wire for simpleRoutes. - */ - public int getSimpleRoutesValue() { - if (valueCase_ == 1) { - return (java.lang.Integer) value_; - } - return 0; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The simpleRoutes. - */ - public redis_request.RedisRequestOuterClass.SimpleRoutes getSimpleRoutes() { - if (valueCase_ == 1) { - redis_request.RedisRequestOuterClass.SimpleRoutes result = - redis_request.RedisRequestOuterClass.SimpleRoutes.forNumber((java.lang.Integer) value_); - return result == null - ? redis_request.RedisRequestOuterClass.SimpleRoutes.UNRECOGNIZED - : result; - } - return redis_request.RedisRequestOuterClass.SimpleRoutes.AllNodes; - } - - public static final int SLOT_KEY_ROUTE_FIELD_NUMBER = 2; - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return Whether the slotKeyRoute field is set. - */ - @java.lang.Override - public boolean hasSlotKeyRoute() { - return valueCase_ == 2; - } - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return The slotKeyRoute. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute getSlotKeyRoute() { - if (valueCase_ == 2) { - return (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder getSlotKeyRouteOrBuilder() { - if (valueCase_ == 2) { - return (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - - public static final int SLOT_ID_ROUTE_FIELD_NUMBER = 3; - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return Whether the slotIdRoute field is set. - */ - @java.lang.Override - public boolean hasSlotIdRoute() { - return valueCase_ == 3; - } - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return The slotIdRoute. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute getSlotIdRoute() { - if (valueCase_ == 3) { - return (redis_request.RedisRequestOuterClass.SlotIdRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder getSlotIdRouteOrBuilder() { - if (valueCase_ == 3) { - return (redis_request.RedisRequestOuterClass.SlotIdRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (valueCase_ == 1) { - output.writeEnum(1, ((java.lang.Integer) value_)); - } - if (valueCase_ == 2) { - output.writeMessage(2, (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_); - } - if (valueCase_ == 3) { - output.writeMessage(3, (redis_request.RedisRequestOuterClass.SlotIdRoute) value_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (valueCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeEnumSize(1, ((java.lang.Integer) value_)); - } - if (valueCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 2, (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_); - } - if (valueCase_ == 3) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 3, (redis_request.RedisRequestOuterClass.SlotIdRoute) value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.Routes)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.Routes other = - (redis_request.RedisRequestOuterClass.Routes) obj; - - if (!getValueCase().equals(other.getValueCase())) return false; - switch (valueCase_) { - case 1: - if (getSimpleRoutesValue() != other.getSimpleRoutesValue()) return false; - break; - case 2: - if (!getSlotKeyRoute().equals(other.getSlotKeyRoute())) return false; - break; - case 3: - if (!getSlotIdRoute().equals(other.getSlotIdRoute())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - switch (valueCase_) { - case 1: - hash = (37 * hash) + SIMPLE_ROUTES_FIELD_NUMBER; - hash = (53 * hash) + getSimpleRoutesValue(); - break; - case 2: - hash = (37 * hash) + SLOT_KEY_ROUTE_FIELD_NUMBER; - hash = (53 * hash) + getSlotKeyRoute().hashCode(); - break; - case 3: - hash = (37 * hash) + SLOT_ID_ROUTE_FIELD_NUMBER; - hash = (53 * hash) + getSlotIdRoute().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Routes parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Routes parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Routes parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.Routes prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.Routes} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.Routes) - redis_request.RedisRequestOuterClass.RoutesOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.internal_static_redis_request_Routes_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Routes_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Routes.class, - redis_request.RedisRequestOuterClass.Routes.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.Routes.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (slotKeyRouteBuilder_ != null) { - slotKeyRouteBuilder_.clear(); - } - if (slotIdRouteBuilder_ != null) { - slotIdRouteBuilder_.clear(); - } - valueCase_ = 0; - value_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass.internal_static_redis_request_Routes_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Routes getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.Routes.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Routes build() { - redis_request.RedisRequestOuterClass.Routes result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Routes buildPartial() { - redis_request.RedisRequestOuterClass.Routes result = - new redis_request.RedisRequestOuterClass.Routes(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - buildPartialOneofs(result); - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.Routes result) { - int from_bitField0_ = bitField0_; - } - - private void buildPartialOneofs(redis_request.RedisRequestOuterClass.Routes result) { - result.valueCase_ = valueCase_; - result.value_ = this.value_; - if (valueCase_ == 2 && slotKeyRouteBuilder_ != null) { - result.value_ = slotKeyRouteBuilder_.build(); - } - if (valueCase_ == 3 && slotIdRouteBuilder_ != null) { - result.value_ = slotIdRouteBuilder_.build(); - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.Routes) { - return mergeFrom((redis_request.RedisRequestOuterClass.Routes) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.Routes other) { - if (other == redis_request.RedisRequestOuterClass.Routes.getDefaultInstance()) return this; - switch (other.getValueCase()) { - case SIMPLE_ROUTES: - { - setSimpleRoutesValue(other.getSimpleRoutesValue()); - break; - } - case SLOT_KEY_ROUTE: - { - mergeSlotKeyRoute(other.getSlotKeyRoute()); - break; - } - case SLOT_ID_ROUTE: - { - mergeSlotIdRoute(other.getSlotIdRoute()); - break; - } - case VALUE_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - int rawValue = input.readEnum(); - valueCase_ = 1; - value_ = rawValue; - break; - } // case 8 - case 18: - { - input.readMessage(getSlotKeyRouteFieldBuilder().getBuilder(), extensionRegistry); - valueCase_ = 2; - break; - } // case 18 - case 26: - { - input.readMessage(getSlotIdRouteFieldBuilder().getBuilder(), extensionRegistry); - valueCase_ = 3; - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int valueCase_ = 0; - private java.lang.Object value_; - - public ValueCase getValueCase() { - return ValueCase.forNumber(valueCase_); - } - - public Builder clearValue() { - valueCase_ = 0; - value_ = null; - onChanged(); - return this; - } - - private int bitField0_; - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return Whether the simpleRoutes field is set. - */ - @java.lang.Override - public boolean hasSimpleRoutes() { - return valueCase_ == 1; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The enum numeric value on the wire for simpleRoutes. - */ - @java.lang.Override - public int getSimpleRoutesValue() { - if (valueCase_ == 1) { - return ((java.lang.Integer) value_).intValue(); - } - return 0; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @param value The enum numeric value on the wire for simpleRoutes to set. - * @return This builder for chaining. - */ - public Builder setSimpleRoutesValue(int value) { - valueCase_ = 1; - value_ = value; - onChanged(); - return this; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return The simpleRoutes. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SimpleRoutes getSimpleRoutes() { - if (valueCase_ == 1) { - redis_request.RedisRequestOuterClass.SimpleRoutes result = - redis_request.RedisRequestOuterClass.SimpleRoutes.forNumber( - (java.lang.Integer) value_); - return result == null - ? redis_request.RedisRequestOuterClass.SimpleRoutes.UNRECOGNIZED - : result; - } - return redis_request.RedisRequestOuterClass.SimpleRoutes.AllNodes; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @param value The simpleRoutes to set. - * @return This builder for chaining. - */ - public Builder setSimpleRoutes(redis_request.RedisRequestOuterClass.SimpleRoutes value) { - if (value == null) { - throw new NullPointerException(); - } - valueCase_ = 1; - value_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .redis_request.SimpleRoutes simple_routes = 1; - * - * @return This builder for chaining. - */ - public Builder clearSimpleRoutes() { - if (valueCase_ == 1) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotKeyRoute, - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder, - redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder> - slotKeyRouteBuilder_; - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return Whether the slotKeyRoute field is set. - */ - @java.lang.Override - public boolean hasSlotKeyRoute() { - return valueCase_ == 2; - } - - /** - * .redis_request.SlotKeyRoute slot_key_route = 2; - * - * @return The slotKeyRoute. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRoute getSlotKeyRoute() { - if (slotKeyRouteBuilder_ == null) { - if (valueCase_ == 2) { - return (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } else { - if (valueCase_ == 2) { - return slotKeyRouteBuilder_.getMessage(); - } - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - public Builder setSlotKeyRoute(redis_request.RedisRequestOuterClass.SlotKeyRoute value) { - if (slotKeyRouteBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - value_ = value; - onChanged(); - } else { - slotKeyRouteBuilder_.setMessage(value); - } - valueCase_ = 2; - return this; - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - public Builder setSlotKeyRoute( - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder builderForValue) { - if (slotKeyRouteBuilder_ == null) { - value_ = builderForValue.build(); - onChanged(); - } else { - slotKeyRouteBuilder_.setMessage(builderForValue.build()); - } - valueCase_ = 2; - return this; - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - public Builder mergeSlotKeyRoute(redis_request.RedisRequestOuterClass.SlotKeyRoute value) { - if (slotKeyRouteBuilder_ == null) { - if (valueCase_ == 2 - && value_ != redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance()) { - value_ = - redis_request.RedisRequestOuterClass.SlotKeyRoute.newBuilder( - (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_) - .mergeFrom(value) - .buildPartial(); - } else { - value_ = value; - } - onChanged(); - } else { - if (valueCase_ == 2) { - slotKeyRouteBuilder_.mergeFrom(value); - } else { - slotKeyRouteBuilder_.setMessage(value); - } - } - valueCase_ = 2; - return this; - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - public Builder clearSlotKeyRoute() { - if (slotKeyRouteBuilder_ == null) { - if (valueCase_ == 2) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - } else { - if (valueCase_ == 2) { - valueCase_ = 0; - value_ = null; - } - slotKeyRouteBuilder_.clear(); - } - return this; - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - public redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder getSlotKeyRouteBuilder() { - return getSlotKeyRouteFieldBuilder().getBuilder(); - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder getSlotKeyRouteOrBuilder() { - if ((valueCase_ == 2) && (slotKeyRouteBuilder_ != null)) { - return slotKeyRouteBuilder_.getMessageOrBuilder(); - } else { - if (valueCase_ == 2) { - return (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - } - - /** .redis_request.SlotKeyRoute slot_key_route = 2; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotKeyRoute, - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder, - redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder> - getSlotKeyRouteFieldBuilder() { - if (slotKeyRouteBuilder_ == null) { - if (!(valueCase_ == 2)) { - value_ = redis_request.RedisRequestOuterClass.SlotKeyRoute.getDefaultInstance(); - } - slotKeyRouteBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotKeyRoute, - redis_request.RedisRequestOuterClass.SlotKeyRoute.Builder, - redis_request.RedisRequestOuterClass.SlotKeyRouteOrBuilder>( - (redis_request.RedisRequestOuterClass.SlotKeyRoute) value_, - getParentForChildren(), - isClean()); - value_ = null; - } - valueCase_ = 2; - onChanged(); - return slotKeyRouteBuilder_; - } - - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotIdRoute, - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder, - redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder> - slotIdRouteBuilder_; - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return Whether the slotIdRoute field is set. - */ - @java.lang.Override - public boolean hasSlotIdRoute() { - return valueCase_ == 3; - } - - /** - * .redis_request.SlotIdRoute slot_id_route = 3; - * - * @return The slotIdRoute. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRoute getSlotIdRoute() { - if (slotIdRouteBuilder_ == null) { - if (valueCase_ == 3) { - return (redis_request.RedisRequestOuterClass.SlotIdRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } else { - if (valueCase_ == 3) { - return slotIdRouteBuilder_.getMessage(); - } - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - public Builder setSlotIdRoute(redis_request.RedisRequestOuterClass.SlotIdRoute value) { - if (slotIdRouteBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - value_ = value; - onChanged(); - } else { - slotIdRouteBuilder_.setMessage(value); - } - valueCase_ = 3; - return this; - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - public Builder setSlotIdRoute( - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder builderForValue) { - if (slotIdRouteBuilder_ == null) { - value_ = builderForValue.build(); - onChanged(); - } else { - slotIdRouteBuilder_.setMessage(builderForValue.build()); - } - valueCase_ = 3; - return this; - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - public Builder mergeSlotIdRoute(redis_request.RedisRequestOuterClass.SlotIdRoute value) { - if (slotIdRouteBuilder_ == null) { - if (valueCase_ == 3 - && value_ != redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance()) { - value_ = - redis_request.RedisRequestOuterClass.SlotIdRoute.newBuilder( - (redis_request.RedisRequestOuterClass.SlotIdRoute) value_) - .mergeFrom(value) - .buildPartial(); - } else { - value_ = value; - } - onChanged(); - } else { - if (valueCase_ == 3) { - slotIdRouteBuilder_.mergeFrom(value); - } else { - slotIdRouteBuilder_.setMessage(value); - } - } - valueCase_ = 3; - return this; - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - public Builder clearSlotIdRoute() { - if (slotIdRouteBuilder_ == null) { - if (valueCase_ == 3) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - } else { - if (valueCase_ == 3) { - valueCase_ = 0; - value_ = null; - } - slotIdRouteBuilder_.clear(); - } - return this; - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - public redis_request.RedisRequestOuterClass.SlotIdRoute.Builder getSlotIdRouteBuilder() { - return getSlotIdRouteFieldBuilder().getBuilder(); - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder getSlotIdRouteOrBuilder() { - if ((valueCase_ == 3) && (slotIdRouteBuilder_ != null)) { - return slotIdRouteBuilder_.getMessageOrBuilder(); - } else { - if (valueCase_ == 3) { - return (redis_request.RedisRequestOuterClass.SlotIdRoute) value_; - } - return redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - } - - /** .redis_request.SlotIdRoute slot_id_route = 3; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotIdRoute, - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder, - redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder> - getSlotIdRouteFieldBuilder() { - if (slotIdRouteBuilder_ == null) { - if (!(valueCase_ == 3)) { - value_ = redis_request.RedisRequestOuterClass.SlotIdRoute.getDefaultInstance(); - } - slotIdRouteBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.SlotIdRoute, - redis_request.RedisRequestOuterClass.SlotIdRoute.Builder, - redis_request.RedisRequestOuterClass.SlotIdRouteOrBuilder>( - (redis_request.RedisRequestOuterClass.SlotIdRoute) value_, - getParentForChildren(), - isClean()); - value_ = null; - } - valueCase_ = 3; - onChanged(); - return slotIdRouteBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.Routes) - } - - // @@protoc_insertion_point(class_scope:redis_request.Routes) - private static final redis_request.RedisRequestOuterClass.Routes DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.Routes(); - } - - public static redis_request.RedisRequestOuterClass.Routes getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Routes parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Routes getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface CommandOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.Command) - com.google.protobuf.MessageOrBuilder { - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The enum numeric value on the wire for requestType. - */ - int getRequestTypeValue(); - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The requestType. - */ - redis_request.RedisRequestOuterClass.RequestType getRequestType(); - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return Whether the argsArray field is set. - */ - boolean hasArgsArray(); - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return The argsArray. - */ - redis_request.RedisRequestOuterClass.Command.ArgsArray getArgsArray(); - - /** .redis_request.Command.ArgsArray args_array = 2; */ - redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder getArgsArrayOrBuilder(); - - /** - * uint64 args_vec_pointer = 3; - * - * @return Whether the argsVecPointer field is set. - */ - boolean hasArgsVecPointer(); - - /** - * uint64 args_vec_pointer = 3; - * - * @return The argsVecPointer. - */ - long getArgsVecPointer(); - - redis_request.RedisRequestOuterClass.Command.ArgsCase getArgsCase(); - } - - /** Protobuf type {@code redis_request.Command} */ - public static final class Command extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.Command) - CommandOrBuilder { - private static final long serialVersionUID = 0L; - - // Use Command.newBuilder() to construct. - private Command(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Command() { - requestType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Command(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass.internal_static_redis_request_Command_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Command.class, - redis_request.RedisRequestOuterClass.Command.Builder.class); - } - - public interface ArgsArrayOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.Command.ArgsArray) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated string args = 1; - * - * @return A list containing the args. - */ - java.util.List getArgsList(); - - /** - * repeated string args = 1; - * - * @return The count of args. - */ - int getArgsCount(); - - /** - * repeated string args = 1; - * - * @param index The index of the element to return. - * @return The args at the given index. - */ - java.lang.String getArgs(int index); - - /** - * repeated string args = 1; - * - * @param index The index of the value to return. - * @return The bytes of the args at the given index. - */ - com.google.protobuf.ByteString getArgsBytes(int index); - } - - /** Protobuf type {@code redis_request.Command.ArgsArray} */ - public static final class ArgsArray extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.Command.ArgsArray) - ArgsArrayOrBuilder { - private static final long serialVersionUID = 0L; - - // Use ArgsArray.newBuilder() to construct. - private ArgsArray(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ArgsArray() { - args_ = com.google.protobuf.LazyStringArrayList.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ArgsArray(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_ArgsArray_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_ArgsArray_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Command.ArgsArray.class, - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder.class); - } - - public static final int ARGS_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private com.google.protobuf.LazyStringArrayList args_ = - com.google.protobuf.LazyStringArrayList.emptyList(); - - /** - * repeated string args = 1; - * - * @return A list containing the args. - */ - public com.google.protobuf.ProtocolStringList getArgsList() { - return args_; - } - - /** - * repeated string args = 1; - * - * @return The count of args. - */ - public int getArgsCount() { - return args_.size(); - } - - /** - * repeated string args = 1; - * - * @param index The index of the element to return. - * @return The args at the given index. - */ - public java.lang.String getArgs(int index) { - return args_.get(index); - } - - /** - * repeated string args = 1; - * - * @param index The index of the value to return. - * @return The bytes of the args at the given index. - */ - public com.google.protobuf.ByteString getArgsBytes(int index) { - return args_.getByteString(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < args_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, args_.getRaw(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < args_.size(); i++) { - dataSize += computeStringSizeNoTag(args_.getRaw(i)); - } - size += dataSize; - size += 1 * getArgsList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.Command.ArgsArray)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.Command.ArgsArray other = - (redis_request.RedisRequestOuterClass.Command.ArgsArray) obj; - - if (!getArgsList().equals(other.getArgsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getArgsCount() > 0) { - hash = (37 * hash) + ARGS_FIELD_NUMBER; - hash = (53 * hash) + getArgsList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - redis_request.RedisRequestOuterClass.Command.ArgsArray prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.Command.ArgsArray} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.Command.ArgsArray) - redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_ArgsArray_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_ArgsArray_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Command.ArgsArray.class, - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.Command.ArgsArray.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - args_ = com.google.protobuf.LazyStringArrayList.emptyList(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_ArgsArray_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray build() { - redis_request.RedisRequestOuterClass.Command.ArgsArray result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray buildPartial() { - redis_request.RedisRequestOuterClass.Command.ArgsArray result = - new redis_request.RedisRequestOuterClass.Command.ArgsArray(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.Command.ArgsArray result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - args_.makeImmutable(); - result.args_ = args_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.Command.ArgsArray) { - return mergeFrom((redis_request.RedisRequestOuterClass.Command.ArgsArray) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.Command.ArgsArray other) { - if (other == redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance()) - return this; - if (!other.args_.isEmpty()) { - if (args_.isEmpty()) { - args_ = other.args_; - bitField0_ |= 0x00000001; - } else { - ensureArgsIsMutable(); - args_.addAll(other.args_); - } - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - ensureArgsIsMutable(); - args_.add(s); - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private com.google.protobuf.LazyStringArrayList args_ = - com.google.protobuf.LazyStringArrayList.emptyList(); - - private void ensureArgsIsMutable() { - if (!args_.isModifiable()) { - args_ = new com.google.protobuf.LazyStringArrayList(args_); - } - bitField0_ |= 0x00000001; - } - - /** - * repeated string args = 1; - * - * @return A list containing the args. - */ - public com.google.protobuf.ProtocolStringList getArgsList() { - args_.makeImmutable(); - return args_; - } - - /** - * repeated string args = 1; - * - * @return The count of args. - */ - public int getArgsCount() { - return args_.size(); - } - - /** - * repeated string args = 1; - * - * @param index The index of the element to return. - * @return The args at the given index. - */ - public java.lang.String getArgs(int index) { - return args_.get(index); - } - - /** - * repeated string args = 1; - * - * @param index The index of the value to return. - * @return The bytes of the args at the given index. - */ - public com.google.protobuf.ByteString getArgsBytes(int index) { - return args_.getByteString(index); - } - - /** - * repeated string args = 1; - * - * @param index The index to set the value at. - * @param value The args to set. - * @return This builder for chaining. - */ - public Builder setArgs(int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureArgsIsMutable(); - args_.set(index, value); - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * repeated string args = 1; - * - * @param value The args to add. - * @return This builder for chaining. - */ - public Builder addArgs(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureArgsIsMutable(); - args_.add(value); - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * repeated string args = 1; - * - * @param values The args to add. - * @return This builder for chaining. - */ - public Builder addAllArgs(java.lang.Iterable values) { - ensureArgsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, args_); - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * repeated string args = 1; - * - * @return This builder for chaining. - */ - public Builder clearArgs() { - args_ = com.google.protobuf.LazyStringArrayList.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - ; - onChanged(); - return this; - } - - /** - * repeated string args = 1; - * - * @param value The bytes of the args to add. - * @return This builder for chaining. - */ - public Builder addArgsBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - ensureArgsIsMutable(); - args_.add(value); - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.Command.ArgsArray) - } - - // @@protoc_insertion_point(class_scope:redis_request.Command.ArgsArray) - private static final redis_request.RedisRequestOuterClass.Command.ArgsArray DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.Command.ArgsArray(); - } - - public static redis_request.RedisRequestOuterClass.Command.ArgsArray getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ArgsArray parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private int argsCase_ = 0; - - @SuppressWarnings("serial") - private java.lang.Object args_; - - public enum ArgsCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - ARGS_ARRAY(2), - ARGS_VEC_POINTER(3), - ARGS_NOT_SET(0); - private final int value; - - private ArgsCase(int value) { - this.value = value; - } - - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ArgsCase valueOf(int value) { - return forNumber(value); - } - - public static ArgsCase forNumber(int value) { - switch (value) { - case 2: - return ARGS_ARRAY; - case 3: - return ARGS_VEC_POINTER; - case 0: - return ARGS_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public ArgsCase getArgsCase() { - return ArgsCase.forNumber(argsCase_); - } - - public static final int REQUEST_TYPE_FIELD_NUMBER = 1; - private int requestType_ = 0; - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The requestType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.RequestType getRequestType() { - redis_request.RedisRequestOuterClass.RequestType result = - redis_request.RedisRequestOuterClass.RequestType.forNumber(requestType_); - return result == null - ? redis_request.RedisRequestOuterClass.RequestType.UNRECOGNIZED - : result; - } - - public static final int ARGS_ARRAY_FIELD_NUMBER = 2; - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return Whether the argsArray field is set. - */ - @java.lang.Override - public boolean hasArgsArray() { - return argsCase_ == 2; - } - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return The argsArray. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray getArgsArray() { - if (argsCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_; - } - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder getArgsArrayOrBuilder() { - if (argsCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_; - } - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - - public static final int ARGS_VEC_POINTER_FIELD_NUMBER = 3; - - /** - * uint64 args_vec_pointer = 3; - * - * @return Whether the argsVecPointer field is set. - */ - @java.lang.Override - public boolean hasArgsVecPointer() { - return argsCase_ == 3; - } - - /** - * uint64 args_vec_pointer = 3; - * - * @return The argsVecPointer. - */ - @java.lang.Override - public long getArgsVecPointer() { - if (argsCase_ == 3) { - return (java.lang.Long) args_; - } - return 0L; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (requestType_ - != redis_request.RedisRequestOuterClass.RequestType.InvalidRequest.getNumber()) { - output.writeEnum(1, requestType_); - } - if (argsCase_ == 2) { - output.writeMessage(2, (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_); - } - if (argsCase_ == 3) { - output.writeUInt64(3, (long) ((java.lang.Long) args_)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (requestType_ - != redis_request.RedisRequestOuterClass.RequestType.InvalidRequest.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, requestType_); - } - if (argsCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 2, (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_); - } - if (argsCase_ == 3) { - size += - com.google.protobuf.CodedOutputStream.computeUInt64Size( - 3, (long) ((java.lang.Long) args_)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.Command)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.Command other = - (redis_request.RedisRequestOuterClass.Command) obj; - - if (requestType_ != other.requestType_) return false; - if (!getArgsCase().equals(other.getArgsCase())) return false; - switch (argsCase_) { - case 2: - if (!getArgsArray().equals(other.getArgsArray())) return false; - break; - case 3: - if (getArgsVecPointer() != other.getArgsVecPointer()) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + REQUEST_TYPE_FIELD_NUMBER; - hash = (53 * hash) + requestType_; - switch (argsCase_) { - case 2: - hash = (37 * hash) + ARGS_ARRAY_FIELD_NUMBER; - hash = (53 * hash) + getArgsArray().hashCode(); - break; - case 3: - hash = (37 * hash) + ARGS_VEC_POINTER_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getArgsVecPointer()); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Command parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.Command prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.Command} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.Command) - redis_request.RedisRequestOuterClass.CommandOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Command.class, - redis_request.RedisRequestOuterClass.Command.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.Command.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - requestType_ = 0; - if (argsArrayBuilder_ != null) { - argsArrayBuilder_.clear(); - } - argsCase_ = 0; - args_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Command_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command build() { - redis_request.RedisRequestOuterClass.Command result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command buildPartial() { - redis_request.RedisRequestOuterClass.Command result = - new redis_request.RedisRequestOuterClass.Command(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - buildPartialOneofs(result); - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.Command result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.requestType_ = requestType_; - } - } - - private void buildPartialOneofs(redis_request.RedisRequestOuterClass.Command result) { - result.argsCase_ = argsCase_; - result.args_ = this.args_; - if (argsCase_ == 2 && argsArrayBuilder_ != null) { - result.args_ = argsArrayBuilder_.build(); - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.Command) { - return mergeFrom((redis_request.RedisRequestOuterClass.Command) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.Command other) { - if (other == redis_request.RedisRequestOuterClass.Command.getDefaultInstance()) return this; - if (other.requestType_ != 0) { - setRequestTypeValue(other.getRequestTypeValue()); - } - switch (other.getArgsCase()) { - case ARGS_ARRAY: - { - mergeArgsArray(other.getArgsArray()); - break; - } - case ARGS_VEC_POINTER: - { - setArgsVecPointer(other.getArgsVecPointer()); - break; - } - case ARGS_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - requestType_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: - { - input.readMessage(getArgsArrayFieldBuilder().getBuilder(), extensionRegistry); - argsCase_ = 2; - break; - } // case 18 - case 24: - { - args_ = input.readUInt64(); - argsCase_ = 3; - break; - } // case 24 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int argsCase_ = 0; - private java.lang.Object args_; - - public ArgsCase getArgsCase() { - return ArgsCase.forNumber(argsCase_); - } - - public Builder clearArgs() { - argsCase_ = 0; - args_ = null; - onChanged(); - return this; - } - - private int bitField0_; - - private int requestType_ = 0; - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } - - /** - * .redis_request.RequestType request_type = 1; - * - * @param value The enum numeric value on the wire for requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestTypeValue(int value) { - requestType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * .redis_request.RequestType request_type = 1; - * - * @return The requestType. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.RequestType getRequestType() { - redis_request.RedisRequestOuterClass.RequestType result = - redis_request.RedisRequestOuterClass.RequestType.forNumber(requestType_); - return result == null - ? redis_request.RedisRequestOuterClass.RequestType.UNRECOGNIZED - : result; - } - - /** - * .redis_request.RequestType request_type = 1; - * - * @param value The requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestType(redis_request.RedisRequestOuterClass.RequestType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - requestType_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .redis_request.RequestType request_type = 1; - * - * @return This builder for chaining. - */ - public Builder clearRequestType() { - bitField0_ = (bitField0_ & ~0x00000001); - requestType_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command.ArgsArray, - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder, - redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder> - argsArrayBuilder_; - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return Whether the argsArray field is set. - */ - @java.lang.Override - public boolean hasArgsArray() { - return argsCase_ == 2; - } - - /** - * .redis_request.Command.ArgsArray args_array = 2; - * - * @return The argsArray. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArray getArgsArray() { - if (argsArrayBuilder_ == null) { - if (argsCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_; - } - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } else { - if (argsCase_ == 2) { - return argsArrayBuilder_.getMessage(); - } - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - public Builder setArgsArray(redis_request.RedisRequestOuterClass.Command.ArgsArray value) { - if (argsArrayBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - args_ = value; - onChanged(); - } else { - argsArrayBuilder_.setMessage(value); - } - argsCase_ = 2; - return this; - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - public Builder setArgsArray( - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder builderForValue) { - if (argsArrayBuilder_ == null) { - args_ = builderForValue.build(); - onChanged(); - } else { - argsArrayBuilder_.setMessage(builderForValue.build()); - } - argsCase_ = 2; - return this; - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - public Builder mergeArgsArray(redis_request.RedisRequestOuterClass.Command.ArgsArray value) { - if (argsArrayBuilder_ == null) { - if (argsCase_ == 2 - && args_ - != redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance()) { - args_ = - redis_request.RedisRequestOuterClass.Command.ArgsArray.newBuilder( - (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_) - .mergeFrom(value) - .buildPartial(); - } else { - args_ = value; - } - onChanged(); - } else { - if (argsCase_ == 2) { - argsArrayBuilder_.mergeFrom(value); - } else { - argsArrayBuilder_.setMessage(value); - } - } - argsCase_ = 2; - return this; - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - public Builder clearArgsArray() { - if (argsArrayBuilder_ == null) { - if (argsCase_ == 2) { - argsCase_ = 0; - args_ = null; - onChanged(); - } - } else { - if (argsCase_ == 2) { - argsCase_ = 0; - args_ = null; - } - argsArrayBuilder_.clear(); - } - return this; - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - public redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder getArgsArrayBuilder() { - return getArgsArrayFieldBuilder().getBuilder(); - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder - getArgsArrayOrBuilder() { - if ((argsCase_ == 2) && (argsArrayBuilder_ != null)) { - return argsArrayBuilder_.getMessageOrBuilder(); - } else { - if (argsCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_; - } - return redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - } - - /** .redis_request.Command.ArgsArray args_array = 2; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command.ArgsArray, - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder, - redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder> - getArgsArrayFieldBuilder() { - if (argsArrayBuilder_ == null) { - if (!(argsCase_ == 2)) { - args_ = redis_request.RedisRequestOuterClass.Command.ArgsArray.getDefaultInstance(); - } - argsArrayBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command.ArgsArray, - redis_request.RedisRequestOuterClass.Command.ArgsArray.Builder, - redis_request.RedisRequestOuterClass.Command.ArgsArrayOrBuilder>( - (redis_request.RedisRequestOuterClass.Command.ArgsArray) args_, - getParentForChildren(), - isClean()); - args_ = null; - } - argsCase_ = 2; - onChanged(); - return argsArrayBuilder_; - } - - /** - * uint64 args_vec_pointer = 3; - * - * @return Whether the argsVecPointer field is set. - */ - public boolean hasArgsVecPointer() { - return argsCase_ == 3; - } - - /** - * uint64 args_vec_pointer = 3; - * - * @return The argsVecPointer. - */ - public long getArgsVecPointer() { - if (argsCase_ == 3) { - return (java.lang.Long) args_; - } - return 0L; - } - - /** - * uint64 args_vec_pointer = 3; - * - * @param value The argsVecPointer to set. - * @return This builder for chaining. - */ - public Builder setArgsVecPointer(long value) { - - argsCase_ = 3; - args_ = value; - onChanged(); - return this; - } - - /** - * uint64 args_vec_pointer = 3; - * - * @return This builder for chaining. - */ - public Builder clearArgsVecPointer() { - if (argsCase_ == 3) { - argsCase_ = 0; - args_ = null; - onChanged(); - } - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.Command) - } - - // @@protoc_insertion_point(class_scope:redis_request.Command) - private static final redis_request.RedisRequestOuterClass.Command DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.Command(); - } - - public static redis_request.RedisRequestOuterClass.Command getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Command parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface TransactionOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.Transaction) - com.google.protobuf.MessageOrBuilder { - - /** repeated .redis_request.Command commands = 1; */ - java.util.List getCommandsList(); - - /** repeated .redis_request.Command commands = 1; */ - redis_request.RedisRequestOuterClass.Command getCommands(int index); - - /** repeated .redis_request.Command commands = 1; */ - int getCommandsCount(); - - /** repeated .redis_request.Command commands = 1; */ - java.util.List - getCommandsOrBuilderList(); - - /** repeated .redis_request.Command commands = 1; */ - redis_request.RedisRequestOuterClass.CommandOrBuilder getCommandsOrBuilder(int index); - } - - /** Protobuf type {@code redis_request.Transaction} */ - public static final class Transaction extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.Transaction) - TransactionOrBuilder { - private static final long serialVersionUID = 0L; - - // Use Transaction.newBuilder() to construct. - private Transaction(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Transaction() { - commands_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Transaction(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Transaction_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Transaction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Transaction.class, - redis_request.RedisRequestOuterClass.Transaction.Builder.class); - } - - public static final int COMMANDS_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private java.util.List commands_; - - /** repeated .redis_request.Command commands = 1; */ - @java.lang.Override - public java.util.List getCommandsList() { - return commands_; - } - - /** repeated .redis_request.Command commands = 1; */ - @java.lang.Override - public java.util.List - getCommandsOrBuilderList() { - return commands_; - } - - /** repeated .redis_request.Command commands = 1; */ - @java.lang.Override - public int getCommandsCount() { - return commands_.size(); - } - - /** repeated .redis_request.Command commands = 1; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command getCommands(int index) { - return commands_.get(index); - } - - /** repeated .redis_request.Command commands = 1; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.CommandOrBuilder getCommandsOrBuilder(int index) { - return commands_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < commands_.size(); i++) { - output.writeMessage(1, commands_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < commands_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, commands_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.Transaction)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.Transaction other = - (redis_request.RedisRequestOuterClass.Transaction) obj; - - if (!getCommandsList().equals(other.getCommandsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getCommandsCount() > 0) { - hash = (37 * hash) + COMMANDS_FIELD_NUMBER; - hash = (53 * hash) + getCommandsList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.Transaction parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.Transaction prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.Transaction} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.Transaction) - redis_request.RedisRequestOuterClass.TransactionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Transaction_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Transaction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.Transaction.class, - redis_request.RedisRequestOuterClass.Transaction.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.Transaction.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (commandsBuilder_ == null) { - commands_ = java.util.Collections.emptyList(); - } else { - commands_ = null; - commandsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_Transaction_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction build() { - redis_request.RedisRequestOuterClass.Transaction result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction buildPartial() { - redis_request.RedisRequestOuterClass.Transaction result = - new redis_request.RedisRequestOuterClass.Transaction(this); - buildPartialRepeatedFields(result); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartialRepeatedFields( - redis_request.RedisRequestOuterClass.Transaction result) { - if (commandsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - commands_ = java.util.Collections.unmodifiableList(commands_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.commands_ = commands_; - } else { - result.commands_ = commandsBuilder_.build(); - } - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.Transaction result) { - int from_bitField0_ = bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.Transaction) { - return mergeFrom((redis_request.RedisRequestOuterClass.Transaction) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.Transaction other) { - if (other == redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance()) - return this; - if (commandsBuilder_ == null) { - if (!other.commands_.isEmpty()) { - if (commands_.isEmpty()) { - commands_ = other.commands_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureCommandsIsMutable(); - commands_.addAll(other.commands_); - } - onChanged(); - } - } else { - if (!other.commands_.isEmpty()) { - if (commandsBuilder_.isEmpty()) { - commandsBuilder_.dispose(); - commandsBuilder_ = null; - commands_ = other.commands_; - bitField0_ = (bitField0_ & ~0x00000001); - commandsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getCommandsFieldBuilder() - : null; - } else { - commandsBuilder_.addAllMessages(other.commands_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - redis_request.RedisRequestOuterClass.Command m = - input.readMessage( - redis_request.RedisRequestOuterClass.Command.parser(), extensionRegistry); - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - commands_.add(m); - } else { - commandsBuilder_.addMessage(m); - } - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List commands_ = - java.util.Collections.emptyList(); - - private void ensureCommandsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - commands_ = - new java.util.ArrayList(commands_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder> - commandsBuilder_; - - /** repeated .redis_request.Command commands = 1; */ - public java.util.List getCommandsList() { - if (commandsBuilder_ == null) { - return java.util.Collections.unmodifiableList(commands_); - } else { - return commandsBuilder_.getMessageList(); - } - } - - /** repeated .redis_request.Command commands = 1; */ - public int getCommandsCount() { - if (commandsBuilder_ == null) { - return commands_.size(); - } else { - return commandsBuilder_.getCount(); - } - } - - /** repeated .redis_request.Command commands = 1; */ - public redis_request.RedisRequestOuterClass.Command getCommands(int index) { - if (commandsBuilder_ == null) { - return commands_.get(index); - } else { - return commandsBuilder_.getMessage(index); - } - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder setCommands(int index, redis_request.RedisRequestOuterClass.Command value) { - if (commandsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCommandsIsMutable(); - commands_.set(index, value); - onChanged(); - } else { - commandsBuilder_.setMessage(index, value); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder setCommands( - int index, redis_request.RedisRequestOuterClass.Command.Builder builderForValue) { - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - commands_.set(index, builderForValue.build()); - onChanged(); - } else { - commandsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder addCommands(redis_request.RedisRequestOuterClass.Command value) { - if (commandsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCommandsIsMutable(); - commands_.add(value); - onChanged(); - } else { - commandsBuilder_.addMessage(value); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder addCommands(int index, redis_request.RedisRequestOuterClass.Command value) { - if (commandsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCommandsIsMutable(); - commands_.add(index, value); - onChanged(); - } else { - commandsBuilder_.addMessage(index, value); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder addCommands( - redis_request.RedisRequestOuterClass.Command.Builder builderForValue) { - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - commands_.add(builderForValue.build()); - onChanged(); - } else { - commandsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder addCommands( - int index, redis_request.RedisRequestOuterClass.Command.Builder builderForValue) { - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - commands_.add(index, builderForValue.build()); - onChanged(); - } else { - commandsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder addAllCommands( - java.lang.Iterable values) { - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, commands_); - onChanged(); - } else { - commandsBuilder_.addAllMessages(values); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder clearCommands() { - if (commandsBuilder_ == null) { - commands_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - commandsBuilder_.clear(); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public Builder removeCommands(int index) { - if (commandsBuilder_ == null) { - ensureCommandsIsMutable(); - commands_.remove(index); - onChanged(); - } else { - commandsBuilder_.remove(index); - } - return this; - } - - /** repeated .redis_request.Command commands = 1; */ - public redis_request.RedisRequestOuterClass.Command.Builder getCommandsBuilder(int index) { - return getCommandsFieldBuilder().getBuilder(index); - } - - /** repeated .redis_request.Command commands = 1; */ - public redis_request.RedisRequestOuterClass.CommandOrBuilder getCommandsOrBuilder(int index) { - if (commandsBuilder_ == null) { - return commands_.get(index); - } else { - return commandsBuilder_.getMessageOrBuilder(index); - } - } - - /** repeated .redis_request.Command commands = 1; */ - public java.util.List - getCommandsOrBuilderList() { - if (commandsBuilder_ != null) { - return commandsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(commands_); - } - } - - /** repeated .redis_request.Command commands = 1; */ - public redis_request.RedisRequestOuterClass.Command.Builder addCommandsBuilder() { - return getCommandsFieldBuilder() - .addBuilder(redis_request.RedisRequestOuterClass.Command.getDefaultInstance()); - } - - /** repeated .redis_request.Command commands = 1; */ - public redis_request.RedisRequestOuterClass.Command.Builder addCommandsBuilder(int index) { - return getCommandsFieldBuilder() - .addBuilder(index, redis_request.RedisRequestOuterClass.Command.getDefaultInstance()); - } - - /** repeated .redis_request.Command commands = 1; */ - public java.util.List - getCommandsBuilderList() { - return getCommandsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder> - getCommandsFieldBuilder() { - if (commandsBuilder_ == null) { - commandsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder>( - commands_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - commands_ = null; - } - return commandsBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.Transaction) - } - - // @@protoc_insertion_point(class_scope:redis_request.Transaction) - private static final redis_request.RedisRequestOuterClass.Transaction DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.Transaction(); - } - - public static redis_request.RedisRequestOuterClass.Transaction getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Transaction parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface RedisRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:redis_request.RedisRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - int getCallbackIdx(); - - /** - * .redis_request.Command single_command = 2; - * - * @return Whether the singleCommand field is set. - */ - boolean hasSingleCommand(); - - /** - * .redis_request.Command single_command = 2; - * - * @return The singleCommand. - */ - redis_request.RedisRequestOuterClass.Command getSingleCommand(); - - /** .redis_request.Command single_command = 2; */ - redis_request.RedisRequestOuterClass.CommandOrBuilder getSingleCommandOrBuilder(); - - /** - * .redis_request.Transaction transaction = 3; - * - * @return Whether the transaction field is set. - */ - boolean hasTransaction(); - - /** - * .redis_request.Transaction transaction = 3; - * - * @return The transaction. - */ - redis_request.RedisRequestOuterClass.Transaction getTransaction(); - - /** .redis_request.Transaction transaction = 3; */ - redis_request.RedisRequestOuterClass.TransactionOrBuilder getTransactionOrBuilder(); - - /** - * .redis_request.Routes route = 4; - * - * @return Whether the route field is set. - */ - boolean hasRoute(); - - /** - * .redis_request.Routes route = 4; - * - * @return The route. - */ - redis_request.RedisRequestOuterClass.Routes getRoute(); - - /** .redis_request.Routes route = 4; */ - redis_request.RedisRequestOuterClass.RoutesOrBuilder getRouteOrBuilder(); - - redis_request.RedisRequestOuterClass.RedisRequest.CommandCase getCommandCase(); - } - - /** Protobuf type {@code redis_request.RedisRequest} */ - public static final class RedisRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:redis_request.RedisRequest) - RedisRequestOrBuilder { - private static final long serialVersionUID = 0L; - - // Use RedisRequest.newBuilder() to construct. - private RedisRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private RedisRequest() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new RedisRequest(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_RedisRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_RedisRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.RedisRequest.class, - redis_request.RedisRequestOuterClass.RedisRequest.Builder.class); - } - - private int commandCase_ = 0; - - @SuppressWarnings("serial") - private java.lang.Object command_; - - public enum CommandCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - SINGLE_COMMAND(2), - TRANSACTION(3), - COMMAND_NOT_SET(0); - private final int value; - - private CommandCase(int value) { - this.value = value; - } - - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static CommandCase valueOf(int value) { - return forNumber(value); - } - - public static CommandCase forNumber(int value) { - switch (value) { - case 2: - return SINGLE_COMMAND; - case 3: - return TRANSACTION; - case 0: - return COMMAND_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public CommandCase getCommandCase() { - return CommandCase.forNumber(commandCase_); - } - - public static final int CALLBACK_IDX_FIELD_NUMBER = 1; - private int callbackIdx_ = 0; - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - @java.lang.Override - public int getCallbackIdx() { - return callbackIdx_; - } - - public static final int SINGLE_COMMAND_FIELD_NUMBER = 2; - - /** - * .redis_request.Command single_command = 2; - * - * @return Whether the singleCommand field is set. - */ - @java.lang.Override - public boolean hasSingleCommand() { - return commandCase_ == 2; - } - - /** - * .redis_request.Command single_command = 2; - * - * @return The singleCommand. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command getSingleCommand() { - if (commandCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command) command_; - } - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - - /** .redis_request.Command single_command = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.CommandOrBuilder getSingleCommandOrBuilder() { - if (commandCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command) command_; - } - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - - public static final int TRANSACTION_FIELD_NUMBER = 3; - - /** - * .redis_request.Transaction transaction = 3; - * - * @return Whether the transaction field is set. - */ - @java.lang.Override - public boolean hasTransaction() { - return commandCase_ == 3; - } - - /** - * .redis_request.Transaction transaction = 3; - * - * @return The transaction. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction getTransaction() { - if (commandCase_ == 3) { - return (redis_request.RedisRequestOuterClass.Transaction) command_; - } - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - - /** .redis_request.Transaction transaction = 3; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.TransactionOrBuilder getTransactionOrBuilder() { - if (commandCase_ == 3) { - return (redis_request.RedisRequestOuterClass.Transaction) command_; - } - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - - public static final int ROUTE_FIELD_NUMBER = 4; - private redis_request.RedisRequestOuterClass.Routes route_; - - /** - * .redis_request.Routes route = 4; - * - * @return Whether the route field is set. - */ - @java.lang.Override - public boolean hasRoute() { - return route_ != null; - } - - /** - * .redis_request.Routes route = 4; - * - * @return The route. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Routes getRoute() { - return route_ == null - ? redis_request.RedisRequestOuterClass.Routes.getDefaultInstance() - : route_; - } - - /** .redis_request.Routes route = 4; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.RoutesOrBuilder getRouteOrBuilder() { - return route_ == null - ? redis_request.RedisRequestOuterClass.Routes.getDefaultInstance() - : route_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (callbackIdx_ != 0) { - output.writeUInt32(1, callbackIdx_); - } - if (commandCase_ == 2) { - output.writeMessage(2, (redis_request.RedisRequestOuterClass.Command) command_); - } - if (commandCase_ == 3) { - output.writeMessage(3, (redis_request.RedisRequestOuterClass.Transaction) command_); - } - if (route_ != null) { - output.writeMessage(4, getRoute()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (callbackIdx_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(1, callbackIdx_); - } - if (commandCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 2, (redis_request.RedisRequestOuterClass.Command) command_); - } - if (commandCase_ == 3) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 3, (redis_request.RedisRequestOuterClass.Transaction) command_); - } - if (route_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getRoute()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof redis_request.RedisRequestOuterClass.RedisRequest)) { - return super.equals(obj); - } - redis_request.RedisRequestOuterClass.RedisRequest other = - (redis_request.RedisRequestOuterClass.RedisRequest) obj; - - if (getCallbackIdx() != other.getCallbackIdx()) return false; - if (hasRoute() != other.hasRoute()) return false; - if (hasRoute()) { - if (!getRoute().equals(other.getRoute())) return false; - } - if (!getCommandCase().equals(other.getCommandCase())) return false; - switch (commandCase_) { - case 2: - if (!getSingleCommand().equals(other.getSingleCommand())) return false; - break; - case 3: - if (!getTransaction().equals(other.getTransaction())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + CALLBACK_IDX_FIELD_NUMBER; - hash = (53 * hash) + getCallbackIdx(); - if (hasRoute()) { - hash = (37 * hash) + ROUTE_FIELD_NUMBER; - hash = (53 * hash) + getRoute().hashCode(); - } - switch (commandCase_) { - case 2: - hash = (37 * hash) + SINGLE_COMMAND_FIELD_NUMBER; - hash = (53 * hash) + getSingleCommand().hashCode(); - break; - case 3: - hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; - hash = (53 * hash) + getTransaction().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(redis_request.RedisRequestOuterClass.RedisRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code redis_request.RedisRequest} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:redis_request.RedisRequest) - redis_request.RedisRequestOuterClass.RedisRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_RedisRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_RedisRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - redis_request.RedisRequestOuterClass.RedisRequest.class, - redis_request.RedisRequestOuterClass.RedisRequest.Builder.class); - } - - // Construct using redis_request.RedisRequestOuterClass.RedisRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - callbackIdx_ = 0; - if (singleCommandBuilder_ != null) { - singleCommandBuilder_.clear(); - } - if (transactionBuilder_ != null) { - transactionBuilder_.clear(); - } - route_ = null; - if (routeBuilder_ != null) { - routeBuilder_.dispose(); - routeBuilder_ = null; - } - commandCase_ = 0; - command_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return redis_request.RedisRequestOuterClass - .internal_static_redis_request_RedisRequest_descriptor; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.RedisRequest getDefaultInstanceForType() { - return redis_request.RedisRequestOuterClass.RedisRequest.getDefaultInstance(); - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.RedisRequest build() { - redis_request.RedisRequestOuterClass.RedisRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.RedisRequest buildPartial() { - redis_request.RedisRequestOuterClass.RedisRequest result = - new redis_request.RedisRequestOuterClass.RedisRequest(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - buildPartialOneofs(result); - onBuilt(); - return result; - } - - private void buildPartial0(redis_request.RedisRequestOuterClass.RedisRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.callbackIdx_ = callbackIdx_; - } - if (((from_bitField0_ & 0x00000008) != 0)) { - result.route_ = routeBuilder_ == null ? route_ : routeBuilder_.build(); - } - } - - private void buildPartialOneofs(redis_request.RedisRequestOuterClass.RedisRequest result) { - result.commandCase_ = commandCase_; - result.command_ = this.command_; - if (commandCase_ == 2 && singleCommandBuilder_ != null) { - result.command_ = singleCommandBuilder_.build(); - } - if (commandCase_ == 3 && transactionBuilder_ != null) { - result.command_ = transactionBuilder_.build(); - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof redis_request.RedisRequestOuterClass.RedisRequest) { - return mergeFrom((redis_request.RedisRequestOuterClass.RedisRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(redis_request.RedisRequestOuterClass.RedisRequest other) { - if (other == redis_request.RedisRequestOuterClass.RedisRequest.getDefaultInstance()) - return this; - if (other.getCallbackIdx() != 0) { - setCallbackIdx(other.getCallbackIdx()); - } - if (other.hasRoute()) { - mergeRoute(other.getRoute()); - } - switch (other.getCommandCase()) { - case SINGLE_COMMAND: - { - mergeSingleCommand(other.getSingleCommand()); - break; - } - case TRANSACTION: - { - mergeTransaction(other.getTransaction()); - break; - } - case COMMAND_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - callbackIdx_ = input.readUInt32(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: - { - input.readMessage(getSingleCommandFieldBuilder().getBuilder(), extensionRegistry); - commandCase_ = 2; - break; - } // case 18 - case 26: - { - input.readMessage(getTransactionFieldBuilder().getBuilder(), extensionRegistry); - commandCase_ = 3; - break; - } // case 26 - case 34: - { - input.readMessage(getRouteFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000008; - break; - } // case 34 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int commandCase_ = 0; - private java.lang.Object command_; - - public CommandCase getCommandCase() { - return CommandCase.forNumber(commandCase_); - } - - public Builder clearCommand() { - commandCase_ = 0; - command_ = null; - onChanged(); - return this; - } - - private int bitField0_; - - private int callbackIdx_; - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - @java.lang.Override - public int getCallbackIdx() { - return callbackIdx_; - } - - /** - * uint32 callback_idx = 1; - * - * @param value The callbackIdx to set. - * @return This builder for chaining. - */ - public Builder setCallbackIdx(int value) { - - callbackIdx_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * uint32 callback_idx = 1; - * - * @return This builder for chaining. - */ - public Builder clearCallbackIdx() { - bitField0_ = (bitField0_ & ~0x00000001); - callbackIdx_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder> - singleCommandBuilder_; - - /** - * .redis_request.Command single_command = 2; - * - * @return Whether the singleCommand field is set. - */ - @java.lang.Override - public boolean hasSingleCommand() { - return commandCase_ == 2; - } - - /** - * .redis_request.Command single_command = 2; - * - * @return The singleCommand. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Command getSingleCommand() { - if (singleCommandBuilder_ == null) { - if (commandCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command) command_; - } - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } else { - if (commandCase_ == 2) { - return singleCommandBuilder_.getMessage(); - } - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - } - - /** .redis_request.Command single_command = 2; */ - public Builder setSingleCommand(redis_request.RedisRequestOuterClass.Command value) { - if (singleCommandBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - command_ = value; - onChanged(); - } else { - singleCommandBuilder_.setMessage(value); - } - commandCase_ = 2; - return this; - } - - /** .redis_request.Command single_command = 2; */ - public Builder setSingleCommand( - redis_request.RedisRequestOuterClass.Command.Builder builderForValue) { - if (singleCommandBuilder_ == null) { - command_ = builderForValue.build(); - onChanged(); - } else { - singleCommandBuilder_.setMessage(builderForValue.build()); - } - commandCase_ = 2; - return this; - } - - /** .redis_request.Command single_command = 2; */ - public Builder mergeSingleCommand(redis_request.RedisRequestOuterClass.Command value) { - if (singleCommandBuilder_ == null) { - if (commandCase_ == 2 - && command_ != redis_request.RedisRequestOuterClass.Command.getDefaultInstance()) { - command_ = - redis_request.RedisRequestOuterClass.Command.newBuilder( - (redis_request.RedisRequestOuterClass.Command) command_) - .mergeFrom(value) - .buildPartial(); - } else { - command_ = value; - } - onChanged(); - } else { - if (commandCase_ == 2) { - singleCommandBuilder_.mergeFrom(value); - } else { - singleCommandBuilder_.setMessage(value); - } - } - commandCase_ = 2; - return this; - } - - /** .redis_request.Command single_command = 2; */ - public Builder clearSingleCommand() { - if (singleCommandBuilder_ == null) { - if (commandCase_ == 2) { - commandCase_ = 0; - command_ = null; - onChanged(); - } - } else { - if (commandCase_ == 2) { - commandCase_ = 0; - command_ = null; - } - singleCommandBuilder_.clear(); - } - return this; - } - - /** .redis_request.Command single_command = 2; */ - public redis_request.RedisRequestOuterClass.Command.Builder getSingleCommandBuilder() { - return getSingleCommandFieldBuilder().getBuilder(); - } - - /** .redis_request.Command single_command = 2; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.CommandOrBuilder getSingleCommandOrBuilder() { - if ((commandCase_ == 2) && (singleCommandBuilder_ != null)) { - return singleCommandBuilder_.getMessageOrBuilder(); - } else { - if (commandCase_ == 2) { - return (redis_request.RedisRequestOuterClass.Command) command_; - } - return redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - } - - /** .redis_request.Command single_command = 2; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder> - getSingleCommandFieldBuilder() { - if (singleCommandBuilder_ == null) { - if (!(commandCase_ == 2)) { - command_ = redis_request.RedisRequestOuterClass.Command.getDefaultInstance(); - } - singleCommandBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Command, - redis_request.RedisRequestOuterClass.Command.Builder, - redis_request.RedisRequestOuterClass.CommandOrBuilder>( - (redis_request.RedisRequestOuterClass.Command) command_, - getParentForChildren(), - isClean()); - command_ = null; - } - commandCase_ = 2; - onChanged(); - return singleCommandBuilder_; - } - - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Transaction, - redis_request.RedisRequestOuterClass.Transaction.Builder, - redis_request.RedisRequestOuterClass.TransactionOrBuilder> - transactionBuilder_; - - /** - * .redis_request.Transaction transaction = 3; - * - * @return Whether the transaction field is set. - */ - @java.lang.Override - public boolean hasTransaction() { - return commandCase_ == 3; - } - - /** - * .redis_request.Transaction transaction = 3; - * - * @return The transaction. - */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.Transaction getTransaction() { - if (transactionBuilder_ == null) { - if (commandCase_ == 3) { - return (redis_request.RedisRequestOuterClass.Transaction) command_; - } - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } else { - if (commandCase_ == 3) { - return transactionBuilder_.getMessage(); - } - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - } - - /** .redis_request.Transaction transaction = 3; */ - public Builder setTransaction(redis_request.RedisRequestOuterClass.Transaction value) { - if (transactionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - command_ = value; - onChanged(); - } else { - transactionBuilder_.setMessage(value); - } - commandCase_ = 3; - return this; - } - - /** .redis_request.Transaction transaction = 3; */ - public Builder setTransaction( - redis_request.RedisRequestOuterClass.Transaction.Builder builderForValue) { - if (transactionBuilder_ == null) { - command_ = builderForValue.build(); - onChanged(); - } else { - transactionBuilder_.setMessage(builderForValue.build()); - } - commandCase_ = 3; - return this; - } - - /** .redis_request.Transaction transaction = 3; */ - public Builder mergeTransaction(redis_request.RedisRequestOuterClass.Transaction value) { - if (transactionBuilder_ == null) { - if (commandCase_ == 3 - && command_ - != redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance()) { - command_ = - redis_request.RedisRequestOuterClass.Transaction.newBuilder( - (redis_request.RedisRequestOuterClass.Transaction) command_) - .mergeFrom(value) - .buildPartial(); - } else { - command_ = value; - } - onChanged(); - } else { - if (commandCase_ == 3) { - transactionBuilder_.mergeFrom(value); - } else { - transactionBuilder_.setMessage(value); - } - } - commandCase_ = 3; - return this; - } - - /** .redis_request.Transaction transaction = 3; */ - public Builder clearTransaction() { - if (transactionBuilder_ == null) { - if (commandCase_ == 3) { - commandCase_ = 0; - command_ = null; - onChanged(); - } - } else { - if (commandCase_ == 3) { - commandCase_ = 0; - command_ = null; - } - transactionBuilder_.clear(); - } - return this; - } - - /** .redis_request.Transaction transaction = 3; */ - public redis_request.RedisRequestOuterClass.Transaction.Builder getTransactionBuilder() { - return getTransactionFieldBuilder().getBuilder(); - } - - /** .redis_request.Transaction transaction = 3; */ - @java.lang.Override - public redis_request.RedisRequestOuterClass.TransactionOrBuilder getTransactionOrBuilder() { - if ((commandCase_ == 3) && (transactionBuilder_ != null)) { - return transactionBuilder_.getMessageOrBuilder(); - } else { - if (commandCase_ == 3) { - return (redis_request.RedisRequestOuterClass.Transaction) command_; - } - return redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - } - - /** .redis_request.Transaction transaction = 3; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Transaction, - redis_request.RedisRequestOuterClass.Transaction.Builder, - redis_request.RedisRequestOuterClass.TransactionOrBuilder> - getTransactionFieldBuilder() { - if (transactionBuilder_ == null) { - if (!(commandCase_ == 3)) { - command_ = redis_request.RedisRequestOuterClass.Transaction.getDefaultInstance(); - } - transactionBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Transaction, - redis_request.RedisRequestOuterClass.Transaction.Builder, - redis_request.RedisRequestOuterClass.TransactionOrBuilder>( - (redis_request.RedisRequestOuterClass.Transaction) command_, - getParentForChildren(), - isClean()); - command_ = null; - } - commandCase_ = 3; - onChanged(); - return transactionBuilder_; - } - - private redis_request.RedisRequestOuterClass.Routes route_; - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Routes, - redis_request.RedisRequestOuterClass.Routes.Builder, - redis_request.RedisRequestOuterClass.RoutesOrBuilder> - routeBuilder_; - - /** - * .redis_request.Routes route = 4; - * - * @return Whether the route field is set. - */ - public boolean hasRoute() { - return ((bitField0_ & 0x00000008) != 0); - } - - /** - * .redis_request.Routes route = 4; - * - * @return The route. - */ - public redis_request.RedisRequestOuterClass.Routes getRoute() { - if (routeBuilder_ == null) { - return route_ == null - ? redis_request.RedisRequestOuterClass.Routes.getDefaultInstance() - : route_; - } else { - return routeBuilder_.getMessage(); - } - } - - /** .redis_request.Routes route = 4; */ - public Builder setRoute(redis_request.RedisRequestOuterClass.Routes value) { - if (routeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - route_ = value; - } else { - routeBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - - /** .redis_request.Routes route = 4; */ - public Builder setRoute(redis_request.RedisRequestOuterClass.Routes.Builder builderForValue) { - if (routeBuilder_ == null) { - route_ = builderForValue.build(); - } else { - routeBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - - /** .redis_request.Routes route = 4; */ - public Builder mergeRoute(redis_request.RedisRequestOuterClass.Routes value) { - if (routeBuilder_ == null) { - if (((bitField0_ & 0x00000008) != 0) - && route_ != null - && route_ != redis_request.RedisRequestOuterClass.Routes.getDefaultInstance()) { - getRouteBuilder().mergeFrom(value); - } else { - route_ = value; - } - } else { - routeBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - - /** .redis_request.Routes route = 4; */ - public Builder clearRoute() { - bitField0_ = (bitField0_ & ~0x00000008); - route_ = null; - if (routeBuilder_ != null) { - routeBuilder_.dispose(); - routeBuilder_ = null; - } - onChanged(); - return this; - } - - /** .redis_request.Routes route = 4; */ - public redis_request.RedisRequestOuterClass.Routes.Builder getRouteBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getRouteFieldBuilder().getBuilder(); - } - - /** .redis_request.Routes route = 4; */ - public redis_request.RedisRequestOuterClass.RoutesOrBuilder getRouteOrBuilder() { - if (routeBuilder_ != null) { - return routeBuilder_.getMessageOrBuilder(); - } else { - return route_ == null - ? redis_request.RedisRequestOuterClass.Routes.getDefaultInstance() - : route_; - } - } - - /** .redis_request.Routes route = 4; */ - private com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Routes, - redis_request.RedisRequestOuterClass.Routes.Builder, - redis_request.RedisRequestOuterClass.RoutesOrBuilder> - getRouteFieldBuilder() { - if (routeBuilder_ == null) { - routeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - redis_request.RedisRequestOuterClass.Routes, - redis_request.RedisRequestOuterClass.Routes.Builder, - redis_request.RedisRequestOuterClass.RoutesOrBuilder>( - getRoute(), getParentForChildren(), isClean()); - route_ = null; - } - return routeBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:redis_request.RedisRequest) - } - - // @@protoc_insertion_point(class_scope:redis_request.RedisRequest) - private static final redis_request.RedisRequestOuterClass.RedisRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new redis_request.RedisRequestOuterClass.RedisRequest(); - } - - public static redis_request.RedisRequestOuterClass.RedisRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public RedisRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public redis_request.RedisRequestOuterClass.RedisRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_SlotIdRoute_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_SlotIdRoute_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_SlotKeyRoute_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_SlotKeyRoute_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_Routes_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_Routes_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_Command_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_Command_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_Command_ArgsArray_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_Command_ArgsArray_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_Transaction_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_Transaction_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_redis_request_RedisRequest_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_redis_request_RedisRequest_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - - static { - java.lang.String[] descriptorData = { - "\n" - + "\023redis_request.proto\022\r" - + "redis_request\"K\n" - + "\013SlotIdRoute\022+\n" - + "\tslot_type\030\001 \001(\0162\030.redis_request.SlotTypes\022\017\n" - + "\007slot_id\030\002 \001(\005\"M\n" - + "\014SlotKeyRoute\022+\n" - + "\tslot_type\030\001 \001(\0162\030.redis_request.SlotTypes\022\020\n" - + "\010slot_key\030\002 \001(\t\"\263\001\n" - + "\006Routes\0224\n\r" - + "simple_routes\030\001 \001(\0162\033.redis_request.SimpleRoutesH\000\0225\n" - + "\016slot_key_route\030\002 \001(\0132\033.redis_request.SlotKeyRouteH\000\0223\n\r" - + "slot_id_route\030\003 \001(\0132\032.redis_request.SlotIdRouteH\000B\007\n" - + "\005value\"\262\001\n" - + "\007Command\0220\n" - + "\014request_type\030\001 \001(\0162\032.redis_request.RequestType\0226\n\n" - + "args_array\030\002 \001(\0132 .redis_request.Command.ArgsArrayH\000\022\032\n" - + "\020args_vec_pointer\030\003 \001(\004H\000\032\031\n" - + "\tArgsArray\022\014\n" - + "\004args\030\001 \003(\tB\006\n" - + "\004args\"7\n" - + "\013Transaction\022(\n" - + "\010commands\030\001 \003(\0132\026.redis_request.Command\"\272\001\n" - + "\014RedisRequest\022\024\n" - + "\014callback_idx\030\001 \001(\r" - + "\0220\n" - + "\016single_command\030\002 \001(\0132\026.redis_request.CommandH\000\0221\n" - + "\013transaction\030\003 \001(\0132\032.redis_request.TransactionH\000\022$\n" - + "\005route\030\004 \001(\0132\025.redis_request.RoutesB\t\n" - + "\007command*:\n" - + "\014SimpleRoutes\022\014\n" - + "\010AllNodes\020\000\022\020\n" - + "\014AllPrimaries\020\001\022\n\n" - + "\006Random\020\002*%\n" - + "\tSlotTypes\022\013\n" - + "\007Primary\020\000\022\013\n" - + "\007Replica\020\001*\316\004\n" - + "\013RequestType\022\022\n" - + "\016InvalidRequest\020\000\022\021\n\r" - + "CustomCommand\020\001\022\r\n" - + "\tGetString\020\002\022\r\n" - + "\tSetString\020\003\022\010\n" - + "\004Ping\020\004\022\010\n" - + "\004Info\020\005\022\007\n" - + "\003Del\020\006\022\n\n" - + "\006Select\020\007\022\r\n" - + "\tConfigGet\020\010\022\r\n" - + "\tConfigSet\020\t\022\023\n" - + "\017ConfigResetStat\020\n" - + "\022\021\n" - + "\r" - + "ConfigRewrite\020\013\022\021\n\r" - + "ClientGetName\020\014\022\022\n" - + "\016ClientGetRedir\020\r" - + "\022\014\n" - + "\010ClientId\020\016\022\016\n\n" - + "ClientInfo\020\017\022\016\n\n" - + "ClientKill\020\020\022\016\n\n" - + "ClientList\020\021\022\021\n" - + "\r" - + "ClientNoEvict\020\022\022\021\n\r" - + "ClientNoTouch\020\023\022\017\n" - + "\013ClientPause\020\024\022\017\n" - + "\013ClientReply\020\025\022\021\n\r" - + "ClientSetInfo\020\026\022\021\n\r" - + "ClientSetName\020\027\022\021\n\r" - + "ClientUnblock\020\030\022\021\n\r" - + "ClientUnpause\020\031\022\n\n" - + "\006Expire\020\032\022\013\n" - + "\007HashSet\020\033\022\013\n" - + "\007HashGet\020\034\022\013\n" - + "\007HashDel\020\035\022\016\n\n" - + "HashExists\020\036\022\010\n" - + "\004MGet\020\037\022\010\n" - + "\004MSet\020 \022\010\n" - + "\004Incr\020!\022\n\n" - + "\006IncrBy\020\"\022\010\n" - + "\004Decr\020#\022\017\n" - + "\013IncrByFloat\020$\022\n\n" - + "\006DecrBy\020%b\006proto3" - }; - descriptor = - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); - internal_static_redis_request_SlotIdRoute_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_redis_request_SlotIdRoute_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_SlotIdRoute_descriptor, - new java.lang.String[] { - "SlotType", "SlotId", - }); - internal_static_redis_request_SlotKeyRoute_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_redis_request_SlotKeyRoute_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_SlotKeyRoute_descriptor, - new java.lang.String[] { - "SlotType", "SlotKey", - }); - internal_static_redis_request_Routes_descriptor = getDescriptor().getMessageTypes().get(2); - internal_static_redis_request_Routes_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_Routes_descriptor, - new java.lang.String[] { - "SimpleRoutes", "SlotKeyRoute", "SlotIdRoute", "Value", - }); - internal_static_redis_request_Command_descriptor = getDescriptor().getMessageTypes().get(3); - internal_static_redis_request_Command_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_Command_descriptor, - new java.lang.String[] { - "RequestType", "ArgsArray", "ArgsVecPointer", "Args", - }); - internal_static_redis_request_Command_ArgsArray_descriptor = - internal_static_redis_request_Command_descriptor.getNestedTypes().get(0); - internal_static_redis_request_Command_ArgsArray_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_Command_ArgsArray_descriptor, - new java.lang.String[] { - "Args", - }); - internal_static_redis_request_Transaction_descriptor = getDescriptor().getMessageTypes().get(4); - internal_static_redis_request_Transaction_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_Transaction_descriptor, - new java.lang.String[] { - "Commands", - }); - internal_static_redis_request_RedisRequest_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_redis_request_RedisRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_redis_request_RedisRequest_descriptor, - new java.lang.String[] { - "CallbackIdx", "SingleCommand", "Transaction", "Route", "Command", - }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java b/java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java deleted file mode 100644 index d94678db3f..0000000000 --- a/java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java +++ /dev/null @@ -1,2283 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: response.proto - -package response; - -public final class ResponseOuterClass { - private ResponseOuterClass() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - - /** Protobuf enum {@code response.RequestErrorType} */ - public enum RequestErrorType implements com.google.protobuf.ProtocolMessageEnum { - /** Unspecified = 0; */ - Unspecified(0), - /** ExecAbort = 1; */ - ExecAbort(1), - /** Timeout = 2; */ - Timeout(2), - /** Disconnect = 3; */ - Disconnect(3), - UNRECOGNIZED(-1), - ; - - /** Unspecified = 0; */ - public static final int Unspecified_VALUE = 0; - - /** ExecAbort = 1; */ - public static final int ExecAbort_VALUE = 1; - - /** Timeout = 2; */ - public static final int Timeout_VALUE = 2; - - /** Disconnect = 3; */ - public static final int Disconnect_VALUE = 3; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static RequestErrorType valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestErrorType forNumber(int value) { - switch (value) { - case 0: - return Unspecified; - case 1: - return ExecAbort; - case 2: - return Timeout; - case 3: - return Disconnect; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestErrorType findValueByNumber(int number) { - return RequestErrorType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return response.ResponseOuterClass.getDescriptor().getEnumTypes().get(0); - } - - private static final RequestErrorType[] VALUES = values(); - - public static RequestErrorType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private RequestErrorType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:response.RequestErrorType) - } - - /** Protobuf enum {@code response.ConstantResponse} */ - public enum ConstantResponse implements com.google.protobuf.ProtocolMessageEnum { - /** OK = 0; */ - OK(0), - UNRECOGNIZED(-1), - ; - - /** OK = 0; */ - public static final int OK_VALUE = 0; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ConstantResponse valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static ConstantResponse forNumber(int value) { - switch (value) { - case 0: - return OK; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ConstantResponse findValueByNumber(int number) { - return ConstantResponse.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return response.ResponseOuterClass.getDescriptor().getEnumTypes().get(1); - } - - private static final ConstantResponse[] VALUES = values(); - - public static ConstantResponse valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private ConstantResponse(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:response.ConstantResponse) - } - - public interface RequestErrorOrBuilder - extends - // @@protoc_insertion_point(interface_extends:response.RequestError) - com.google.protobuf.MessageOrBuilder { - - /** - * .response.RequestErrorType type = 1; - * - * @return The enum numeric value on the wire for type. - */ - int getTypeValue(); - - /** - * .response.RequestErrorType type = 1; - * - * @return The type. - */ - response.ResponseOuterClass.RequestErrorType getType(); - - /** - * string message = 2; - * - * @return The message. - */ - java.lang.String getMessage(); - - /** - * string message = 2; - * - * @return The bytes for message. - */ - com.google.protobuf.ByteString getMessageBytes(); - } - - /** Protobuf type {@code response.RequestError} */ - public static final class RequestError extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:response.RequestError) - RequestErrorOrBuilder { - private static final long serialVersionUID = 0L; - - // Use RequestError.newBuilder() to construct. - private RequestError(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private RequestError() { - type_ = 0; - message_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new RequestError(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return response.ResponseOuterClass.internal_static_response_RequestError_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return response.ResponseOuterClass.internal_static_response_RequestError_fieldAccessorTable - .ensureFieldAccessorsInitialized( - response.ResponseOuterClass.RequestError.class, - response.ResponseOuterClass.RequestError.Builder.class); - } - - public static final int TYPE_FIELD_NUMBER = 1; - private int type_ = 0; - - /** - * .response.RequestErrorType type = 1; - * - * @return The enum numeric value on the wire for type. - */ - @java.lang.Override - public int getTypeValue() { - return type_; - } - - /** - * .response.RequestErrorType type = 1; - * - * @return The type. - */ - @java.lang.Override - public response.ResponseOuterClass.RequestErrorType getType() { - response.ResponseOuterClass.RequestErrorType result = - response.ResponseOuterClass.RequestErrorType.forNumber(type_); - return result == null ? response.ResponseOuterClass.RequestErrorType.UNRECOGNIZED : result; - } - - public static final int MESSAGE_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private volatile java.lang.Object message_ = ""; - - /** - * string message = 2; - * - * @return The message. - */ - @java.lang.Override - public java.lang.String getMessage() { - java.lang.Object ref = message_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - message_ = s; - return s; - } - } - - /** - * string message = 2; - * - * @return The bytes for message. - */ - @java.lang.Override - public com.google.protobuf.ByteString getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (type_ != response.ResponseOuterClass.RequestErrorType.Unspecified.getNumber()) { - output.writeEnum(1, type_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (type_ != response.ResponseOuterClass.RequestErrorType.Unspecified.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof response.ResponseOuterClass.RequestError)) { - return super.equals(obj); - } - response.ResponseOuterClass.RequestError other = - (response.ResponseOuterClass.RequestError) obj; - - if (type_ != other.type_) return false; - if (!getMessage().equals(other.getMessage())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + TYPE_FIELD_NUMBER; - hash = (53 * hash) + type_; - hash = (37 * hash) + MESSAGE_FIELD_NUMBER; - hash = (53 * hash) + getMessage().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static response.ResponseOuterClass.RequestError parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.RequestError parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.RequestError parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static response.ResponseOuterClass.RequestError parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.RequestError parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.RequestError parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(response.ResponseOuterClass.RequestError prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code response.RequestError} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:response.RequestError) - response.ResponseOuterClass.RequestErrorOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return response.ResponseOuterClass.internal_static_response_RequestError_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return response.ResponseOuterClass.internal_static_response_RequestError_fieldAccessorTable - .ensureFieldAccessorsInitialized( - response.ResponseOuterClass.RequestError.class, - response.ResponseOuterClass.RequestError.Builder.class); - } - - // Construct using response.ResponseOuterClass.RequestError.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - type_ = 0; - message_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return response.ResponseOuterClass.internal_static_response_RequestError_descriptor; - } - - @java.lang.Override - public response.ResponseOuterClass.RequestError getDefaultInstanceForType() { - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - - @java.lang.Override - public response.ResponseOuterClass.RequestError build() { - response.ResponseOuterClass.RequestError result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public response.ResponseOuterClass.RequestError buildPartial() { - response.ResponseOuterClass.RequestError result = - new response.ResponseOuterClass.RequestError(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(response.ResponseOuterClass.RequestError result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.type_ = type_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.message_ = message_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof response.ResponseOuterClass.RequestError) { - return mergeFrom((response.ResponseOuterClass.RequestError) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(response.ResponseOuterClass.RequestError other) { - if (other == response.ResponseOuterClass.RequestError.getDefaultInstance()) return this; - if (other.type_ != 0) { - setTypeValue(other.getTypeValue()); - } - if (!other.getMessage().isEmpty()) { - message_ = other.message_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - type_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: - { - message_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private int type_ = 0; - - /** - * .response.RequestErrorType type = 1; - * - * @return The enum numeric value on the wire for type. - */ - @java.lang.Override - public int getTypeValue() { - return type_; - } - - /** - * .response.RequestErrorType type = 1; - * - * @param value The enum numeric value on the wire for type to set. - * @return This builder for chaining. - */ - public Builder setTypeValue(int value) { - type_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * .response.RequestErrorType type = 1; - * - * @return The type. - */ - @java.lang.Override - public response.ResponseOuterClass.RequestErrorType getType() { - response.ResponseOuterClass.RequestErrorType result = - response.ResponseOuterClass.RequestErrorType.forNumber(type_); - return result == null ? response.ResponseOuterClass.RequestErrorType.UNRECOGNIZED : result; - } - - /** - * .response.RequestErrorType type = 1; - * - * @param value The type to set. - * @return This builder for chaining. - */ - public Builder setType(response.ResponseOuterClass.RequestErrorType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .response.RequestErrorType type = 1; - * - * @return This builder for chaining. - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = 0; - onChanged(); - return this; - } - - private java.lang.Object message_ = ""; - - /** - * string message = 2; - * - * @return The message. - */ - public java.lang.String getMessage() { - java.lang.Object ref = message_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - message_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string message = 2; - * - * @return The bytes for message. - */ - public com.google.protobuf.ByteString getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string message = 2; - * - * @param value The message to set. - * @return This builder for chaining. - */ - public Builder setMessage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - message_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * string message = 2; - * - * @return This builder for chaining. - */ - public Builder clearMessage() { - message_ = getDefaultInstance().getMessage(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - /** - * string message = 2; - * - * @param value The bytes for message to set. - * @return This builder for chaining. - */ - public Builder setMessageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - message_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:response.RequestError) - } - - // @@protoc_insertion_point(class_scope:response.RequestError) - private static final response.ResponseOuterClass.RequestError DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new response.ResponseOuterClass.RequestError(); - } - - public static response.ResponseOuterClass.RequestError getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public RequestError parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public response.ResponseOuterClass.RequestError getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface ResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:response.Response) - com.google.protobuf.MessageOrBuilder { - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - int getCallbackIdx(); - - /** - * uint64 resp_pointer = 2; - * - * @return Whether the respPointer field is set. - */ - boolean hasRespPointer(); - - /** - * uint64 resp_pointer = 2; - * - * @return The respPointer. - */ - long getRespPointer(); - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return Whether the constantResponse field is set. - */ - boolean hasConstantResponse(); - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The enum numeric value on the wire for constantResponse. - */ - int getConstantResponseValue(); - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The constantResponse. - */ - response.ResponseOuterClass.ConstantResponse getConstantResponse(); - - /** - * .response.RequestError request_error = 4; - * - * @return Whether the requestError field is set. - */ - boolean hasRequestError(); - - /** - * .response.RequestError request_error = 4; - * - * @return The requestError. - */ - response.ResponseOuterClass.RequestError getRequestError(); - - /** .response.RequestError request_error = 4; */ - response.ResponseOuterClass.RequestErrorOrBuilder getRequestErrorOrBuilder(); - - /** - * string closing_error = 5; - * - * @return Whether the closingError field is set. - */ - boolean hasClosingError(); - - /** - * string closing_error = 5; - * - * @return The closingError. - */ - java.lang.String getClosingError(); - - /** - * string closing_error = 5; - * - * @return The bytes for closingError. - */ - com.google.protobuf.ByteString getClosingErrorBytes(); - - response.ResponseOuterClass.Response.ValueCase getValueCase(); - } - - /** Protobuf type {@code response.Response} */ - public static final class Response extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:response.Response) - ResponseOrBuilder { - private static final long serialVersionUID = 0L; - - // Use Response.newBuilder() to construct. - private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Response() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Response(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return response.ResponseOuterClass.internal_static_response_Response_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return response.ResponseOuterClass.internal_static_response_Response_fieldAccessorTable - .ensureFieldAccessorsInitialized( - response.ResponseOuterClass.Response.class, - response.ResponseOuterClass.Response.Builder.class); - } - - private int valueCase_ = 0; - - @SuppressWarnings("serial") - private java.lang.Object value_; - - public enum ValueCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - RESP_POINTER(2), - CONSTANT_RESPONSE(3), - REQUEST_ERROR(4), - CLOSING_ERROR(5), - VALUE_NOT_SET(0); - private final int value; - - private ValueCase(int value) { - this.value = value; - } - - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ValueCase valueOf(int value) { - return forNumber(value); - } - - public static ValueCase forNumber(int value) { - switch (value) { - case 2: - return RESP_POINTER; - case 3: - return CONSTANT_RESPONSE; - case 4: - return REQUEST_ERROR; - case 5: - return CLOSING_ERROR; - case 0: - return VALUE_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public ValueCase getValueCase() { - return ValueCase.forNumber(valueCase_); - } - - public static final int CALLBACK_IDX_FIELD_NUMBER = 1; - private int callbackIdx_ = 0; - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - @java.lang.Override - public int getCallbackIdx() { - return callbackIdx_; - } - - public static final int RESP_POINTER_FIELD_NUMBER = 2; - - /** - * uint64 resp_pointer = 2; - * - * @return Whether the respPointer field is set. - */ - @java.lang.Override - public boolean hasRespPointer() { - return valueCase_ == 2; - } - - /** - * uint64 resp_pointer = 2; - * - * @return The respPointer. - */ - @java.lang.Override - public long getRespPointer() { - if (valueCase_ == 2) { - return (java.lang.Long) value_; - } - return 0L; - } - - public static final int CONSTANT_RESPONSE_FIELD_NUMBER = 3; - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return Whether the constantResponse field is set. - */ - public boolean hasConstantResponse() { - return valueCase_ == 3; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The enum numeric value on the wire for constantResponse. - */ - public int getConstantResponseValue() { - if (valueCase_ == 3) { - return (java.lang.Integer) value_; - } - return 0; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The constantResponse. - */ - public response.ResponseOuterClass.ConstantResponse getConstantResponse() { - if (valueCase_ == 3) { - response.ResponseOuterClass.ConstantResponse result = - response.ResponseOuterClass.ConstantResponse.forNumber((java.lang.Integer) value_); - return result == null ? response.ResponseOuterClass.ConstantResponse.UNRECOGNIZED : result; - } - return response.ResponseOuterClass.ConstantResponse.OK; - } - - public static final int REQUEST_ERROR_FIELD_NUMBER = 4; - - /** - * .response.RequestError request_error = 4; - * - * @return Whether the requestError field is set. - */ - @java.lang.Override - public boolean hasRequestError() { - return valueCase_ == 4; - } - - /** - * .response.RequestError request_error = 4; - * - * @return The requestError. - */ - @java.lang.Override - public response.ResponseOuterClass.RequestError getRequestError() { - if (valueCase_ == 4) { - return (response.ResponseOuterClass.RequestError) value_; - } - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - - /** .response.RequestError request_error = 4; */ - @java.lang.Override - public response.ResponseOuterClass.RequestErrorOrBuilder getRequestErrorOrBuilder() { - if (valueCase_ == 4) { - return (response.ResponseOuterClass.RequestError) value_; - } - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - - public static final int CLOSING_ERROR_FIELD_NUMBER = 5; - - /** - * string closing_error = 5; - * - * @return Whether the closingError field is set. - */ - public boolean hasClosingError() { - return valueCase_ == 5; - } - - /** - * string closing_error = 5; - * - * @return The closingError. - */ - public java.lang.String getClosingError() { - java.lang.Object ref = ""; - if (valueCase_ == 5) { - ref = value_; - } - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (valueCase_ == 5) { - value_ = s; - } - return s; - } - } - - /** - * string closing_error = 5; - * - * @return The bytes for closingError. - */ - public com.google.protobuf.ByteString getClosingErrorBytes() { - java.lang.Object ref = ""; - if (valueCase_ == 5) { - ref = value_; - } - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (valueCase_ == 5) { - value_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (callbackIdx_ != 0) { - output.writeUInt32(1, callbackIdx_); - } - if (valueCase_ == 2) { - output.writeUInt64(2, (long) ((java.lang.Long) value_)); - } - if (valueCase_ == 3) { - output.writeEnum(3, ((java.lang.Integer) value_)); - } - if (valueCase_ == 4) { - output.writeMessage(4, (response.ResponseOuterClass.RequestError) value_); - } - if (valueCase_ == 5) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, value_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (callbackIdx_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeUInt32Size(1, callbackIdx_); - } - if (valueCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeUInt64Size( - 2, (long) ((java.lang.Long) value_)); - } - if (valueCase_ == 3) { - size += - com.google.protobuf.CodedOutputStream.computeEnumSize(3, ((java.lang.Integer) value_)); - } - if (valueCase_ == 4) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 4, (response.ResponseOuterClass.RequestError) value_); - } - if (valueCase_ == 5) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof response.ResponseOuterClass.Response)) { - return super.equals(obj); - } - response.ResponseOuterClass.Response other = (response.ResponseOuterClass.Response) obj; - - if (getCallbackIdx() != other.getCallbackIdx()) return false; - if (!getValueCase().equals(other.getValueCase())) return false; - switch (valueCase_) { - case 2: - if (getRespPointer() != other.getRespPointer()) return false; - break; - case 3: - if (getConstantResponseValue() != other.getConstantResponseValue()) return false; - break; - case 4: - if (!getRequestError().equals(other.getRequestError())) return false; - break; - case 5: - if (!getClosingError().equals(other.getClosingError())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + CALLBACK_IDX_FIELD_NUMBER; - hash = (53 * hash) + getCallbackIdx(); - switch (valueCase_) { - case 2: - hash = (37 * hash) + RESP_POINTER_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getRespPointer()); - break; - case 3: - hash = (37 * hash) + CONSTANT_RESPONSE_FIELD_NUMBER; - hash = (53 * hash) + getConstantResponseValue(); - break; - case 4: - hash = (37 * hash) + REQUEST_ERROR_FIELD_NUMBER; - hash = (53 * hash) + getRequestError().hashCode(); - break; - case 5: - hash = (37 * hash) + CLOSING_ERROR_FIELD_NUMBER; - hash = (53 * hash) + getClosingError().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static response.ResponseOuterClass.Response parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.Response parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.Response parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.Response parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.Response parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static response.ResponseOuterClass.Response parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static response.ResponseOuterClass.Response parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.Response parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static response.ResponseOuterClass.Response parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.Response parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static response.ResponseOuterClass.Response parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static response.ResponseOuterClass.Response parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(response.ResponseOuterClass.Response prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** Protobuf type {@code response.Response} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:response.Response) - response.ResponseOuterClass.ResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return response.ResponseOuterClass.internal_static_response_Response_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return response.ResponseOuterClass.internal_static_response_Response_fieldAccessorTable - .ensureFieldAccessorsInitialized( - response.ResponseOuterClass.Response.class, - response.ResponseOuterClass.Response.Builder.class); - } - - // Construct using response.ResponseOuterClass.Response.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - callbackIdx_ = 0; - if (requestErrorBuilder_ != null) { - requestErrorBuilder_.clear(); - } - valueCase_ = 0; - value_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return response.ResponseOuterClass.internal_static_response_Response_descriptor; - } - - @java.lang.Override - public response.ResponseOuterClass.Response getDefaultInstanceForType() { - return response.ResponseOuterClass.Response.getDefaultInstance(); - } - - @java.lang.Override - public response.ResponseOuterClass.Response build() { - response.ResponseOuterClass.Response result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public response.ResponseOuterClass.Response buildPartial() { - response.ResponseOuterClass.Response result = - new response.ResponseOuterClass.Response(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - buildPartialOneofs(result); - onBuilt(); - return result; - } - - private void buildPartial0(response.ResponseOuterClass.Response result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.callbackIdx_ = callbackIdx_; - } - } - - private void buildPartialOneofs(response.ResponseOuterClass.Response result) { - result.valueCase_ = valueCase_; - result.value_ = this.value_; - if (valueCase_ == 4 && requestErrorBuilder_ != null) { - result.value_ = requestErrorBuilder_.build(); - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof response.ResponseOuterClass.Response) { - return mergeFrom((response.ResponseOuterClass.Response) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(response.ResponseOuterClass.Response other) { - if (other == response.ResponseOuterClass.Response.getDefaultInstance()) return this; - if (other.getCallbackIdx() != 0) { - setCallbackIdx(other.getCallbackIdx()); - } - switch (other.getValueCase()) { - case RESP_POINTER: - { - setRespPointer(other.getRespPointer()); - break; - } - case CONSTANT_RESPONSE: - { - setConstantResponseValue(other.getConstantResponseValue()); - break; - } - case REQUEST_ERROR: - { - mergeRequestError(other.getRequestError()); - break; - } - case CLOSING_ERROR: - { - valueCase_ = 5; - value_ = other.value_; - onChanged(); - break; - } - case VALUE_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - callbackIdx_ = input.readUInt32(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 16: - { - value_ = input.readUInt64(); - valueCase_ = 2; - break; - } // case 16 - case 24: - { - int rawValue = input.readEnum(); - valueCase_ = 3; - value_ = rawValue; - break; - } // case 24 - case 34: - { - input.readMessage(getRequestErrorFieldBuilder().getBuilder(), extensionRegistry); - valueCase_ = 4; - break; - } // case 34 - case 42: - { - java.lang.String s = input.readStringRequireUtf8(); - valueCase_ = 5; - value_ = s; - break; - } // case 42 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int valueCase_ = 0; - private java.lang.Object value_; - - public ValueCase getValueCase() { - return ValueCase.forNumber(valueCase_); - } - - public Builder clearValue() { - valueCase_ = 0; - value_ = null; - onChanged(); - return this; - } - - private int bitField0_; - - private int callbackIdx_; - - /** - * uint32 callback_idx = 1; - * - * @return The callbackIdx. - */ - @java.lang.Override - public int getCallbackIdx() { - return callbackIdx_; - } - - /** - * uint32 callback_idx = 1; - * - * @param value The callbackIdx to set. - * @return This builder for chaining. - */ - public Builder setCallbackIdx(int value) { - - callbackIdx_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * uint32 callback_idx = 1; - * - * @return This builder for chaining. - */ - public Builder clearCallbackIdx() { - bitField0_ = (bitField0_ & ~0x00000001); - callbackIdx_ = 0; - onChanged(); - return this; - } - - /** - * uint64 resp_pointer = 2; - * - * @return Whether the respPointer field is set. - */ - public boolean hasRespPointer() { - return valueCase_ == 2; - } - - /** - * uint64 resp_pointer = 2; - * - * @return The respPointer. - */ - public long getRespPointer() { - if (valueCase_ == 2) { - return (java.lang.Long) value_; - } - return 0L; - } - - /** - * uint64 resp_pointer = 2; - * - * @param value The respPointer to set. - * @return This builder for chaining. - */ - public Builder setRespPointer(long value) { - - valueCase_ = 2; - value_ = value; - onChanged(); - return this; - } - - /** - * uint64 resp_pointer = 2; - * - * @return This builder for chaining. - */ - public Builder clearRespPointer() { - if (valueCase_ == 2) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - return this; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return Whether the constantResponse field is set. - */ - @java.lang.Override - public boolean hasConstantResponse() { - return valueCase_ == 3; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The enum numeric value on the wire for constantResponse. - */ - @java.lang.Override - public int getConstantResponseValue() { - if (valueCase_ == 3) { - return ((java.lang.Integer) value_).intValue(); - } - return 0; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @param value The enum numeric value on the wire for constantResponse to set. - * @return This builder for chaining. - */ - public Builder setConstantResponseValue(int value) { - valueCase_ = 3; - value_ = value; - onChanged(); - return this; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return The constantResponse. - */ - @java.lang.Override - public response.ResponseOuterClass.ConstantResponse getConstantResponse() { - if (valueCase_ == 3) { - response.ResponseOuterClass.ConstantResponse result = - response.ResponseOuterClass.ConstantResponse.forNumber((java.lang.Integer) value_); - return result == null - ? response.ResponseOuterClass.ConstantResponse.UNRECOGNIZED - : result; - } - return response.ResponseOuterClass.ConstantResponse.OK; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @param value The constantResponse to set. - * @return This builder for chaining. - */ - public Builder setConstantResponse(response.ResponseOuterClass.ConstantResponse value) { - if (value == null) { - throw new NullPointerException(); - } - valueCase_ = 3; - value_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .response.ConstantResponse constant_response = 3; - * - * @return This builder for chaining. - */ - public Builder clearConstantResponse() { - if (valueCase_ == 3) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - response.ResponseOuterClass.RequestError, - response.ResponseOuterClass.RequestError.Builder, - response.ResponseOuterClass.RequestErrorOrBuilder> - requestErrorBuilder_; - - /** - * .response.RequestError request_error = 4; - * - * @return Whether the requestError field is set. - */ - @java.lang.Override - public boolean hasRequestError() { - return valueCase_ == 4; - } - - /** - * .response.RequestError request_error = 4; - * - * @return The requestError. - */ - @java.lang.Override - public response.ResponseOuterClass.RequestError getRequestError() { - if (requestErrorBuilder_ == null) { - if (valueCase_ == 4) { - return (response.ResponseOuterClass.RequestError) value_; - } - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } else { - if (valueCase_ == 4) { - return requestErrorBuilder_.getMessage(); - } - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - } - - /** .response.RequestError request_error = 4; */ - public Builder setRequestError(response.ResponseOuterClass.RequestError value) { - if (requestErrorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - value_ = value; - onChanged(); - } else { - requestErrorBuilder_.setMessage(value); - } - valueCase_ = 4; - return this; - } - - /** .response.RequestError request_error = 4; */ - public Builder setRequestError( - response.ResponseOuterClass.RequestError.Builder builderForValue) { - if (requestErrorBuilder_ == null) { - value_ = builderForValue.build(); - onChanged(); - } else { - requestErrorBuilder_.setMessage(builderForValue.build()); - } - valueCase_ = 4; - return this; - } - - /** .response.RequestError request_error = 4; */ - public Builder mergeRequestError(response.ResponseOuterClass.RequestError value) { - if (requestErrorBuilder_ == null) { - if (valueCase_ == 4 - && value_ != response.ResponseOuterClass.RequestError.getDefaultInstance()) { - value_ = - response.ResponseOuterClass.RequestError.newBuilder( - (response.ResponseOuterClass.RequestError) value_) - .mergeFrom(value) - .buildPartial(); - } else { - value_ = value; - } - onChanged(); - } else { - if (valueCase_ == 4) { - requestErrorBuilder_.mergeFrom(value); - } else { - requestErrorBuilder_.setMessage(value); - } - } - valueCase_ = 4; - return this; - } - - /** .response.RequestError request_error = 4; */ - public Builder clearRequestError() { - if (requestErrorBuilder_ == null) { - if (valueCase_ == 4) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - } else { - if (valueCase_ == 4) { - valueCase_ = 0; - value_ = null; - } - requestErrorBuilder_.clear(); - } - return this; - } - - /** .response.RequestError request_error = 4; */ - public response.ResponseOuterClass.RequestError.Builder getRequestErrorBuilder() { - return getRequestErrorFieldBuilder().getBuilder(); - } - - /** .response.RequestError request_error = 4; */ - @java.lang.Override - public response.ResponseOuterClass.RequestErrorOrBuilder getRequestErrorOrBuilder() { - if ((valueCase_ == 4) && (requestErrorBuilder_ != null)) { - return requestErrorBuilder_.getMessageOrBuilder(); - } else { - if (valueCase_ == 4) { - return (response.ResponseOuterClass.RequestError) value_; - } - return response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - } - - /** .response.RequestError request_error = 4; */ - private com.google.protobuf.SingleFieldBuilderV3< - response.ResponseOuterClass.RequestError, - response.ResponseOuterClass.RequestError.Builder, - response.ResponseOuterClass.RequestErrorOrBuilder> - getRequestErrorFieldBuilder() { - if (requestErrorBuilder_ == null) { - if (!(valueCase_ == 4)) { - value_ = response.ResponseOuterClass.RequestError.getDefaultInstance(); - } - requestErrorBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - response.ResponseOuterClass.RequestError, - response.ResponseOuterClass.RequestError.Builder, - response.ResponseOuterClass.RequestErrorOrBuilder>( - (response.ResponseOuterClass.RequestError) value_, - getParentForChildren(), - isClean()); - value_ = null; - } - valueCase_ = 4; - onChanged(); - return requestErrorBuilder_; - } - - /** - * string closing_error = 5; - * - * @return Whether the closingError field is set. - */ - @java.lang.Override - public boolean hasClosingError() { - return valueCase_ == 5; - } - - /** - * string closing_error = 5; - * - * @return The closingError. - */ - @java.lang.Override - public java.lang.String getClosingError() { - java.lang.Object ref = ""; - if (valueCase_ == 5) { - ref = value_; - } - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (valueCase_ == 5) { - value_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string closing_error = 5; - * - * @return The bytes for closingError. - */ - @java.lang.Override - public com.google.protobuf.ByteString getClosingErrorBytes() { - java.lang.Object ref = ""; - if (valueCase_ == 5) { - ref = value_; - } - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (valueCase_ == 5) { - value_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string closing_error = 5; - * - * @param value The closingError to set. - * @return This builder for chaining. - */ - public Builder setClosingError(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - valueCase_ = 5; - value_ = value; - onChanged(); - return this; - } - - /** - * string closing_error = 5; - * - * @return This builder for chaining. - */ - public Builder clearClosingError() { - if (valueCase_ == 5) { - valueCase_ = 0; - value_ = null; - onChanged(); - } - return this; - } - - /** - * string closing_error = 5; - * - * @param value The bytes for closingError to set. - * @return This builder for chaining. - */ - public Builder setClosingErrorBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - valueCase_ = 5; - value_ = value; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:response.Response) - } - - // @@protoc_insertion_point(class_scope:response.Response) - private static final response.ResponseOuterClass.Response DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new response.ResponseOuterClass.Response(); - } - - public static response.ResponseOuterClass.Response getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Response parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public response.ResponseOuterClass.Response getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_response_RequestError_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_response_RequestError_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_response_Response_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_response_Response_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - - static { - java.lang.String[] descriptorData = { - "\n\016response.proto\022\010response\"I\n\014RequestErr" - + "or\022(\n\004type\030\001 \001(\0162\032.response.RequestError" - + "Type\022\017\n\007message\030\002 \001(\t\"\304\001\n\010Response\022\024\n\014ca" - + "llback_idx\030\001 \001(\r\022\026\n\014resp_pointer\030\002 \001(\004H\000" - + "\0227\n\021constant_response\030\003 \001(\0162\032.response.C" - + "onstantResponseH\000\022/\n\rrequest_error\030\004 \001(\013" - + "2\026.response.RequestErrorH\000\022\027\n\rclosing_er" - + "ror\030\005 \001(\tH\000B\007\n\005value*O\n\020RequestErrorType" - + "\022\017\n\013Unspecified\020\000\022\r\n\tExecAbort\020\001\022\013\n\007Time" - + "out\020\002\022\016\n\nDisconnect\020\003*\032\n\020ConstantRespons" - + "e\022\006\n\002OK\020\000b\006proto3" - }; - descriptor = - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); - internal_static_response_RequestError_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_response_RequestError_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_response_RequestError_descriptor, - new java.lang.String[] { - "Type", "Message", - }); - internal_static_response_Response_descriptor = getDescriptor().getMessageTypes().get(1); - internal_static_response_Response_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_response_Response_descriptor, - new java.lang.String[] { - "CallbackIdx", - "RespPointer", - "ConstantResponse", - "RequestError", - "ClosingError", - "Value", - }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java b/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java deleted file mode 100644 index 692790b8ec..0000000000 --- a/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java +++ /dev/null @@ -1,180 +0,0 @@ -package javababushka.benchmarks; - -import com.google.common.io.Files; -import javababushka.benchmarks.clients.babushka.JniNettyClient; -import javababushka.benchmarks.utils.ChosenAction; -import lombok.SneakyThrows; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; - -public class JniNettyTests { - - public static Stream generateTestDataWithFlushOnWrite() { - var dataSizes = List.of(20, 100, 400); - var clients = List.of(2, 4); - var threads = List.of(20, 100); - return dataSizes.stream().flatMap(f -> - clients.stream().flatMap(g -> - threads.stream().map(h -> - Arguments.of(true, 0, 0, 0, 0, f, g, h)))); - } - - public static Stream generateTestDataWithoutFlushOnWrite() { - var bytesThresholds = List.of(200, 400, 800, 1600); - var writesThresholds = List.of(5, 10, 20, 50); - var responseTimeouts = List.of(50, 100, 200); - var flushTimers = List.of(100, 200, 500); - var dataSizes = List.of(20, 100, 400); - var clients = List.of(2, 4); - var threads = List.of(20, 100); - return bytesThresholds.stream().flatMap(b -> - writesThresholds.stream().flatMap(c -> - responseTimeouts.stream().flatMap(d -> - flushTimers.stream().flatMap(e -> - dataSizes.stream().flatMap(f -> - clients.stream().flatMap(g -> - threads.stream().map(h -> - Arguments.of(false, b, c, d, e, f, g, h)))))))); - } - - private static FileWriter log; - private static final String key = String.valueOf(ProcessHandle.current().pid()); - private static final int iterations = 1000000; - - @BeforeAll - @SneakyThrows - public static void openLog() { - log = new FileWriter(Paths.get(System.getProperty("user.dir"), - "JniNettyClient-test-report.txt").toFile(), true); - log.append(String.format("\n\n=========================\niterations = %d, key = %s\n", iterations, key)); - } - - @AfterAll - @SneakyThrows - public static void closeLog() { - log.append("\n\n\n============== RECORDS ==============\n"); - for (var record : records.entrySet()) { - log.append(String.format("%20s\t%20d\t%s\n", - record.getKey(), record.getValue().getKey(), record.getValue().getValue())); - } - log.append("\n\n\n"); - log.close(); - } - - private static final Map> records = new HashMap<>(Map.of( - ChosenAction.SET, Pair.of(Long.MAX_VALUE, null), - ChosenAction.GET_EXISTING, Pair.of(Long.MAX_VALUE, null), - ChosenAction.GET_NON_EXISTING, Pair.of(Long.MAX_VALUE, null) - )); - - @ParameterizedTest(name = "flushOnWrite = {0}, bytesThreshold = {1}, writesThreshold = {2}," - + " responseTimeout = {3}, flushTimer = {4}," - + " dataSize = {5}, clients = {6}, threads = {7}") - @MethodSource({ "generateTestDataWithFlushOnWrite", "generateTestDataWithoutFlushOnWrite" }) - @SneakyThrows - public void experiment(boolean flushOnWrite, - int bytesThreshold, - int writesThreshold, - int responseTimeout, - int flushTimer, - int dataSize, - int clients, - int threads) { - var line = String.format("flushOnWrite = %s, bytesThreshold = %d, writesThreshold = %d," - + " responseTimeout = %d, flushTimer = %d," - + " dataSize = %d, clients = %d, threads = %d\n", flushOnWrite, bytesThreshold, writesThreshold, - responseTimeout, flushTimer, dataSize, clients, threads); - log.append(line); - - JniNettyClient.ALWAYS_FLUSH_ON_WRITE = flushOnWrite; - JniNettyClient.AUTO_FLUSH_THRESHOLD_BYTES = bytesThreshold; - JniNettyClient.AUTO_FLUSH_THRESHOLD_WRITES = writesThreshold; - JniNettyClient.AUTO_FLUSH_RESPONSE_TIMEOUT_MILLIS = responseTimeout; - JniNettyClient.AUTO_FLUSH_TIMER_MILLIS = flushTimer; - - var clientsArr = new JniNettyClient[clients]; - String value = RandomStringUtils.randomAlphanumeric(dataSize); - - for (int i = 1; i < clients; i++) { - clientsArr[i - 1] = new JniNettyClient(); - clientsArr[i - 1].connectToRedis(); - } - - List tasks = new ArrayList<>(); - for (int i = 0; i < threads; i++) { - tasks.add(() -> { - int clientIndex = threads % clients; - for (int j = 0; j < iterations; j++) { - clientsArr[clientIndex].get(key); - } - }); - } - long before = System.nanoTime(); - tasks.forEach(Runnable::run); - long after = System.nanoTime(); - long elapsed = after - before; - log.append(String.format(" GET NE %20d\n", elapsed)); - if (elapsed < records.get(ChosenAction.GET_NON_EXISTING).getKey()) { - records.put(ChosenAction.GET_NON_EXISTING, Pair.of(elapsed, line)); - } - for (int i = 1; i < clients; i++) { - clientsArr[i - 1].closeConnection(); - clientsArr[i - 1] = new JniNettyClient(); - clientsArr[i - 1].connectToRedis(); - } - tasks.clear(); - for (int i = 0; i < threads; i++) { - tasks.add(() -> { - int clientIndex = threads % clients; - for (int j = 0; j < iterations; j++) { - clientsArr[clientIndex].set(key, value); - } - }); - } - before = System.nanoTime(); - tasks.forEach(Runnable::run); - after = System.nanoTime(); - elapsed = after - before; - log.append(String.format(" SET %20d\n", elapsed)); - if (elapsed < records.get(ChosenAction.SET).getKey()) { - records.put(ChosenAction.SET, Pair.of(elapsed, line)); - } - for (int i = 1; i < clients; i++) { - clientsArr[i - 1].closeConnection(); - clientsArr[i - 1] = new JniNettyClient(); - clientsArr[i - 1].connectToRedis(); - } - tasks.clear(); - for (int i = 0; i < threads; i++) { - tasks.add(() -> { - int clientIndex = threads % clients; - for (int j = 0; j < iterations; j++) { - clientsArr[clientIndex].get(key); - } - }); - } - before = System.nanoTime(); - tasks.forEach(Runnable::run); - after = System.nanoTime(); - elapsed = after - before; - log.append(String.format(" GET E %20d\n", elapsed)); - if (elapsed < records.get(ChosenAction.GET_EXISTING).getKey()) { - records.put(ChosenAction.GET_EXISTING, Pair.of(elapsed, line)); - } - } -} diff --git a/java/client/build.gradle b/java/client/build.gradle index d99f81ba7a..b4a061ad13 100644 --- a/java/client/build.gradle +++ b/java/client/build.gradle @@ -10,6 +10,14 @@ repositories { dependencies { implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.24.3' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' + + implementation group: 'io.netty', name: 'netty-handler', version: '4.1.100.Final' + // https://github.com/netty/netty/wiki/Native-transports + // Windows is not supported, because babushka does not support windows, because tokio does not support windows, because ... 42 + implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.100.Final', classifier: 'linux-x86_64' + implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-x86_64' + implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-aarch_64' } tasks.register('protobuf', Exec) { @@ -22,11 +30,11 @@ tasks.register('protobuf', Exec) { 'babushka-core/src/protobuf/connection_request.proto', 'babushka-core/src/protobuf/redis_request.proto', 'babushka-core/src/protobuf/response.proto' - workingDir Paths.get(project.rootDir.path, '../..').toFile() + workingDir Paths.get(project.rootDir.path, '..').toFile() } tasks.register('buildRust', Exec) { - commandLine 'cargo', 'build' + commandLine 'cargo', 'build', '--release' workingDir project.rootDir } @@ -44,3 +52,9 @@ tasks.register('buildAll') { dependsOn 'protobuf', 'buildRust' finalizedBy 'build' } + +compileJava.dependsOn('protobuf') + +test { + systemProperty("java.library.path", "${projectDir}/../target/release") +} diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java new file mode 100644 index 0000000000..6cd4415d14 --- /dev/null +++ b/java/client/src/main/java/javababushka/Client.java @@ -0,0 +1,388 @@ +package javababushka; + +import static connection_request.ConnectionRequestOuterClass.AddressInfo; +import static connection_request.ConnectionRequestOuterClass.AuthenticationInfo; +import static connection_request.ConnectionRequestOuterClass.ConnectionRequest; +import static connection_request.ConnectionRequestOuterClass.ConnectionRetryStrategy; +import static connection_request.ConnectionRequestOuterClass.ReadFromReplicaStrategy; +import static connection_request.ConnectionRequestOuterClass.TlsMode; +import static redis_request.RedisRequestOuterClass.Command; +import static redis_request.RedisRequestOuterClass.Command.ArgsArray; +import static redis_request.RedisRequestOuterClass.RedisRequest; +import static redis_request.RedisRequestOuterClass.RequestType; +import static redis_request.RedisRequestOuterClass.Routes; +import static redis_request.RedisRequestOuterClass.SimpleRoutes; +import static response.ResponseOuterClass.Response; + +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.ChannelOutboundHandlerAdapter; +import io.netty.channel.ChannelPromise; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.WriteBufferWaterMark; +import io.netty.channel.epoll.EpollDomainSocketChannel; +import io.netty.channel.epoll.EpollEventLoopGroup; +import io.netty.channel.kqueue.KQueue; +import io.netty.channel.kqueue.KQueueDomainSocketChannel; +import io.netty.channel.kqueue.KQueueEventLoopGroup; +import io.netty.channel.unix.DomainSocketAddress; +import io.netty.channel.unix.UnixChannel; +import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import io.netty.handler.logging.LogLevel; +import io.netty.handler.logging.LoggingHandler; +import io.netty.util.internal.logging.InternalLoggerFactory; +import io.netty.util.internal.logging.Slf4JLoggerFactory; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.commons.lang3.tuple.Pair; + +public class Client implements AutoCloseable { + + private static final long DEFAULT_TIMEOUT_MILLISECONDS = 1000; + public static boolean ALWAYS_FLUSH_ON_WRITE = false; + + // https://netty.io/3.6/api/org/jboss/netty/handler/queue/BufferedWriteHandler.html + // Flush every N bytes if !ALWAYS_FLUSH_ON_WRITE + public static int AUTO_FLUSH_THRESHOLD_BYTES = 512; // 1024; + private final AtomicInteger nonFlushedBytesCounter = new AtomicInteger(0); + + // Flush every N writes if !ALWAYS_FLUSH_ON_WRITE + public static int AUTO_FLUSH_THRESHOLD_WRITES = 10; + private final AtomicInteger nonFlushedWritesCounter = new AtomicInteger(0); + + // If !ALWAYS_FLUSH_ON_WRITE and a command has no response in N millis, flush (probably it wasn't + // send) + public static int AUTO_FLUSH_RESPONSE_TIMEOUT_MILLIS = 100; + // If !ALWAYS_FLUSH_ON_WRITE flush on timer (like a cron) + public static int AUTO_FLUSH_TIMER_MILLIS = 200; + + public static int PENDING_RESPONSES_ON_CLOSE_TIMEOUT_MILLIS = 1000; + + // Futures to handle responses. Index is callback id, starting from 1 (0 index is for connection + // request always). + // Is it not a concurrent nor sync collection, but it is synced on adding. No removes. + // TODO clean up completed futures + private final List> responses = new ArrayList<>(); + // Unique offset for every client to avoid having multiple commands with the same id at a time. + // For debugging replace with: new Random().nextInt(1000) * 1000 + private final int callbackOffset = new Random().nextInt(); + + private final String unixSocket = getSocket(); + + private static String getSocket() { + try { + return RustWrapper.startSocketListenerExternal(); + } catch (Exception | UnsatisfiedLinkError e) { + System.err.printf("Failed to get UDS from babushka and dedushka: %s%n%n", e); + throw new RuntimeException(e); + } + } + + private Channel channel = null; + private EventLoopGroup group = null; + + // We support MacOS and Linux only, because Babushka does not support Windows, because tokio does + // not support it. + // Probably we should use NIO (NioEventLoopGroup) for Windows. + private static final boolean isMacOs = isMacOs(); + + private static boolean isMacOs() { + try { + Class.forName("io.netty.channel.kqueue.KQueue"); + return KQueue.isAvailable(); + } catch (ClassNotFoundException e) { + return false; + } + } + + static { + // TODO fix: netty still doesn't use slf4j nor log4j + InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); + } + + private void createChannel() { + // TODO maybe move to constructor or to static? + try { + channel = + new Bootstrap() + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024, 4096)) + .option(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT) + .group(group = isMacOs ? new KQueueEventLoopGroup() : new EpollEventLoopGroup()) + .channel(isMacOs ? KQueueDomainSocketChannel.class : EpollDomainSocketChannel.class) + .handler( + new ChannelInitializer() { + @Override + public void initChannel(UnixChannel ch) throws Exception { + ch.pipeline() + .addLast("logger", new LoggingHandler(LogLevel.DEBUG)) + // https://netty.io/4.1/api/io/netty/handler/codec/protobuf/ProtobufEncoder.html + .addLast("protobufDecoder", new ProtobufVarint32FrameDecoder()) + .addLast("protobufEncoder", new ProtobufVarint32LengthFieldPrepender()) + .addLast( + new ChannelInboundHandlerAdapter() { + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) + throws Exception { + // System.out.printf("=== channelRead %s %s %n", ctx, msg); + var buf = (ByteBuf) msg; + var bytes = new byte[buf.readableBytes()]; + buf.readBytes(bytes); + // TODO surround parsing with try-catch, set error to future if + // parsing failed. + var response = Response.parseFrom(bytes); + int callbackId = response.getCallbackIdx(); + if (callbackId != 0) { + // connection request has hardcoded callback id = 0 + // https://github.com/aws/babushka/issues/600 + callbackId -= callbackOffset; + } + // System.out.printf("== Received response with callback %d%n", + // response.getCallbackIdx()); + responses.get(callbackId).complete(response); + responses.set(callbackId, null); + super.channelRead(ctx, bytes); + } + + @Override + public void exceptionCaught( + ChannelHandlerContext ctx, Throwable cause) throws Exception { + System.out.printf("=== exceptionCaught %s %s %n", ctx, cause); + cause.printStackTrace(); + super.exceptionCaught(ctx, cause); + } + }) + .addLast( + new ChannelOutboundHandlerAdapter() { + @Override + public void write( + ChannelHandlerContext ctx, Object msg, ChannelPromise promise) + throws Exception { + // System.out.printf("=== write %s %s %s %n", ctx, msg, promise); + var bytes = (byte[]) msg; + + boolean needFlush = false; + if (!ALWAYS_FLUSH_ON_WRITE) { + synchronized (nonFlushedBytesCounter) { + if (nonFlushedBytesCounter.addAndGet(bytes.length) + >= AUTO_FLUSH_THRESHOLD_BYTES + || nonFlushedWritesCounter.incrementAndGet() + >= AUTO_FLUSH_THRESHOLD_WRITES) { + nonFlushedBytesCounter.set(0); + nonFlushedWritesCounter.set(0); + needFlush = true; + } + } + } + super.write(ctx, Unpooled.copiedBuffer(bytes), promise); + if (needFlush) { + // flush outside the sync block + flush(ctx); + // System.out.println("-- auto flush - buffer"); + } + } + }); + } + }) + .connect(new DomainSocketAddress(unixSocket)) + .sync() + .channel(); + + } catch (Exception e) { + System.err.printf( + "Failed to create a channel %s: %s%n", e.getClass().getSimpleName(), e.getMessage()); + e.printStackTrace(System.err); + } + + if (!ALWAYS_FLUSH_ON_WRITE) { + new Timer(true) + .scheduleAtFixedRate( + new TimerTask() { + @Override + public void run() { + channel.flush(); + nonFlushedBytesCounter.set(0); + nonFlushedWritesCounter.set(0); + } + }, + 0, + AUTO_FLUSH_TIMER_MILLIS); + } + } + + public void closeConnection() { + try { + channel.flush(); + + long waitStarted = System.nanoTime(); + long waitUntil = + waitStarted + PENDING_RESPONSES_ON_CLOSE_TIMEOUT_MILLIS * 100_000; // in nanos + for (var future : responses) { + if (future == null || future.isDone()) { + continue; + } + try { + future.get(waitUntil - System.nanoTime(), TimeUnit.NANOSECONDS); + } catch (InterruptedException | ExecutionException ignored) { + } catch (TimeoutException e) { + future.cancel(true); + // TODO cancel the rest + break; + } + } + } finally { + // channel.closeFuture().sync() + group.shutdownGracefully(); + } + } + + public void set(String key, String value) { + waitForResult(asyncSet(key, value)); + // TODO parse response and rethrow an exception if there is an error + } + + public String get(String key) { + return waitForResult(asyncGet(key)); + // TODO support non-strings + } + + private synchronized Pair> getNextCallback() { + var future = new CompletableFuture(); + responses.add(future); + return Pair.of(responses.size() - 1, future); + } + + @Override + public void close() throws Exception { + closeConnection(); + } + + public Future asyncConnectToRedis( + String host, int port, boolean useSsl, boolean clusterMode) { + createChannel(); + + var request = + ConnectionRequest.newBuilder() + .addAddresses(AddressInfo.newBuilder().setHost(host).setPort(port).build()) + .setTlsMode( + useSsl // TODO: secure or insecure TLS? + ? TlsMode.SecureTls + : TlsMode.NoTls) + .setClusterModeEnabled(clusterMode) + // In millis + .setResponseTimeout(250) + // In millis + .setClientCreationTimeout(2500) + .setReadFromReplicaStrategy(ReadFromReplicaStrategy.AlwaysFromPrimary) + .setConnectionRetryStrategy( + ConnectionRetryStrategy.newBuilder() + .setNumberOfRetries(1) + .setFactor(1) + .setExponentBase(1) + .build()) + .setAuthenticationInfo( + AuthenticationInfo.newBuilder().setPassword("").setUsername("default").build()) + .setDatabaseId(0) + .build(); + + var future = new CompletableFuture(); + responses.add(future); + channel.writeAndFlush(request.toByteArray()); + return future; + } + + private CompletableFuture submitNewCommand(RequestType command, List args) { + var commandId = getNextCallback(); + // System.out.printf("== %s(%s), callback %d%n", command, String.join(", ", args), commandId); + + return CompletableFuture.supplyAsync( + () -> { + var commandArgs = ArgsArray.newBuilder(); + for (var arg : args) { + commandArgs.addArgs(arg); + } + + RedisRequest request = + RedisRequest.newBuilder() + .setCallbackIdx(commandId.getKey() + callbackOffset) + .setSingleCommand( + Command.newBuilder() + .setRequestType(command) + .setArgsArray(commandArgs.build()) + .build()) + .setRoute(Routes.newBuilder().setSimpleRoutes(SimpleRoutes.AllNodes).build()) + .build(); + if (ALWAYS_FLUSH_ON_WRITE) { + channel.writeAndFlush(request.toByteArray()); + return commandId.getRight(); + } + channel.write(request.toByteArray()); + return autoFlushFutureWrapper(commandId.getRight()); + }) + .thenCompose(f -> f); + } + + private CompletableFuture autoFlushFutureWrapper(Future future) { + return CompletableFuture.supplyAsync( + () -> { + try { + return future.get(AUTO_FLUSH_RESPONSE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } catch (TimeoutException e) { + // System.out.println("-- auto flush - timeout"); + channel.flush(); + nonFlushedBytesCounter.set(0); + nonFlushedWritesCounter.set(0); + } + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + } + + public Future asyncSet(String key, String value) { + // System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); + return submitNewCommand(RequestType.SetString, List.of(key, value)); + } + + public Future asyncGet(String key) { + // System.out.printf("== get(%s), callback %d%n", key, callbackId); + return submitNewCommand(RequestType.GetString, List.of(key)) + .thenApply( + response -> + response.getRespPointer() != 0 + ? RustWrapper.valueFromPointer(response.getRespPointer()).toString() + : null); + } + + public T waitForResult(Future future) { + return waitForResult(future, DEFAULT_TIMEOUT_MILLISECONDS); + } + + public T waitForResult(Future future, long timeout) { + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (Exception ignored) { + return null; + } + } +} diff --git a/java/client/src/main/java/javababushka/RustWrapper.java b/java/client/src/main/java/javababushka/RustWrapper.java new file mode 100644 index 0000000000..315a3c63a2 --- /dev/null +++ b/java/client/src/main/java/javababushka/RustWrapper.java @@ -0,0 +1,11 @@ +package javababushka; + +public class RustWrapper { + public static native String startSocketListenerExternal() throws Exception; + + public static native Object valueFromPointer(long pointer); + + static { + System.loadLibrary("javababushka"); + } +} diff --git a/java/javababushka_client_RedisClient.h b/java/javababushka_client_RedisClient.h deleted file mode 100644 index a52938203d..0000000000 --- a/java/javababushka_client_RedisClient.h +++ /dev/null @@ -1,37 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class javababushka_client_RedisClient */ - -#ifndef _Included_javababushka_client_RedisClient -#define _Included_javababushka_client_RedisClient -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: javababushka_client_RedisClient - * Method: startSocketListenerExternal - * Signature: (Ljavababushka/client/RedisClient;)V - */ -JNIEXPORT void JNICALL Java_javababushka_client_RedisClient_startSocketListenerExternal__Ljavababushka_client_RedisClient_2 - (JNIEnv *, jclass, jobject); - -/* - * Class: javababushka_client_RedisClient - * Method: startSocketListenerExternal - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_javababushka_client_RedisClient_startSocketListenerExternal__ - (JNIEnv *, jclass); - -/* - * Class: javababushka_client_RedisClient - * Method: valueFromPointer - * Signature: (J)Ljava/lang/Object; - */ -JNIEXPORT jobject JNICALL Java_javababushka_client_RedisClient_valueFromPointer - (JNIEnv *, jclass, jlong); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/java/src/lib.rs b/java/src/lib.rs index f752d9596a..cef7526b5a 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -38,7 +38,7 @@ fn redis_value_to_java(mut env: JNIEnv, val: Value) -> JObject { } #[no_mangle] -pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'local>( +pub extern "system" fn Java_javababushka_RustWrapper_valueFromPointer<'local>( mut env: JNIEnv<'local>, _class: JClass<'local>, pointer: jlong @@ -48,37 +48,7 @@ pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'lo } #[no_mangle] -pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal__Ljavababushka_client_RedisClient_2<'local>( - mut env: JNIEnv<'local>, - _class: JClass<'local>, - callback: JObject<'local> -) { - let jvm = env.get_java_vm().unwrap(); - - let callback = env.new_global_ref(callback).unwrap(); - - let (tx, rx) = mpsc::channel(); - start_socket_listener(move |socket_path| { - // Signals that thread has started - tx.send(()).unwrap(); - let mut env = jvm.attach_current_thread().unwrap(); - match socket_path { - Ok(path) => { - let path = env.new_string(path).unwrap(); - let _ = env.call_method(callback, "initCallback", "(Ljava/lang/String;Ljava/lang/String;)V", &[(&JObject::from(path)).into(), (&JObject::null()).into()]); - }, - Err(error_message) => { - let error_message = env.new_string(error_message).unwrap(); - let _ = env.call_method(callback, "initCallback", "(Ljava/lang/String;Ljava/lang/String;)V", &[(&JObject::null()).into(), (&JObject::from(error_message)).into()]); - } - } - }); - // Wait until the thread has started - rx.recv().unwrap(); -} - -#[no_mangle] -pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal__<'local>( +pub extern "system" fn Java_javababushka_RustWrapper_startSocketListenerExternal<'local>( mut env: JNIEnv<'local>, _class: JClass<'local> ) -> JObject<'local> {