From 035ef20266ed9110c27789c9f0be97d94e4b0782 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 08:23:17 -0700 Subject: [PATCH 01/46] Add Java-client benchmarking app Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java new file mode 100644 index 0000000000..c071ac01ae --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -0,0 +1,237 @@ +package javababushka.benchmarks; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; + +/** Benchmarking app for reporting performance of various redis-rs Java-clients */ +public class BenchmarkingApp { + + // main application entrypoint + public static void main(String[] args) { + + // create the parser + CommandLineParser parser = new DefaultParser(); + Options options = getOptions(); + RunConfiguration runConfiguration = new RunConfiguration(); + try { + // parse the command line arguments + CommandLine line = parser.parse(options, args); + runConfiguration = verifyOptions(line); + } catch (ParseException exp) { + // oops, something went wrong + System.err.println("Parsing failed. Reason: " + exp.getMessage()); + } + + for (ClientName client : runConfiguration.clients) { + switch (client) { + case JEDIS: + // run testClientSetGet on JEDI sync client + System.out.println("Run JEDI sync client"); + break; + case JEDIS_ASYNC: + // run testClientSetGet on JEDI pseudo-async client + System.out.println("Run JEDI pseudo-async client"); + break; + case LETTUCE: + // run testClientSetGet on LETTUCE sync client + System.out.println("Run LETTUCE sync client"); + break; + case LETTUCE_ASYNC: + // run testClientSetGet on LETTUCE async client + System.out.println("Run LETTUCE async client"); + break; + case BABUSHKA: + System.out.println("Babushka not yet configured"); + break; + } + } + + if (runConfiguration.resultsFile.isPresent()) { + try { + runConfiguration.resultsFile.get().close(); + } catch (IOException ioException) { + System.out.println("Error closing results file"); + } + } + } + + private static Options getOptions() { + // create the Options + Options options = new Options(); + + options.addOption("c", "configuration", true, "Configuration flag [Release]"); + options.addOption("f", "resultsFile", true, "Result filepath []"); + options.addOption("d", "dataSize", true, "Data block size [20]"); + options.addOption("C", "concurrentTasks", true, "Number of concurrent tasks [1 10 100]"); + options.addOption( + "l", "clients", true, "one of: all|jedis|jedis_async|lettuce|lettuce_async|babushka [all]"); + options.addOption("h", "host", true, "host url [localhost]"); + options.addOption("p", "port", true, "port number [6379]"); + options.addOption("n", "clientCount", true, "Client count [1]"); + options.addOption("t", "tls", false, "TLS [true]"); + + return options; + } + + private static RunConfiguration verifyOptions(CommandLine line) throws ParseException { + RunConfiguration runConfiguration = new RunConfiguration(); + if (line.hasOption("configuration")) { + String configuration = line.getOptionValue("configuration"); + if (configuration.equalsIgnoreCase("Release") || configuration.equalsIgnoreCase("Debug")) { + runConfiguration.configuration = configuration; + } else { + throw new ParseException("Invalid run configuration (Release|Debug)"); + } + } + + if (line.hasOption("resultsFile")) { + try { + runConfiguration.resultsFile = + Optional.of(new FileWriter(line.getOptionValue("resultsFile"))); + } catch (IOException e) { + throw new ParseException("Unable to write to resultsFile."); + } + } + + if (line.hasOption("dataSize")) { + runConfiguration.dataSize = Integer.parseInt(line.getOptionValue("dataSize")); + } + + if (line.hasOption("concurrentTasks")) { + String concurrentTasks = line.getOptionValue("concurrentTasks"); + + // remove optional square brackets + if (concurrentTasks.startsWith("[") && concurrentTasks.endsWith("]")) { + concurrentTasks = concurrentTasks.substring(1, concurrentTasks.length() - 1); + } + // check if it's the correct format + if (!concurrentTasks.matches("\\d+(\\s+\\d+)?")) { + throw new ParseException("Invalid concurrentTasks"); + } + // split the string into a list of integers + runConfiguration.concurrentTasks = + Arrays.stream(concurrentTasks.split("\\s+")) + .map(Integer::parseInt) + .collect(Collectors.toList()); + } + + if (line.hasOption("clients")) { + String[] clients = line.getOptionValue("clients").split(","); + runConfiguration.clients = + Arrays.stream(clients) + .map(c -> Enum.valueOf(ClientName.class, c.toUpperCase())) + .flatMap( + e -> { + switch (e) { + case ALL: + return Stream.of( + ClientName.JEDIS, + ClientName.JEDIS_ASYNC, + ClientName.BABUSHKA, + ClientName.LETTUCE, + ClientName.LETTUCE_ASYNC); + case ALL_ASYNC: + return Stream.of( + ClientName.JEDIS_ASYNC, + // ClientName.BABUSHKA, + ClientName.LETTUCE_ASYNC); + case ALL_SYNC: + return Stream.of( + ClientName.JEDIS, + // ClientName.BABUSHKA, + ClientName.LETTUCE); + default: + return Stream.of(e); + } + }) + .toArray(ClientName[]::new); + } + + if (line.hasOption("host")) { + runConfiguration.host = line.getOptionValue("host"); + } + + if (line.hasOption("clientCount")) { + String clientCount = line.getOptionValue("clientCount"); + + // check if it's the correct format + if (!clientCount.matches("\\d+(\\s+\\d+)?")) { + throw new ParseException("Invalid concurrentTasks"); + } + // split the string into a list of integers + runConfiguration.clientCount = + Arrays.stream(clientCount.split("\\s+")).mapToInt(Integer::parseInt).toArray(); + } + + if (line.hasOption("tls")) { + runConfiguration.tls = Boolean.parseBoolean(line.getOptionValue("tls")); + } + + return runConfiguration; + } + + public enum ClientName { + JEDIS("Jedis"), + JEDIS_ASYNC("Jedis async"), + LETTUCE("Lettuce"), + LETTUCE_ASYNC("Lettuce async"), + BABUSHKA("Babushka"), + ALL("All"), + ALL_SYNC("All sync"), + ALL_ASYNC("All async"); + + private String name; + + private ClientName(String name) { + this.name = name; + } + + @Override + public String toString() { + return this.name; + } + + public boolean isEqual(String other) { + return this.toString().equalsIgnoreCase(other); + } + } + + public static class RunConfiguration { + public String configuration; + public Optional resultsFile; + public int dataSize; + public List concurrentTasks; + public ClientName[] clients; + public String host; + public int port; + public int[] clientCount; + public boolean tls; + public boolean debugLogging = false; + + public RunConfiguration() { + configuration = "Release"; + resultsFile = Optional.empty(); + dataSize = 20; + concurrentTasks = List.of(10, 100); + clients = + new ClientName[] { + // ClientName.BABUSHKA, + ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + }; + host = "localhost"; + port = 6379; + clientCount = new int[] {1, 2}; + tls = false; + } + } +} \ No newline at end of file From 0883985da5d80ea2578228d67702e9aed5c0188b Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 10:27:25 -0700 Subject: [PATCH 02/46] spotless apply Signed-off-by: acarbonetto --- java/README.md | 2 +- .../benchmarks/BenchmarkingApp.java | 63 ++++++++----------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/java/README.md b/java/README.md index 12ae1966f2..e21777aa57 100644 --- a/java/README.md +++ b/java/README.md @@ -29,7 +29,7 @@ These IDE plugins can auto-format code on file save or by single click: You can run benchmarks using `./gradlew run`. You can set arguments using the args flag like: ```shell -./gradlew run --args="--clients lettuce" +./gradlew run --args="--resultsFile=output.csv --dataSize \"2 5\" --concurrentTasks \"2 10\" --clients all --host localhost --port 6279 --clientCount \"2 5\" --tls" ``` The following arguments are accepted: diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index c071ac01ae..3f9a5ecaa9 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -3,9 +3,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; -import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; @@ -103,26 +101,8 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce } } - if (line.hasOption("dataSize")) { - runConfiguration.dataSize = Integer.parseInt(line.getOptionValue("dataSize")); - } - if (line.hasOption("concurrentTasks")) { - String concurrentTasks = line.getOptionValue("concurrentTasks"); - - // remove optional square brackets - if (concurrentTasks.startsWith("[") && concurrentTasks.endsWith("]")) { - concurrentTasks = concurrentTasks.substring(1, concurrentTasks.length() - 1); - } - // check if it's the correct format - if (!concurrentTasks.matches("\\d+(\\s+\\d+)?")) { - throw new ParseException("Invalid concurrentTasks"); - } - // split the string into a list of integers - runConfiguration.concurrentTasks = - Arrays.stream(concurrentTasks.split("\\s+")) - .map(Integer::parseInt) - .collect(Collectors.toList()); + runConfiguration.concurrentTasks = parseIntListOption(line.getOptionValue("concurrentTasks")); } if (line.hasOption("clients")) { @@ -162,15 +142,11 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce } if (line.hasOption("clientCount")) { - String clientCount = line.getOptionValue("clientCount"); + runConfiguration.clientCount = parseIntListOption(line.getOptionValue("clientCount")); + } - // check if it's the correct format - if (!clientCount.matches("\\d+(\\s+\\d+)?")) { - throw new ParseException("Invalid concurrentTasks"); - } - // split the string into a list of integers - runConfiguration.clientCount = - Arrays.stream(clientCount.split("\\s+")).mapToInt(Integer::parseInt).toArray(); + if (line.hasOption("dataSize")) { + runConfiguration.dataSize = parseIntListOption(line.getOptionValue("dataSize")); } if (line.hasOption("tls")) { @@ -180,6 +156,21 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce return runConfiguration; } + private static int[] parseIntListOption(String line) throws ParseException { + String lineValue = line; + + // remove optional square brackets + if (lineValue.startsWith("[") && lineValue.endsWith("]")) { + lineValue = lineValue.substring(1, lineValue.length() - 1); + } + // check if it's the correct format + if (!lineValue.matches("\\d+(\\s+\\d+)?")) { + throw new ParseException("Invalid option: " + line); + } + // split the string into a list of integers + return Arrays.stream(lineValue.split("\\s+")).mapToInt(Integer::parseInt).toArray(); + } + public enum ClientName { JEDIS("Jedis"), JEDIS_ASYNC("Jedis async"), @@ -209,8 +200,8 @@ public boolean isEqual(String other) { public static class RunConfiguration { public String configuration; public Optional resultsFile; - public int dataSize; - public List concurrentTasks; + public int[] dataSize; + public int[] concurrentTasks; public ClientName[] clients; public String host; public int port; @@ -221,12 +212,12 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; resultsFile = Optional.empty(); - dataSize = 20; - concurrentTasks = List.of(10, 100); + dataSize = new int[] {20}; + concurrentTasks = new int[] {10, 100}; clients = new ClientName[] { - // ClientName.BABUSHKA, - ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + // ClientName.BABUSHKA, + ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC }; host = "localhost"; port = 6379; @@ -234,4 +225,4 @@ public RunConfiguration() { tls = false; } } -} \ No newline at end of file +} From d15ade1782e2a2c6770271af6e8c622107519091 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 10:45:15 -0700 Subject: [PATCH 03/46] Update on command line options Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 3f9a5ecaa9..4ace9930d7 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -8,6 +8,8 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; @@ -24,6 +26,14 @@ public static void main(String[] args) { try { // parse the command line arguments CommandLine line = parser.parse(options, args); + + // generate the help statement + if (line.hasOption("help")) { + HelpFormatter formatter = new HelpFormatter(); + formatter.printHelp("javababushka", options); + return; + } + runConfiguration = verifyOptions(line); } catch (ParseException exp) { // oops, something went wrong @@ -67,22 +77,52 @@ private static Options getOptions() { // create the Options Options options = new Options(); - options.addOption("c", "configuration", true, "Configuration flag [Release]"); - options.addOption("f", "resultsFile", true, "Result filepath []"); - options.addOption("d", "dataSize", true, "Data block size [20]"); - options.addOption("C", "concurrentTasks", true, "Number of concurrent tasks [1 10 100]"); + options.addOption(Option.builder("help").desc("print this message").build()); + options.addOption( + Option.builder("configuration") + .hasArg(true) + .desc("Configuration flag [Release]") + .build()); + options.addOption( + Option.builder("resultsFile") + .hasArg(true) + .desc("Result filepath []") + .build()); + options.addOption( + Option.builder("dataSize") + .hasArg(true) + .desc("Data block size [20]") + .build()); options.addOption( - "l", "clients", true, "one of: all|jedis|jedis_async|lettuce|lettuce_async|babushka [all]"); - options.addOption("h", "host", true, "host url [localhost]"); - options.addOption("p", "port", true, "port number [6379]"); - options.addOption("n", "clientCount", true, "Client count [1]"); - options.addOption("t", "tls", false, "TLS [true]"); + Option.builder("concurrentTasks") + .hasArg(true) + .desc("Number of concurrent tasks [1 10 100]") + .build()); + options.addOption( + Option.builder("clients") + .hasArg(true) + .desc("one of: all|jedis|jedis_async|lettuce|lettuce_async|babushka [all]") + .build()); + options.addOption(Option.builder("host").hasArg(true).desc("").build()); + options.addOption( + Option.builder("port") + .hasArg(true) + .desc("one of: port number [6379]") + .build()); + options.addOption( + Option.builder("clientCount") + .hasArg(true) + .desc("Number of cliens to run [1]") + .build()); + options.addOption( + Option.builder("tls").hasArg(true).desc("TLS [false]").build()); return options; } private static RunConfiguration verifyOptions(CommandLine line) throws ParseException { RunConfiguration runConfiguration = new RunConfiguration(); + if (line.hasOption("configuration")) { String configuration = line.getOptionValue("configuration"); if (configuration.equalsIgnoreCase("Release") || configuration.equalsIgnoreCase("Debug")) { From e3634bafe7c5cde629728c8ccfd447a0aee78312 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 10:50:45 -0700 Subject: [PATCH 04/46] Update README Signed-off-by: acarbonetto --- java/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/README.md b/java/README.md index e21777aa57..40bb289a8a 100644 --- a/java/README.md +++ b/java/README.md @@ -29,7 +29,8 @@ These IDE plugins can auto-format code on file save or by single click: You can run benchmarks using `./gradlew run`. You can set arguments using the args flag like: ```shell -./gradlew run --args="--resultsFile=output.csv --dataSize \"2 5\" --concurrentTasks \"2 10\" --clients all --host localhost --port 6279 --clientCount \"2 5\" --tls" +./gradlew run --args="-help" +./gradlew run --args="-resultsFile=output.csv -dataSize \"2 5\" -concurrentTasks \"2 10\" -clients all -host localhost -port 6279 -clientCount \"2 5\" -tls" ``` The following arguments are accepted: From 500a043975c7a63929ea559c1b5b4f00779d3fc9 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 15:20:08 -0700 Subject: [PATCH 05/46] Spotless apply: Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 4ace9930d7..576a54cea0 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -79,20 +79,10 @@ private static Options getOptions() { options.addOption(Option.builder("help").desc("print this message").build()); options.addOption( - Option.builder("configuration") - .hasArg(true) - .desc("Configuration flag [Release]") - .build()); - options.addOption( - Option.builder("resultsFile") - .hasArg(true) - .desc("Result filepath []") - .build()); + Option.builder("configuration").hasArg(true).desc("Configuration flag [Release]").build()); options.addOption( - Option.builder("dataSize") - .hasArg(true) - .desc("Data block size [20]") - .build()); + Option.builder("resultsFile").hasArg(true).desc("Result filepath []").build()); + options.addOption(Option.builder("dataSize").hasArg(true).desc("Data block size [20]").build()); options.addOption( Option.builder("concurrentTasks") .hasArg(true) @@ -105,17 +95,10 @@ private static Options getOptions() { .build()); options.addOption(Option.builder("host").hasArg(true).desc("").build()); options.addOption( - Option.builder("port") - .hasArg(true) - .desc("one of: port number [6379]") - .build()); - options.addOption( - Option.builder("clientCount") - .hasArg(true) - .desc("Number of cliens to run [1]") - .build()); + Option.builder("port").hasArg(true).desc("one of: port number [6379]").build()); options.addOption( - Option.builder("tls").hasArg(true).desc("TLS [false]").build()); + Option.builder("clientCount").hasArg(true).desc("Number of cliens to run [1]").build()); + options.addOption(Option.builder("tls").hasArg(true).desc("TLS [false]").build()); return options; } From 0bf1678f78663bff985395b6696be9978fc36bef Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 11:59:28 -0700 Subject: [PATCH 06/46] Update README example Signed-off-by: acarbonetto --- java/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/README.md b/java/README.md index 40bb289a8a..f7c3216c2f 100644 --- a/java/README.md +++ b/java/README.md @@ -30,7 +30,7 @@ You can run benchmarks using `./gradlew run`. You can set arguments using the ar ```shell ./gradlew run --args="-help" -./gradlew run --args="-resultsFile=output.csv -dataSize \"2 5\" -concurrentTasks \"2 10\" -clients all -host localhost -port 6279 -clientCount \"2 5\" -tls" +./gradlew run --args="-resultsFile=output.csv -dataSize \"100 1000\" -concurrentTasks \"10 100\" -clients all -host localhost -port 6279 -clientCount \"1 5\" -tls" ``` The following arguments are accepted: From 12efc63a7e3af669a7eec365765230f2e8b4dea9 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 12:16:41 -0700 Subject: [PATCH 07/46] update commandline defaults for review comments Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 69 +++++++++++-------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 576a54cea0..9be52a5082 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -13,7 +13,7 @@ import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -/** Benchmarking app for reporting performance of various redis-rs Java-clients */ +/** Benchmarking app for reporting performance of various Redis Java-clients */ public class BenchmarkingApp { // main application entrypoint @@ -43,12 +43,12 @@ public static void main(String[] args) { for (ClientName client : runConfiguration.clients) { switch (client) { case JEDIS: - // run testClientSetGet on JEDI sync client - System.out.println("Run JEDI sync client"); + // run testClientSetGet on JEDIS sync client + System.out.println("Run JEDIS sync client"); break; case JEDIS_ASYNC: - // run testClientSetGet on JEDI pseudo-async client - System.out.println("Run JEDI pseudo-async client"); + // run testClientSetGet on JEDIS pseudo-async client + System.out.println("Run JEDIS pseudo-async client"); break; case LETTUCE: // run testClientSetGet on LETTUCE sync client @@ -58,8 +58,8 @@ public static void main(String[] args) { // run testClientSetGet on LETTUCE async client System.out.println("Run LETTUCE async client"); break; - case BABUSHKA: - System.out.println("Babushka not yet configured"); + case BABUSHKA_ASYNC: + System.out.println("Babushka async not yet configured"); break; } } @@ -68,7 +68,7 @@ public static void main(String[] args) { try { runConfiguration.resultsFile.get().close(); } catch (IOException ioException) { - System.out.println("Error closing results file"); + System.out.println("Error closing results file: " + ioException.getLocalizedMessage()); } } } @@ -81,23 +81,29 @@ private static Options getOptions() { options.addOption( Option.builder("configuration").hasArg(true).desc("Configuration flag [Release]").build()); options.addOption( - Option.builder("resultsFile").hasArg(true).desc("Result filepath []").build()); - options.addOption(Option.builder("dataSize").hasArg(true).desc("Data block size [20]").build()); + Option.builder("resultsFile") + .hasArg(true) + .desc("Result filepath (stdout if empty) []") + .build()); + options.addOption( + Option.builder("dataSize").hasArg(true).desc("Data block size [100 4000]").build()); options.addOption( Option.builder("concurrentTasks") .hasArg(true) - .desc("Number of concurrent tasks [1 10 100]") + .desc("Number of concurrent tasks [100, 1000]") .build()); options.addOption( Option.builder("clients") .hasArg(true) - .desc("one of: all|jedis|jedis_async|lettuce|lettuce_async|babushka [all]") + .desc( + "one of:" + + " all|jedis|jedis_async|lettuce|lettuce_async|babushka_async|all_async|all_sync" + + " [all]") .build()); - options.addOption(Option.builder("host").hasArg(true).desc("").build()); + options.addOption(Option.builder("host").hasArg(true).desc("Hostname [localhost]").build()); + options.addOption(Option.builder("port").hasArg(true).desc("Port number [6379]").build()); options.addOption( - Option.builder("port").hasArg(true).desc("one of: port number [6379]").build()); - options.addOption( - Option.builder("clientCount").hasArg(true).desc("Number of cliens to run [1]").build()); + Option.builder("clientCount").hasArg(true).desc("Number of clients to run [1]").build()); options.addOption(Option.builder("tls").hasArg(true).desc("TLS [false]").build()); return options; @@ -111,16 +117,21 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce if (configuration.equalsIgnoreCase("Release") || configuration.equalsIgnoreCase("Debug")) { runConfiguration.configuration = configuration; } else { - throw new ParseException("Invalid run configuration (Release|Debug)"); + throw new ParseException( + "Invalid run configuration (" + configuration + "), must be (Release|Debug)"); } } if (line.hasOption("resultsFile")) { + String resultsFileName = line.getOptionValue("resultsFile"); try { - runConfiguration.resultsFile = - Optional.of(new FileWriter(line.getOptionValue("resultsFile"))); - } catch (IOException e) { - throw new ParseException("Unable to write to resultsFile."); + runConfiguration.resultsFile = Optional.of(new FileWriter(resultsFileName)); + } catch (IOException ioException) { + throw new ParseException( + "Unable to write to resultsFile (" + + resultsFileName + + "): " + + ioException.getMessage()); } } @@ -140,18 +151,18 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce return Stream.of( ClientName.JEDIS, ClientName.JEDIS_ASYNC, - ClientName.BABUSHKA, + // ClientName.BABUSHKA_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC); case ALL_ASYNC: return Stream.of( ClientName.JEDIS_ASYNC, - // ClientName.BABUSHKA, + // ClientName.BABUSHKA_ASYNC, ClientName.LETTUCE_ASYNC); case ALL_SYNC: return Stream.of( ClientName.JEDIS, - // ClientName.BABUSHKA, + // ClientName.BABUSHKA_ASYNC, ClientName.LETTUCE); default: return Stream.of(e); @@ -199,7 +210,7 @@ public enum ClientName { JEDIS_ASYNC("Jedis async"), LETTUCE("Lettuce"), LETTUCE_ASYNC("Lettuce async"), - BABUSHKA("Babushka"), + BABUSHKA_ASYNC("Babushka async"), ALL("All"), ALL_SYNC("All sync"), ALL_ASYNC("All async"); @@ -235,16 +246,16 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; resultsFile = Optional.empty(); - dataSize = new int[] {20}; - concurrentTasks = new int[] {10, 100}; + dataSize = new int[] {100, 4000}; + concurrentTasks = new int[] {100, 1000}; clients = new ClientName[] { - // ClientName.BABUSHKA, + // ClientName.BABUSHKA_ASYNC, ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC }; host = "localhost"; port = 6379; - clientCount = new int[] {1, 2}; + clientCount = new int[] {1}; tls = false; } } From 951aa8bf6863865a5f900a64536d4dea22c166fc Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 12:40:15 -0700 Subject: [PATCH 08/46] Remove TLS flag argument from option Signed-off-by: acarbonetto --- .../src/main/java/javababushka/benchmarks/BenchmarkingApp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 9be52a5082..78dc2b5d86 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -104,7 +104,7 @@ private static Options getOptions() { options.addOption(Option.builder("port").hasArg(true).desc("Port number [6379]").build()); options.addOption( Option.builder("clientCount").hasArg(true).desc("Number of clients to run [1]").build()); - options.addOption(Option.builder("tls").hasArg(true).desc("TLS [false]").build()); + options.addOption(Option.builder("tls").hasArg(false).desc("TLS [false]").build()); return options; } From adc0bb6604d783b14550e5bdbf795012cd4804e6 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 08:37:14 -0700 Subject: [PATCH 09/46] Add lettuce clients for benchmarking Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 11 +- .../benchmarks/clients/AsyncClient.java | 19 ++ .../benchmarks/clients/Client.java | 16 ++ .../clients/LettuceAsyncClient.java | 73 +++++ .../benchmarks/clients/LettuceClient.java | 56 ++++ .../benchmarks/clients/SyncClient.java | 10 + .../benchmarks/utils/Benchmarking.java | 260 ++++++++++++++++++ .../benchmarks/utils/ChosenAction.java | 10 + .../benchmarks/utils/ConnectionSettings.java | 16 ++ .../benchmarks/utils/LatencyResults.java | 21 ++ 10 files changed, 488 insertions(+), 4 deletions(-) create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 78dc2b5d86..55b25dbb0d 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -1,10 +1,15 @@ package javababushka.benchmarks; +import static javababushka.benchmarks.utils.Benchmarking.testClientSetGet; + import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; +import javababushka.benchmarks.clients.LettuceClient; +import javababushka.benchmarks.clients.LettuceAsyncClient; +import javababushka.benchmarks.clients.LettuceClient; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; @@ -51,12 +56,10 @@ public static void main(String[] args) { System.out.println("Run JEDIS pseudo-async client"); break; case LETTUCE: - // run testClientSetGet on LETTUCE sync client - System.out.println("Run LETTUCE sync client"); + testClientSetGet(LettuceClient::new, runConfiguration, false); break; case LETTUCE_ASYNC: - // run testClientSetGet on LETTUCE async client - System.out.println("Run LETTUCE async client"); + testClientSetGet(LettuceAsyncClient::new, runConfiguration, true); break; case BABUSHKA_ASYNC: System.out.println("Babushka async not yet configured"); diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java new file mode 100644 index 0000000000..6413829eab --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java @@ -0,0 +1,19 @@ +package javababushka.benchmarks.clients; + +import java.util.concurrent.Future; + +/** + * A Redis client with async capabilities + */ +public interface AsyncClient extends Client { + + long DEFAULT_TIMEOUT = 1000; + + Future asyncSet(String key, String value); + + Future asyncGet(String key); + + T waitForResult(Future future); + + T waitForResult(Future future, long timeout); +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java new file mode 100644 index 0000000000..a3376ccbec --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java @@ -0,0 +1,16 @@ +package javababushka.benchmarks.clients; + +import javababushka.benchmarks.utils.ConnectionSettings; + +/** + * A Redis client interface + */ +public interface Client { + void connectToRedis(); + + void connectToRedis(ConnectionSettings connectionSettings); + + default void closeConnection() {} + + String getName(); +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java new file mode 100644 index 0000000000..40cfd50543 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java @@ -0,0 +1,73 @@ +package javababushka.benchmarks.clients; + +import io.lettuce.core.RedisClient; +import io.lettuce.core.RedisFuture; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.async.RedisAsyncCommands; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import javababushka.benchmarks.utils.ConnectionSettings; + +/** + * A Lettuce client with async capabilities + * see: https://lettuce.io/ + */ +public class LettuceAsyncClient implements AsyncClient { + + RedisClient client; + RedisAsyncCommands asyncCommands; + StatefulRedisConnection connection; + + @Override + public void connectToRedis() { + connectToRedis(new ConnectionSettings("localhost", 6379, false)); + } + + @Override + public void connectToRedis(ConnectionSettings connectionSettings) { + client = + RedisClient.create( + String.format( + "%s://%s:%d", + connectionSettings.useSsl ? "rediss" : "redis", + connectionSettings.host, + connectionSettings.port)); + connection = client.connect(); + asyncCommands = connection.async(); + } + + @Override + public RedisFuture asyncSet(String key, String value) { + return asyncCommands.set(key, value); + } + + @Override + public RedisFuture asyncGet(String key) { + return asyncCommands.get(key); + } + + @Override + public Object waitForResult(Future future) { + return waitForResult(future, DEFAULT_TIMEOUT); + } + + @Override + public Object waitForResult(Future future, long timeoutMS) { + try { + return future.get(timeoutMS, TimeUnit.MILLISECONDS); + } catch (Exception ignored) { + return null; + } + } + + @Override + public void closeConnection() { + connection.close(); + client.shutdown(); + } + + @Override + public String getName() { + return "Lettuce Async"; + } +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java new file mode 100644 index 0000000000..0ce80fac0f --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java @@ -0,0 +1,56 @@ +package javababushka.benchmarks.clients; + +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisStringCommands; +import javababushka.benchmarks.utils.ConnectionSettings; + +/** + * A Lettuce client with sync capabilities + * see: https://lettuce.io/ + */ +public class LettuceClient implements SyncClient { + + RedisClient client; + RedisStringCommands syncCommands; + StatefulRedisConnection connection; + + @Override + public void connectToRedis() { + connectToRedis(new ConnectionSettings("localhost", 6379, false)); + } + + @Override + public void connectToRedis(ConnectionSettings connectionSettings) { + client = + RedisClient.create( + String.format( + "%s://%s:%d", + connectionSettings.useSsl ? "rediss" : "redis", + connectionSettings.host, + connectionSettings.port)); + connection = client.connect(); + syncCommands = connection.sync(); + } + + @Override + public void set(String key, String value) { + syncCommands.set(key, value); + } + + @Override + public String get(String key) { + return (String) syncCommands.get(key); + } + + @Override + public void closeConnection() { + connection.close(); + client.shutdown(); + } + + @Override + public String getName() { + return "Lettuce"; + } +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java new file mode 100644 index 0000000000..fa9ebd397e --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java @@ -0,0 +1,10 @@ +package javababushka.benchmarks.clients; + +/** + * A Redis client with sync capabilities + */ +public interface SyncClient extends Client { + void set(String key, String value); + + String get(String key); +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java new file mode 100644 index 0000000000..b73394a3eb --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -0,0 +1,260 @@ +package javababushka.benchmarks.utils; + +import java.io.FileWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import javababushka.benchmarks.clients.AsyncClient; +import javababushka.benchmarks.BenchmarkingApp; +import javababushka.benchmarks.clients.Client; +import javababushka.benchmarks.clients.SyncClient; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.tuple.Pair; + +/** + * Class to calculate latency on client-actions + */ +public class Benchmarking { + static final double PROB_GET = 0.8; + static final double PROB_GET_EXISTING_KEY = 0.8; + static final int SIZE_GET_KEYSPACE = 3750000; + static final int SIZE_SET_KEYSPACE = 3000000; + static final int ASYNC_OPERATION_TIMEOUT_SEC = 1; + + private static ChosenAction randomAction() { + if (Math.random() > PROB_GET) { + return ChosenAction.SET; + } + if (Math.random() > PROB_GET_EXISTING_KEY) { + return ChosenAction.GET_NON_EXISTING; + } + return ChosenAction.GET_EXISTING; + } + + public static String generateKeyGet() { + int range = SIZE_GET_KEYSPACE - SIZE_SET_KEYSPACE; + return Math.floor(Math.random() * range + SIZE_SET_KEYSPACE + 1) + ""; + } + + public static String generateKeySet() { + return (Math.floor(Math.random() * SIZE_SET_KEYSPACE) + 1) + ""; + } + + public interface Operation { + void go() throws Exception; + } + + private static Pair getLatency(Map actions) { + var action = randomAction(); + long before = System.nanoTime(); + try { + actions.get(action).go(); + } catch (Exception e) { + // timed out - exception from Future::get + } + long after = System.nanoTime(); + return Pair.of(action, after - before); + } + + // Assumption: latencies is sorted in ascending order + private static Long percentile(ArrayList latencies, int percentile) { + int N = latencies.size(); + double n = (N - 1) * percentile / 100. + 1; + if (n == 1d) return latencies.get(0); + else if (n == N) return latencies.get(N - 1); + int k = (int) n; + double d = n - k; + return Math.round(latencies.get(k - 1) + d * (latencies.get(k) - latencies.get(k - 1))); + } + + private static double stdDeviation(ArrayList latencies, Double avgLatency) { + double stdDeviation = + latencies.stream() + .mapToDouble(Long::doubleValue) + .reduce(0.0, (stdDev, latency) -> stdDev + Math.pow(latency - avgLatency, 2)); + return Math.sqrt(stdDeviation / latencies.size()); + } + + // This has the side-effect of sorting each latencies ArrayList + public static Map calculateResults( + Map> actionLatencies) { + Map results = new HashMap(); + + for (Map.Entry> entry : actionLatencies.entrySet()) { + ChosenAction action = entry.getKey(); + ArrayList latencies = entry.getValue(); + + Double avgLatency = + latencies.stream().collect(Collectors.summingLong(Long::longValue)) + / Double.valueOf(latencies.size()); + + Collections.sort(latencies); + results.put( + action, + new LatencyResults( + avgLatency, + percentile(latencies, 50), + percentile(latencies, 90), + percentile(latencies, 99), + stdDeviation(latencies, avgLatency))); + } + + return results; + } + + public static void printResults( + Map calculatedResults, Optional resultsFile) { + if (resultsFile.isPresent()) { + printResults(calculatedResults, resultsFile.get()); + } else { + printResults(calculatedResults); + } + } + + public static void printResults( + Map resultsMap, FileWriter resultsFile) { + for (Map.Entry entry : resultsMap.entrySet()) { + ChosenAction action = entry.getKey(); + LatencyResults results = entry.getValue(); + + try { + resultsFile.write("Avg. time in ms per " + action + ": " + results.avgLatency / 1000000.0); + resultsFile.write(action + " p50 latency in ms: " + results.p50Latency / 1000000.0); + resultsFile.write(action + " p90 latency in ms: " + results.p90Latency / 1000000.0); + resultsFile.write(action + " p99 latency in ms: " + results.p99Latency / 1000000.0); + resultsFile.write(action + " std dev in ms: " + results.stdDeviation / 1000000.0); + } catch (Exception ignored) { + } + } + } + + public static void printResults(Map resultsMap) { + for (Map.Entry entry : resultsMap.entrySet()) { + ChosenAction action = entry.getKey(); + LatencyResults results = entry.getValue(); + + System.out.println("Avg. time in ms per " + action + ": " + results.avgLatency / 1000000.0); + System.out.println(action + " p50 latency in ms: " + results.p50Latency / 1000000.0); + System.out.println(action + " p90 latency in ms: " + results.p90Latency / 1000000.0); + System.out.println(action + " p99 latency in ms: " + results.p99Latency / 1000000.0); + System.out.println(action + " std dev in ms: " + results.stdDeviation / 1000000.0); + } + } + + public static void testClientSetGet( + Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { + for (int concurrentNum : config.concurrentTasks) { + int iterations = Math.min(Math.max(100000, concurrentNum * 10000), 10000000); + for (int clientCount : config.clientCount) { + System.out.printf( + "%n =====> %s <===== %d clients %d concurrent %n%n", + clientCreator.get().getName(), clientCount, concurrentNum); + AtomicInteger iterationCounter = new AtomicInteger(0); + Map> actionResults = + Map.of( + ChosenAction.GET_EXISTING, new ArrayList<>(), + ChosenAction.GET_NON_EXISTING, new ArrayList<>(), + ChosenAction.SET, new ArrayList<>()); + List tasks = new ArrayList<>(); + + // create clients + List clients = new LinkedList<>(); + for (int cc = 0; cc < clientCount; cc++) { + Client newClient = clientCreator.get(); + newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls)); + clients.add(newClient); + } + + for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { + final int taskNumDebugging = taskNum; + tasks.add( + () -> { + int iterationIncrement = iterationCounter.getAndIncrement(); + int clientIndex = iterationIncrement % clients.size(); + + if (config.debugLogging) { + System.out.printf( + "%n concurrent = %d/%d, client# = %d/%d%n", + taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); + } + while (iterationIncrement < iterations) { + if (config.debugLogging) { + System.out.printf( + "> iteration = %d/%d, client# = %d/%d%n", + iterationIncrement + 1, iterations, clientIndex + 1, clientCount); + } + // operate and calculate tik-tok + Pair result = + measurePerformance(clients.get(clientIndex), config.dataSize, async); + actionResults.get(result.getLeft()).add(result.getRight()); + + iterationIncrement = iterationCounter.getAndIncrement(); + } + }); + } + if (config.debugLogging) { + System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); + System.out.printf( + "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", + concurrentNum, clientCount, tasks.size()); + } + tasks.stream() + .map(CompletableFuture::runAsync) + .forEach( + f -> { + try { + f.get(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + printResults(calculateResults(actionResults), config.resultsFile); + } + } + + System.out.println(); + } + + public static Pair measurePerformance( + Client client, int dataSize, boolean async) { + + String value = RandomStringUtils.randomAlphanumeric(dataSize); + Map actions = new HashMap<>(); + actions.put( + ChosenAction.GET_EXISTING, + async + ? () -> + ((AsyncClient) client) + .asyncGet(generateKeySet()) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + : () -> ((SyncClient) client).get(generateKeySet())); + actions.put( + ChosenAction.GET_NON_EXISTING, + async + ? () -> + ((AsyncClient) client) + .asyncGet(generateKeyGet()) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + : () -> ((SyncClient) client).get(generateKeyGet())); + actions.put( + ChosenAction.SET, + async + ? () -> + ((AsyncClient) client) + .asyncSet(generateKeySet(), value) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + : () -> ((SyncClient) client).set(generateKeySet(), value)); + + return getLatency(actions); + } +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java new file mode 100644 index 0000000000..3cc685139e --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java @@ -0,0 +1,10 @@ +package javababushka.benchmarks.utils; + +/** + * enum for actions + */ +public enum ChosenAction { + GET_NON_EXISTING, + GET_EXISTING, + SET +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java new file mode 100644 index 0000000000..f1aee3d06a --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java @@ -0,0 +1,16 @@ +package javababushka.benchmarks.utils; + +/** + * Redis-client settings + */ +public class ConnectionSettings { + public String host; + public int port; + public boolean useSsl; + + public ConnectionSettings(String host, int port, boolean useSsl) { + this.host = host; + this.port = port; + this.useSsl = useSsl; + } +} \ No newline at end of file diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java new file mode 100644 index 0000000000..054623b8f0 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java @@ -0,0 +1,21 @@ +package javababushka.benchmarks.utils; + +/** + * Raw timing results in nanoseconds + */ +public class LatencyResults { + public final double avgLatency; + public final long p50Latency; + public final long p90Latency; + public final long p99Latency; + public final double stdDeviation; + + public LatencyResults( + double avgLatency, long p50Latency, long p90Latency, long p99Latency, double stdDeviation) { + this.avgLatency = avgLatency; + this.p50Latency = p50Latency; + this.p90Latency = p90Latency; + this.p99Latency = p99Latency; + this.stdDeviation = stdDeviation; + } +} \ No newline at end of file From 9fc90221cbf070c81f29f66bfd3f95bf6e8460b9 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 08:39:15 -0700 Subject: [PATCH 10/46] Spotless apply Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 1 - .../benchmarks/clients/AsyncClient.java | 6 ++--- .../benchmarks/clients/Client.java | 6 ++--- .../clients/LettuceAsyncClient.java | 5 +--- .../benchmarks/clients/LettuceClient.java | 7 ++--- .../benchmarks/clients/SyncClient.java | 6 ++--- .../benchmarks/utils/Benchmarking.java | 26 +++++++++---------- .../benchmarks/utils/ChosenAction.java | 6 ++--- .../benchmarks/utils/ConnectionSettings.java | 6 ++--- .../benchmarks/utils/LatencyResults.java | 6 ++--- 10 files changed, 27 insertions(+), 48 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 55b25dbb0d..9756115cc1 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -7,7 +7,6 @@ import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; -import javababushka.benchmarks.clients.LettuceClient; import javababushka.benchmarks.clients.LettuceAsyncClient; import javababushka.benchmarks.clients.LettuceClient; import org.apache.commons.cli.CommandLine; 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 6413829eab..f35a233cfa 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java @@ -2,9 +2,7 @@ import java.util.concurrent.Future; -/** - * A Redis client with async capabilities - */ +/** A Redis client with async capabilities */ public interface AsyncClient extends Client { long DEFAULT_TIMEOUT = 1000; @@ -16,4 +14,4 @@ public interface AsyncClient extends Client { T waitForResult(Future future); T waitForResult(Future future, long timeout); -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java index a3376ccbec..d95f31f25d 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/Client.java @@ -2,9 +2,7 @@ import javababushka.benchmarks.utils.ConnectionSettings; -/** - * A Redis client interface - */ +/** A Redis client interface */ public interface Client { void connectToRedis(); @@ -13,4 +11,4 @@ public interface Client { default void closeConnection() {} String getName(); -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java index 40cfd50543..7251953845 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java @@ -8,10 +8,7 @@ import java.util.concurrent.TimeUnit; import javababushka.benchmarks.utils.ConnectionSettings; -/** - * A Lettuce client with async capabilities - * see: https://lettuce.io/ - */ +/** A Lettuce client with async capabilities see: https://lettuce.io/ */ public class LettuceAsyncClient implements AsyncClient { RedisClient client; diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java index 0ce80fac0f..674fb729b0 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java @@ -5,10 +5,7 @@ import io.lettuce.core.api.sync.RedisStringCommands; import javababushka.benchmarks.utils.ConnectionSettings; -/** - * A Lettuce client with sync capabilities - * see: https://lettuce.io/ - */ +/** A Lettuce client with sync capabilities see: https://lettuce.io/ */ public class LettuceClient implements SyncClient { RedisClient client; @@ -53,4 +50,4 @@ public void closeConnection() { public String getName() { return "Lettuce"; } -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java index fa9ebd397e..603f91e936 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/SyncClient.java @@ -1,10 +1,8 @@ package javababushka.benchmarks.clients; -/** - * A Redis client with sync capabilities - */ +/** A Redis client with sync capabilities */ public interface SyncClient extends Client { void set(String key, String value); String get(String key); -} \ No newline at end of file +} 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 b73394a3eb..6956944fd0 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -13,16 +13,14 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import java.util.stream.Collectors; -import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.BenchmarkingApp; +import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.Client; import javababushka.benchmarks.clients.SyncClient; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.tuple.Pair; -/** - * Class to calculate latency on client-actions - */ +/** Class to calculate latency on client-actions */ public class Benchmarking { static final double PROB_GET = 0.8; static final double PROB_GET_EXISTING_KEY = 0.8; @@ -234,27 +232,27 @@ public static Pair measurePerformance( ChosenAction.GET_EXISTING, async ? () -> - ((AsyncClient) client) - .asyncGet(generateKeySet()) - .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + ((AsyncClient) client) + .asyncGet(generateKeySet()) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) : () -> ((SyncClient) client).get(generateKeySet())); actions.put( ChosenAction.GET_NON_EXISTING, async ? () -> - ((AsyncClient) client) - .asyncGet(generateKeyGet()) - .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + ((AsyncClient) client) + .asyncGet(generateKeyGet()) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) : () -> ((SyncClient) client).get(generateKeyGet())); actions.put( ChosenAction.SET, async ? () -> - ((AsyncClient) client) - .asyncSet(generateKeySet(), value) - .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) + ((AsyncClient) client) + .asyncSet(generateKeySet(), value) + .get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS) : () -> ((SyncClient) client).set(generateKeySet(), value)); return getLatency(actions); } -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java index 3cc685139e..b6bfe118ee 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java @@ -1,10 +1,8 @@ package javababushka.benchmarks.utils; -/** - * enum for actions - */ +/** enum for actions */ public enum ChosenAction { GET_NON_EXISTING, GET_EXISTING, SET -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java index f1aee3d06a..1866908835 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java @@ -1,8 +1,6 @@ package javababushka.benchmarks.utils; -/** - * Redis-client settings - */ +/** Redis-client settings */ public class ConnectionSettings { public String host; public int port; @@ -13,4 +11,4 @@ public ConnectionSettings(String host, int port, boolean useSsl) { this.port = port; this.useSsl = useSsl; } -} \ No newline at end of file +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java index 054623b8f0..4f62f840c0 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java @@ -1,8 +1,6 @@ package javababushka.benchmarks.utils; -/** - * Raw timing results in nanoseconds - */ +/** Raw timing results in nanoseconds */ public class LatencyResults { public final double avgLatency; public final long p50Latency; @@ -18,4 +16,4 @@ public LatencyResults( this.p99Latency = p99Latency; this.stdDeviation = stdDeviation; } -} \ No newline at end of file +} From 111fc26eb135fc9997df3bdda98eb9672d772590 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 09:59:17 -0700 Subject: [PATCH 11/46] Add Jedis clients Signed-off-by: acarbonetto --- .../benchmarks/clients/JedisClient.java | 58 +++++++++++++++++++ .../clients/JedisPseudoAsyncClient.java | 42 ++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java new file mode 100644 index 0000000000..d48e0eeeea --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java @@ -0,0 +1,58 @@ +package javababushka.benchmarks.clients; + +import javababushka.benchmarks.utils.ConnectionSettings; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +/** A jedis client with sync capabilities. See: https://github.com/redis/jedis */ +public class JedisClient implements SyncClient { + + public static final String DEFAULT_HOST = "localhost"; + public static final int DEFAULT_PORT = 6379; + + protected Jedis jedisResource; + + @Override + public void connectToRedis() { + JedisPool pool = new JedisPool(DEFAULT_HOST, DEFAULT_PORT); + jedisResource = pool.getResource(); + } + + @Override + public void closeConnection() { + try { + jedisResource.close(); + } catch (Exception ignored) { + } + } + + @Override + public String getName() { + return "Jedis"; + } + + @Override + public void connectToRedis(ConnectionSettings connectionSettings) { + jedisResource = + new Jedis(connectionSettings.host, connectionSettings.port, connectionSettings.useSsl); + jedisResource.connect(); + } + + public String info() { + return jedisResource.info(); + } + + public String info(String section) { + return jedisResource.info(section); + } + + @Override + public void set(String key, String value) { + jedisResource.set(key, value); + } + + @Override + public String get(String key) { + return jedisResource.get(key); + } +} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java new file mode 100644 index 0000000000..1aff543c6f --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java @@ -0,0 +1,42 @@ +package javababushka.benchmarks.clients; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +/** + * A jedis client with pseudo-sync capabilities. Jedis doesn't provide async API + * https://github.com/redis/jedis/issues/241 + * + *

See: https://github.com/redis/jedis + */ +public class JedisPseudoAsyncClient extends JedisClient implements AsyncClient { + @Override + public Future asyncSet(String key, String value) { + return CompletableFuture.runAsync(() -> super.set(key, value)); + } + + @Override + public Future asyncGet(String key) { + return CompletableFuture.supplyAsync(() -> super.get(key)); + } + + @Override + public T waitForResult(Future future) { + return waitForResult(future, DEFAULT_TIMEOUT); + } + + @Override + public T waitForResult(Future future, long timeout) { + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (Exception ignored) { + return null; + } + } + + @Override + public String getName() { + return "Jedis pseudo-async"; + } +} From 9236e9a4d09434a0a6cf808ad83be859d684aa1b Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 10:00:29 -0700 Subject: [PATCH 12/46] Add to app Signed-off-by: acarbonetto --- .../main/java/javababushka/benchmarks/BenchmarkingApp.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 9756115cc1..a94438e96d 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -7,6 +7,8 @@ import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; +import javababushka.benchmarks.clients.JedisClient; +import javababushka.benchmarks.clients.JedisPseudoAsyncClient; import javababushka.benchmarks.clients.LettuceAsyncClient; import javababushka.benchmarks.clients.LettuceClient; import org.apache.commons.cli.CommandLine; @@ -48,11 +50,11 @@ public static void main(String[] args) { switch (client) { case JEDIS: // run testClientSetGet on JEDIS sync client - System.out.println("Run JEDIS sync client"); + testClientSetGet(JedisClient::new, runConfiguration, false); break; case JEDIS_ASYNC: // run testClientSetGet on JEDIS pseudo-async client - System.out.println("Run JEDIS pseudo-async client"); + testClientSetGet(JedisPseudoAsyncClient::new, runConfiguration, true); break; case LETTUCE: testClientSetGet(LettuceClient::new, runConfiguration, false); From 49654c3f36fd1a445e80703ffcc1777da75ad7df Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Tue, 10 Oct 2023 15:54:39 -0700 Subject: [PATCH 13/46] Add for-loop for data size list Signed-off-by: acarbonetto --- .../benchmarks/utils/Benchmarking.java | 147 ++++++++++-------- 1 file changed, 82 insertions(+), 65 deletions(-) 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 6956944fd0..fc1a2a7fce 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -27,6 +27,10 @@ public class Benchmarking { static final int SIZE_GET_KEYSPACE = 3750000; static final int SIZE_SET_KEYSPACE = 3000000; static final int ASYNC_OPERATION_TIMEOUT_SEC = 1; + static final double LATENCY_NORMALIZATION = 1000000.0; + static final int LATENCY_MIN = 100000; + static final int LATENCY_MAX = 10000000; + static final int LATENCY_MULTIPLIER = 10000; private static ChosenAction randomAction() { if (Math.random() > PROB_GET) { @@ -125,11 +129,16 @@ public static void printResults( LatencyResults results = entry.getValue(); try { - resultsFile.write("Avg. time in ms per " + action + ": " + results.avgLatency / 1000000.0); - resultsFile.write(action + " p50 latency in ms: " + results.p50Latency / 1000000.0); - resultsFile.write(action + " p90 latency in ms: " + results.p90Latency / 1000000.0); - resultsFile.write(action + " p99 latency in ms: " + results.p99Latency / 1000000.0); - resultsFile.write(action + " std dev in ms: " + results.stdDeviation / 1000000.0); + resultsFile.write( + "Avg. time in ms per " + action + ": " + results.avgLatency / LATENCY_NORMALIZATION); + resultsFile.write( + action + " p50 latency in ms: " + results.p50Latency / LATENCY_NORMALIZATION); + resultsFile.write( + action + " p90 latency in ms: " + results.p90Latency / LATENCY_NORMALIZATION); + resultsFile.write( + action + " p99 latency in ms: " + results.p99Latency / LATENCY_NORMALIZATION); + resultsFile.write( + action + " std dev in ms: " + results.stdDeviation / LATENCY_NORMALIZATION); } catch (Exception ignored) { } } @@ -140,83 +149,91 @@ public static void printResults(Map resultsMap) { ChosenAction action = entry.getKey(); LatencyResults results = entry.getValue(); - System.out.println("Avg. time in ms per " + action + ": " + results.avgLatency / 1000000.0); - System.out.println(action + " p50 latency in ms: " + results.p50Latency / 1000000.0); - System.out.println(action + " p90 latency in ms: " + results.p90Latency / 1000000.0); - System.out.println(action + " p99 latency in ms: " + results.p99Latency / 1000000.0); - System.out.println(action + " std dev in ms: " + results.stdDeviation / 1000000.0); + System.out.println( + "Avg. time in ms per " + action + ": " + results.avgLatency / LATENCY_NORMALIZATION); + System.out.println( + action + " p50 latency in ms: " + results.p50Latency / LATENCY_NORMALIZATION); + System.out.println( + action + " p90 latency in ms: " + results.p90Latency / LATENCY_NORMALIZATION); + System.out.println( + action + " p99 latency in ms: " + results.p99Latency / LATENCY_NORMALIZATION); + System.out.println( + action + " std dev in ms: " + results.stdDeviation / LATENCY_NORMALIZATION); } } public static void testClientSetGet( Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { - int iterations = Math.min(Math.max(100000, concurrentNum * 10000), 10000000); + int iterations = + Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); for (int clientCount : config.clientCount) { - System.out.printf( - "%n =====> %s <===== %d clients %d concurrent %n%n", - clientCreator.get().getName(), clientCount, concurrentNum); - AtomicInteger iterationCounter = new AtomicInteger(0); - Map> actionResults = - Map.of( - ChosenAction.GET_EXISTING, new ArrayList<>(), - ChosenAction.GET_NON_EXISTING, new ArrayList<>(), - ChosenAction.SET, new ArrayList<>()); - List tasks = new ArrayList<>(); + for (int dataSize : config.dataSize) { + System.out.printf( + "%n =====> %s <===== %d clients %d concurrent %d data %n%n", + clientCreator.get().getName(), clientCount, concurrentNum, dataSize); + AtomicInteger iterationCounter = new AtomicInteger(0); + Map> actionResults = + Map.of( + ChosenAction.GET_EXISTING, new ArrayList<>(), + ChosenAction.GET_NON_EXISTING, new ArrayList<>(), + ChosenAction.SET, new ArrayList<>()); + List tasks = new ArrayList<>(); - // create clients - List clients = new LinkedList<>(); - for (int cc = 0; cc < clientCount; cc++) { - Client newClient = clientCreator.get(); - newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls)); - clients.add(newClient); - } + // create clients + List clients = new LinkedList<>(); + for (int cc = 0; cc < clientCount; cc++) { + Client newClient = clientCreator.get(); + newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls)); + clients.add(newClient); + } - for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { - final int taskNumDebugging = taskNum; - tasks.add( - () -> { - int iterationIncrement = iterationCounter.getAndIncrement(); - int clientIndex = iterationIncrement % clients.size(); + for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { + final int taskNumDebugging = taskNum; + tasks.add( + () -> { + int iterationIncrement = iterationCounter.getAndIncrement(); + int clientIndex = iterationIncrement % clients.size(); - if (config.debugLogging) { - System.out.printf( - "%n concurrent = %d/%d, client# = %d/%d%n", - taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); - } - while (iterationIncrement < iterations) { if (config.debugLogging) { System.out.printf( - "> iteration = %d/%d, client# = %d/%d%n", - iterationIncrement + 1, iterations, clientIndex + 1, clientCount); + "%n concurrent = %d/%d, client# = %d/%d%n", + taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); } - // operate and calculate tik-tok - Pair result = - measurePerformance(clients.get(clientIndex), config.dataSize, async); - actionResults.get(result.getLeft()).add(result.getRight()); + while (iterationIncrement < iterations) { + if (config.debugLogging) { + System.out.printf( + "> iteration = %d/%d, client# = %d/%d%n", + iterationIncrement + 1, iterations, clientIndex + 1, clientCount); + } + // operate and calculate tik-tok + Pair result = + measurePerformance(clients.get(clientIndex), dataSize, async); + actionResults.get(result.getLeft()).add(result.getRight()); - iterationIncrement = iterationCounter.getAndIncrement(); - } - }); - } - if (config.debugLogging) { - System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); - System.out.printf( - "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", - concurrentNum, clientCount, tasks.size()); - } - tasks.stream() - .map(CompletableFuture::runAsync) - .forEach( - f -> { - try { - f.get(); - } catch (Exception e) { - e.printStackTrace(); + iterationIncrement = iterationCounter.getAndIncrement(); } }); + } + if (config.debugLogging) { + System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); + System.out.printf( + "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", + concurrentNum, clientCount, tasks.size()); + } + tasks.stream() + .map(CompletableFuture::runAsync) + .forEach( + f -> { + try { + f.get(); + } catch (Exception e) { + e.printStackTrace(); + } + }); - printResults(calculateResults(actionResults), config.resultsFile); + printResults(calculateResults(actionResults), config.resultsFile); + } } } From b3284c1b5864618281a8cfe49ef3640a85f0a8d5 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 13:42:30 -0700 Subject: [PATCH 14/46] Add TPS for all async items Signed-off-by: acarbonetto --- .../benchmarks/utils/Benchmarking.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 fc1a2a7fce..70f17facec 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -1,6 +1,7 @@ package javababushka.benchmarks.utils; import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -221,6 +222,7 @@ public static void testClientSetGet( "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", concurrentNum, clientCount, tasks.size()); } + long before = System.nanoTime(); tasks.stream() .map(CompletableFuture::runAsync) .forEach( @@ -231,8 +233,22 @@ public static void testClientSetGet( e.printStackTrace(); } }); + long after = System.nanoTime(); + // print results per action printResults(calculateResults(actionResults), config.resultsFile); + + // print TPS + if (config.resultsFile.isPresent()) { + try { + config.resultsFile.get().append( + "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + } catch (IOException ignored) { + } + } else { + System.out.println( + "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + } } } } From 8f1dfa5e59429ffb44e4efcb2e3ff1eb8335744c Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 13:43:45 -0700 Subject: [PATCH 15/46] spotless apply Signed-off-by: acarbonetto --- .../java/javababushka/benchmarks/utils/Benchmarking.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 70f17facec..1bd05b3993 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -241,8 +241,11 @@ public static void testClientSetGet( // print TPS if (config.resultsFile.isPresent()) { try { - config.resultsFile.get().append( - "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + config + .resultsFile + .get() + .append( + "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); } catch (IOException ignored) { } } else { From 7f690cf2a0475fb7799e41f2876b040ca2ef7585 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 14:19:13 -0700 Subject: [PATCH 16/46] Fix TPS calculations Signed-off-by: acarbonetto --- .../benchmarks/utils/Benchmarking.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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 1bd05b3993..1289c29c58 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -32,6 +32,7 @@ public class Benchmarking { static final int LATENCY_MIN = 100000; static final int LATENCY_MAX = 10000000; static final int LATENCY_MULTIPLIER = 10000; + static final double TPS_NORMALIZATION = 1000000000.0; // nano to seconds private static ChosenAction randomAction() { if (Math.random() > PROB_GET) { @@ -130,15 +131,15 @@ public static void printResults( LatencyResults results = entry.getValue(); try { - resultsFile.write( + resultsFile.append( "Avg. time in ms per " + action + ": " + results.avgLatency / LATENCY_NORMALIZATION); - resultsFile.write( + resultsFile.append( action + " p50 latency in ms: " + results.p50Latency / LATENCY_NORMALIZATION); - resultsFile.write( + resultsFile.append( action + " p90 latency in ms: " + results.p90Latency / LATENCY_NORMALIZATION); - resultsFile.write( + resultsFile.append( action + " p99 latency in ms: " + results.p99Latency / LATENCY_NORMALIZATION); - resultsFile.write( + resultsFile.append( action + " std dev in ms: " + results.stdDeviation / LATENCY_NORMALIZATION); } catch (Exception ignored) { } @@ -244,13 +245,13 @@ public static void testClientSetGet( config .resultsFile .get() - .append( - "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + .append("TPS: %s%n" + (iterations / ((after - before) / TPS_NORMALIZATION))); } catch (IOException ignored) { } } else { - System.out.println( - "Avg. time in ms: " + (after - before) / iterations / LATENCY_NORMALIZATION); + System.out.println("Runtime: " + ((after - before) / TPS_NORMALIZATION)); + System.out.println("Iterations: " + iterations); + System.out.printf("TPS: %s%n", (iterations / ((after - before) / TPS_NORMALIZATION))); } } } From d00a655564465ca063fa4bbf032e5bec7bdf3a65 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 11 Oct 2023 14:34:55 -0700 Subject: [PATCH 17/46] Accept TLS as a flag Signed-off-by: acarbonetto --- .../main/java/javababushka/benchmarks/BenchmarkingApp.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 78dc2b5d86..ae87c269f7 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -183,9 +183,7 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce runConfiguration.dataSize = parseIntListOption(line.getOptionValue("dataSize")); } - if (line.hasOption("tls")) { - runConfiguration.tls = Boolean.parseBoolean(line.getOptionValue("tls")); - } + runConfiguration.tls = line.hasOption("tls"); return runConfiguration; } From 8dcfec0cb398611ed4b4d14774b6f7cddd055276 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Thu, 12 Oct 2023 11:11:34 -0700 Subject: [PATCH 18/46] Start threads; then wait for results Signed-off-by: acarbonetto --- .../benchmarks/utils/Benchmarking.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) 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 1289c29c58..646ee4a809 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -224,16 +224,26 @@ public static void testClientSetGet( concurrentNum, clientCount, tasks.size()); } long before = System.nanoTime(); - tasks.stream() - .map(CompletableFuture::runAsync) - .forEach( - f -> { - try { - f.get(); - } catch (Exception e) { - e.printStackTrace(); - } - }); + + // create threads and add them to the asyncpool. + // This will start execution of all the concurrent tasks. + List asyncTasks = + tasks.stream().map(CompletableFuture::runAsync).collect(Collectors.toList()); + try { + // wait 1 second before waiting for threads to complete + Thread.sleep(1000); + } catch (InterruptedException interruptedException) { + interruptedException.printStackTrace(); + } + // wait for all futures to complete + asyncTasks.forEach( + future -> { + try { + future.get(); + } catch (Exception e) { + e.printStackTrace(); + } + }); long after = System.nanoTime(); // print results per action From a615f8ae6ecb963f52abec7ba0154fc9c4502c36 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Wed, 18 Oct 2023 13:00:17 -0700 Subject: [PATCH 19/46] Add java-jni client Signed-off-by: acarbonetto --- java/Cargo.toml | 2 +- java/benchmarks/build.gradle | 4 + java/benchmarks/hs_err_pid70704.log | 898 +++ .../benchmarks/BenchmarkingApp.java | 5 + .../benchmarks/clients/JniSyncClient.java | 307 + .../benchmarks/utils/Benchmarking.java | 6 +- .../benchmarks/utils/LatencyResults.java | 5 +- .../client/ConnectionRequestOuterClass.java | 4289 ++++++++++ .../java/javababushka/client/RedisClient.java | 27 + .../client/RedisRequestOuterClass.java | 6972 +++++++++++++++++ .../client/ResponseOuterClass.java | 2283 ++++++ java/src/lib.rs | 76 + 12 files changed, 14871 insertions(+), 3 deletions(-) create mode 100644 java/benchmarks/hs_err_pid70704.log create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java create mode 100644 java/benchmarks/src/main/java/javababushka/client/RedisClient.java create mode 100644 java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java create mode 100644 java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java diff --git a/java/Cargo.toml b/java/Cargo.toml index 8046f3578c..197bb4d4bc 100644 --- a/java/Cargo.toml +++ b/java/Cargo.toml @@ -1,4 +1,3 @@ - [package] name = "javababushka" version = "0.0.0" @@ -16,6 +15,7 @@ babushka = { path = "../babushka-core" } tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] } logger_core = {path = "../logger_core"} tracing-subscriber = "0.3.16" +jni = "0.21.1" [profile.release] lto = true diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index 8d9e500284..1fb3c2a7e1 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -18,6 +18,9 @@ dependencies { implementation 'io.lettuce:lettuce-core:6.2.6.RELEASE' implementation 'commons-cli:commons-cli:1.5.0' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' + + // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java + implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.24.3' } // Apply a specific Java toolchain to ease working on different environments. @@ -30,6 +33,7 @@ java { application { // Define the main class for the application. mainClass = 'javababushka.benchmarks.BenchmarkingApp' + applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/debug" } tasks.withType(Test) { diff --git a/java/benchmarks/hs_err_pid70704.log b/java/benchmarks/hs_err_pid70704.log new file mode 100644 index 0000000000..1916741072 --- /dev/null +++ b/java/benchmarks/hs_err_pid70704.log @@ -0,0 +1,898 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# SIGSEGV (0xb) at pc=0x000000013000c7b0, pid=70704, tid=8451 +# +# JRE version: OpenJDK Runtime Environment Corretto-17.0.3.6.1 (17.0.3+6) (build 17.0.3+6-LTS) +# Java VM: OpenJDK 64-Bit Server VM Corretto-17.0.3.6.1 (17.0.3+6-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64) +# Problematic frame: +# C [libjavababushka.dylib+0xc7b0] Java_javababushka_client_RedisClient_valueFromPointer+0x50 +# +# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again +# +# If you would like to submit a bug report, please visit: +# https://github.com/corretto/corretto-17/issues/ +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- S U M M A R Y ------------ + +Command Line: -Djava.library.path=/Users/andrewc/git/bq/babushka-go/java/benchmarks/../target/debug -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant javababushka.benchmarks.BenchmarkingApp -clients babushka_jni -dataSize 10 -concurrentTasks 1 -clientCount 1 + +Host: "MacBookPro18,2" arm64, 10 cores, 64G, Darwin 22.6.0, macOS 13.6 (22G120) +Time: Wed Oct 18 12:45:41 2023 PDT elapsed time: 0.328538 seconds (0d 0h 0m 0s) + +--------------- T H R E A D --------------- + +Current thread (0x0000000137808200): JavaThread "main" [_thread_in_native, id=8451, stack(0x000000016f8d0000,0x000000016fad3000)] + +Stack: [0x000000016f8d0000,0x000000016fad3000], sp=0x000000016fad2800, free space=2058k +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [libjavababushka.dylib+0xc7b0] Java_javababushka_client_RedisClient_valueFromPointer+0x50 +j javababushka.client.RedisClient.valueFromPointer(J)Ljava/lang/Object;+0 +j javababushka.benchmarks.clients.JniSyncClient.connectToRedis(Ljavababushka/benchmarks/utils/ConnectionSettings;)V+12 +j javababushka.benchmarks.utils.Benchmarking.testClientSetGet(Ljava/util/function/Supplier;Ljavababushka/benchmarks/BenchmarkingApp$RunConfiguration;Z)V+261 +j javababushka.benchmarks.BenchmarkingApp.main([Ljava/lang/String;)V+219 +v ~StubRoutines::call_stub +V [libjvm.dylib+0x46bf5c] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x390 +V [libjvm.dylib+0x4d0898] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*)+0x110 +V [libjvm.dylib+0x4d3f1c] jni_CallStaticVoidMethod+0x130 +C [libjli.dylib+0x5310] JavaMain+0xa80 +C [libjli.dylib+0x7608] ThreadJavaMain+0xc +C [libsystem_pthread.dylib+0x6fa8] _pthread_start+0x94 + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +j javababushka.client.RedisClient.valueFromPointer(J)Ljava/lang/Object;+0 +j javababushka.benchmarks.clients.JniSyncClient.connectToRedis(Ljavababushka/benchmarks/utils/ConnectionSettings;)V+12 +j javababushka.benchmarks.utils.Benchmarking.testClientSetGet(Ljava/util/function/Supplier;Ljavababushka/benchmarks/BenchmarkingApp$RunConfiguration;Z)V+261 +j javababushka.benchmarks.BenchmarkingApp.main([Ljava/lang/String;)V+219 +v ~StubRoutines::call_stub + +siginfo: si_signo: 11 (SIGSEGV), si_code: 2 (SEGV_ACCERR), si_addr: 0x0000000000000000 + +Register to memory mapping: + + x0=0x00000001378084a8 points into unknown readable memory: 0x00000001022f28c8 | c8 28 2f 02 01 00 00 00 + x1=0x000000016fad2908 is pointing into the stack for thread: 0x0000000137808200 + x2=0x0 is NULL + x3=0x0 is NULL + x4=0x0000000000000001 is an unknown value + x5=0x0 is NULL + x6=0x00000000000000d6 is an unknown value + x7=0x0000000137808200 is a thread + x8=0x0 is NULL + x9=0x0000000137808538 points into unknown readable memory: 0x0000000000000004 | 04 00 00 00 00 00 00 00 +x10=0x000000013000c760: Java_javababushka_client_RedisClient_valueFromPointer+0 in /Users/andrewc/git/bq/babushka-go/java/target/debug/libjavababushka.dylib at 0x0000000130000000 +x11=0x0000000000000002 is an unknown value +x12={method} {0x0000000122424fc8} 'valueFromPointer' '(J)Ljava/lang/Object;' in 'javababushka/client/RedisClient' +x13={method} {0x0000000122424fc8} 'valueFromPointer' '(J)Ljava/lang/Object;' in 'javababushka/client/RedisClient' +x14=0x000000009aa4306a is an unknown value +x15=0x000000009a842ffb is an unknown value +x16=0x000000019a414d04: pthread_jit_write_protect_np+0 in /usr/lib/system/libsystem_pthread.dylib at 0x000000019a40d000 +x17=0x000000043fa3c270 is an oop: java.lang.Class +{0x000000043fa3c270} - klass: 'java/lang/Class' + - ---- fields (total size 14 words): + - private volatile transient 'classRedefinedCount' 'I' @12 0 + - private volatile transient 'cachedConstructor' 'Ljava/lang/reflect/Constructor;' @40 NULL (0) + - private transient 'name' 'Ljava/lang/String;' @44 "javababushka.client.RedisClient"{0x000000043fa3c2f0} (87f4785e) + - private transient 'module' 'Ljava/lang/Module;' @48 a 'java/lang/Module'{0x00000007ff7571e8} (ffeeae3d) + - private final 'classLoader' 'Ljava/lang/ClassLoader;' @52 a 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x00000007ff756a60} (ffeead4c) + - private transient 'classData' 'Ljava/lang/Object;' @56 NULL (0) + - private transient 'packageName' 'Ljava/lang/String;' @60 "javababushka.client"{0x000000043fa3b420} (87f47684) + - private final 'componentType' 'Ljava/lang/Class;' @64 NULL (0) + - private volatile transient 'reflectionData' 'Ljava/lang/ref/SoftReference;' @68 NULL (0) + - private volatile transient 'genericInfo' 'Lsun/reflect/generics/repository/ClassRepository;' @72 NULL (0) + - private volatile transient 'enumConstants' '[Ljava/lang/Object;' @76 NULL (0) + - private volatile transient 'enumConstantDirectory' 'Ljava/util/Map;' @80 NULL (0) + - private volatile transient 'annotationData' 'Ljava/lang/Class$AnnotationData;' @84 NULL (0) + - private volatile transient 'annotationType' 'Lsun/reflect/annotation/AnnotationType;' @88 NULL (0) + - transient 'classValueMap' 'Ljava/lang/ClassValue$ClassValueMap;' @92 NULL (0) + - signature: Ljavababushka/client/RedisClient; + - fake entry for mirror: 'javababushka/client/RedisClient' + - fake entry for array: NULL + - fake entry for oop_size: 14 + - fake entry for static_oop_field_count: 0 +x18=0x0 is NULL +x19=0x000000010a16773c is at code_begin+60 in an Interpreter codelet +result handlers for native calls [0x000000010a167700, 0x000000010a167780] 128 bytes +x20=0x000000016fad2890 is pointing into the stack for thread: 0x0000000137808200 +x21=0x0000000102340458: _ZN19TemplateInterpreter13_active_tableE+0 in /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/server/libjvm.dylib at 0x00000001016d8000 +x22=0x0 is NULL +x23=0x000000010a1687c0 is at code_begin+0 in an Interpreter codelet +method entry point (kind = zerolocals) [0x000000010a1687c0, 0x000000010a168ac0] 768 bytes +x24=0x000000016fad2918 is pointing into the stack for thread: 0x0000000137808200 +x25=0x0000000000000001 is an unknown value +x26=0x0000000122425298 is pointing into metadata +x27=0x0 is NULL +x28=0x0000000137808200 is a thread + + +Registers: + x0=0x00000001378084a8 x1=0x000000016fad2908 x2=0x0000000000000000 x3=0x0000000000000000 + x4=0x0000000000000001 x5=0x0000000000000000 x6=0x00000000000000d6 x7=0x0000000137808200 + x8=0x0000000000000000 x9=0x0000000137808538 x10=0x000000013000c760 x11=0x0000000000000002 +x12=0x0000000122424fc8 x13=0x0000000122424fc8 x14=0x000000009aa4306a x15=0x000000009a842ffb +x16=0x000000019a414d04 x17=0x000000043fa3c270 x18=0x0000000000000000 x19=0x000000010a16773c +x20=0x000000016fad2890 x21=0x0000000102340458 x22=0x0000000000000000 x23=0x000000010a1687c0 +x24=0x000000016fad2918 x25=0x0000000000000001 x26=0x0000000122425298 x27=0x0000000000000000 +x28=0x0000000137808200 fp=0x000000016fad2880 lr=0x000000013000c788 sp=0x000000016fad2800 +pc=0x000000013000c7b0 cpsr=0x0000000040001000 +Top of Stack: (sp=0x000000016fad2800) +0x000000016fad2800: 0000000000000000 0000000122424fc8 +0x000000016fad2810: 00000001378084a8 0000000000000000 +0x000000016fad2820: 0000000000000000 0000000000000000 +0x000000016fad2830: 0000000000000000 0000000122424fc8 +0x000000016fad2840: 0000000137808200 0000000122424fc8 +0x000000016fad2850: 0000000000000000 00000001378084a8 +0x000000016fad2860: 000000016fad2908 0000000000000000 +0x000000016fad2870: 000000016fad28f0 000000010a1697a0 +0x000000016fad2880: 000000016fad28f0 000000010a1698ac +0x000000016fad2890: 000000010a1696cc 0000000122424fc8 +0x000000016fad28a0: 000000016fad28a0 0000000000000000 +0x000000016fad28b0: 000000016fad2918 0000000122425298 +0x000000016fad28c0: 000000043fa3c270 0000000000000000 +0x000000016fad28d0: 0000000000000000 0000000122424fc8 +0x000000016fad28e0: 0000000000000000 000000016fad28e0 +0x000000016fad28f0: 000000016fad2970 000000010a165d80 +0x000000016fad2900: 0000000000000000 000000043fa3c270 +0x000000016fad2910: 0000000000000000 0000000000000000 +0x000000016fad2920: 000000016fad2920 0000000122417584 +0x000000016fad2930: 000000016fad29b8 000000012241a410 +0x000000016fad2940: 000000043fa032d0 0000000000000000 +0x000000016fad2950: 0000000000000000 000000012241dba0 +0x000000016fad2960: 000000016fad2910 000000016fad2940 +0x000000016fad2970: 000000016fad2a10 000000010a166508 +0x000000016fad2980: 000000016fad2a10 0000000000000000 +0x000000016fad2990: 0000000000000000 0000000000000000 +0x000000016fad29a0: 0000000000000000 0000000000000000 +0x000000016fad29b0: 000000043fa3ab60 000000043fa39b28 +0x000000016fad29c0: 000000016fad29c0 000000012241bccd +0x000000016fad29d0: 000000016fad2ae8 0000000122422c68 +0x000000016fad29e0: 000000043fa2e050 0000000000000000 +0x000000016fad29f0: 0000000000000000 000000012241bf98 + +Instructions: (pc=0x000000013000c7b0) +0x000000013000c6b0: 911c2021 9403407c f90013e0 14000001 +0x000000013000c6c0: f94013e0 9404861a f9000fe0 14000001 +0x000000013000c6d0: f9400fe8 f90037e8 14000001 910543e0 +0x000000013000c6e0: 941906e8 17ffffc8 d10323a0 9401fa53 +0x000000013000c6f0: 14000001 940485f2 f9000be0 14000001 +0x000000013000c700: f9400be8 f90037e8 17fffff5 941b4d60 +0x000000013000c710: f85d03a0 941b4ebe d10243a0 940b69b7 +0x000000013000c720: 17fffffc f81d03a0 aa0103e8 b81d83a8 +0x000000013000c730: 17fffffa d101c3a0 9401fa40 14000001 +0x000000013000c740: 940485df f90007e0 14000001 f94007e8 +0x000000013000c750: f90037e8 d10243a0 940b69a8 17ffffaa +0x000000013000c760: d10243ff a9087bfd 910203fd aa0003e8 +0x000000013000c770: f9000be8 aa0203e0 f81d83a8 f81e03a1 +0x000000013000c780: f81e83a0 9403b985 f90017e0 f94017e8 +0x000000013000c790: f9000fe8 f90013e8 f2400908 1a9f07e8 +0x000000013000c7a0: 37000188 14000001 f9400be0 f9400fe8 +0x000000013000c7b0: 3dc00100 9100c3e1 3d800fe0 3dc00500 +0x000000013000c7c0: 3d8013e0 97ffff2a f90007e0 1400000e +0x000000013000c7d0: f94013e1 52800108 aa0803e0 90004d22 +0x000000013000c7e0: 911d4042 941b4d07 9100a3e0 94020f50 +0x000000013000c7f0: 1400000c f81f03a0 aa0103e8 b81f83a8 +0x000000013000c800: 17fffffa 9100a3e0 94020f49 f94007e0 +0x000000013000c810: a9487bfd 910243ff d65f03c0 941b4d1c +0x000000013000c820: f85f03a0 941b4e7a d10583ff a9146ffc +0x000000013000c830: a9157bfd 910543fd aa0003e8 f9000be2 +0x000000013000c840: 9100c3e0 f9000fe0 f9001be8 f81c83a1 +0x000000013000c850: f81d03a2 381c73bf 381c63bf 9100e3e8 +0x000000013000c860: f90007e8 94040a15 f94007e0 90004d21 +0x000000013000c870: 911da021 94034156 f9400be1 aa0003e8 +0x000000013000c880: f9400fe0 f90013e8 f81d83a8 9101e3e8 +0x000000013000c890: f90017e8 9403c5c2 f94017e0 90004d21 +0x000000013000c8a0: 911e0021 94033f4f f9003be0 52800028 + + +Stack slot to memory mapping: +stack at sp + 0 slots: 0x0 is NULL +stack at sp + 1 slots: {method} {0x0000000122424fc8} 'valueFromPointer' '(J)Ljava/lang/Object;' in 'javababushka/client/RedisClient' +stack at sp + 2 slots: 0x00000001378084a8 points into unknown readable memory: 0x00000001022f28c8 | c8 28 2f 02 01 00 00 00 +stack at sp + 3 slots: 0x0 is NULL +stack at sp + 4 slots: 0x0 is NULL +stack at sp + 5 slots: 0x0 is NULL +stack at sp + 6 slots: 0x0 is NULL +stack at sp + 7 slots: {method} {0x0000000122424fc8} 'valueFromPointer' '(J)Ljava/lang/Object;' in 'javababushka/client/RedisClient' + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x00006000033ad420, length=11, elements={ +0x0000000137808200, 0x0000000137011600, 0x0000000137016400, 0x000000013796ae00, +0x000000013796b400, 0x0000000137969000, 0x0000000127816200, 0x0000000127816800, +0x0000000127816e00, 0x000000012280a800, 0x0000000137969600 +} + +Java Threads: ( => current thread ) +=>0x0000000137808200 JavaThread "main" [_thread_in_native, id=8451, stack(0x000000016f8d0000,0x000000016fad3000)] + 0x0000000137011600 JavaThread "Reference Handler" daemon [_thread_blocked, id=18691, stack(0x0000000170724000,0x0000000170927000)] + 0x0000000137016400 JavaThread "Finalizer" daemon [_thread_blocked, id=32515, stack(0x0000000170930000,0x0000000170b33000)] + 0x000000013796ae00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=23299, stack(0x0000000170c54000,0x0000000170e57000)] + 0x000000013796b400 JavaThread "Service Thread" daemon [_thread_blocked, id=23811, stack(0x0000000170e60000,0x0000000171063000)] + 0x0000000137969000 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=30467, stack(0x000000017106c000,0x000000017126f000)] + 0x0000000127816200 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=24323, stack(0x0000000171278000,0x000000017147b000)] + 0x0000000127816800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=24835, stack(0x0000000171484000,0x0000000171687000)] + 0x0000000127816e00 JavaThread "Sweeper thread" daemon [_thread_blocked, id=25347, stack(0x0000000171690000,0x0000000171893000)] + 0x000000012280a800 JavaThread "Notification Thread" daemon [_thread_blocked, id=25603, stack(0x000000017189c000,0x0000000171a9f000)] + 0x0000000137969600 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=29187, stack(0x0000000171cb4000,0x0000000171eb7000)] + +Other Threads: + 0x0000000100a06270 VMThread "VM Thread" [stack: 0x0000000170518000,0x000000017071b000] [id=19203] + 0x0000000100c05dc0 WatcherThread [stack: 0x0000000171aa8000,0x0000000171cab000] [id=25859] + 0x0000000136f06890 GCTaskThread "GC Thread#0" [stack: 0x000000016fadc000,0x000000016fcdf000] [id=14595] + 0x0000000136f06f40 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000016fce8000,0x000000016feeb000] [id=14083] + 0x0000000136f077c0 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000016fef4000,0x00000001700f7000] [id=21507] + 0x0000000136f098f0 ConcurrentGCThread "G1 Refine#0" [stack: 0x0000000170100000,0x0000000170303000] [id=17411] + 0x0000000136f0a190 ConcurrentGCThread "G1 Service" [stack: 0x000000017030c000,0x000000017050f000] [id=17667] + +Threads with active compile tasks: + +VM state: not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap address: 0x0000000400000000, size: 16384 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 + +CDS archive(s) mapped at: [0x0000000800000000-0x0000000800bd4000-0x0000000800bd4000), size 12402688, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0. +Compressed class space mapped at: 0x0000000800c00000-0x0000000840c00000, reserved size: 1073741824 +Narrow klass base: 0x0000000800000000, Narrow klass shift: 0, Narrow klass range: 0x100000000 + +GC Precious Log: + CPUs: 10 total, 10 available + Memory: 65536M + Large Page Support: Disabled + NUMA Support: Disabled + Compressed Oops: Enabled (Zero based) + Heap Region Size: 8M + Heap Min Capacity: 8M + Heap Initial Capacity: 1G + Heap Max Capacity: 16G + Pre-touch: Disabled + Parallel Workers: 9 + Concurrent Workers: 2 + Concurrent Refinement Workers: 9 + Periodic GC: Disabled + +Heap: + garbage-first heap total 1064960K, used 8160K [0x0000000400000000, 0x0000000800000000) + region size 8192K, 1 young (8192K), 0 survivors (0K) + Metaspace used 548K, committed 704K, reserved 1056768K + class space used 53K, committed 128K, reserved 1048576K + +Heap Regions: E=young(eden), S=young(survivor), O=old, HS=humongous(starts), HC=humongous(continues), CS=collection set, F=free, OA=open archive, CA=closed archive, TAMS=top-at-mark-start (previous, next) +| 0|0x0000000400000000, 0x0000000400000000, 0x0000000400800000| 0%| F| |TAMS 0x0000000400000000, 0x0000000400000000| Untracked +| 1|0x0000000400800000, 0x0000000400800000, 0x0000000401000000| 0%| F| |TAMS 0x0000000400800000, 0x0000000400800000| Untracked +| 2|0x0000000401000000, 0x0000000401000000, 0x0000000401800000| 0%| F| |TAMS 0x0000000401000000, 0x0000000401000000| Untracked +| 3|0x0000000401800000, 0x0000000401800000, 0x0000000402000000| 0%| F| |TAMS 0x0000000401800000, 0x0000000401800000| Untracked +| 4|0x0000000402000000, 0x0000000402000000, 0x0000000402800000| 0%| F| |TAMS 0x0000000402000000, 0x0000000402000000| Untracked +| 5|0x0000000402800000, 0x0000000402800000, 0x0000000403000000| 0%| F| |TAMS 0x0000000402800000, 0x0000000402800000| Untracked +| 6|0x0000000403000000, 0x0000000403000000, 0x0000000403800000| 0%| F| |TAMS 0x0000000403000000, 0x0000000403000000| Untracked +| 7|0x0000000403800000, 0x0000000403800000, 0x0000000404000000| 0%| F| |TAMS 0x0000000403800000, 0x0000000403800000| Untracked +| 8|0x0000000404000000, 0x0000000404000000, 0x0000000404800000| 0%| F| |TAMS 0x0000000404000000, 0x0000000404000000| Untracked +| 9|0x0000000404800000, 0x0000000404800000, 0x0000000405000000| 0%| F| |TAMS 0x0000000404800000, 0x0000000404800000| Untracked +| 10|0x0000000405000000, 0x0000000405000000, 0x0000000405800000| 0%| F| |TAMS 0x0000000405000000, 0x0000000405000000| Untracked +| 11|0x0000000405800000, 0x0000000405800000, 0x0000000406000000| 0%| F| |TAMS 0x0000000405800000, 0x0000000405800000| Untracked +| 12|0x0000000406000000, 0x0000000406000000, 0x0000000406800000| 0%| F| |TAMS 0x0000000406000000, 0x0000000406000000| Untracked +| 13|0x0000000406800000, 0x0000000406800000, 0x0000000407000000| 0%| F| |TAMS 0x0000000406800000, 0x0000000406800000| Untracked +| 14|0x0000000407000000, 0x0000000407000000, 0x0000000407800000| 0%| F| |TAMS 0x0000000407000000, 0x0000000407000000| Untracked +| 15|0x0000000407800000, 0x0000000407800000, 0x0000000408000000| 0%| F| |TAMS 0x0000000407800000, 0x0000000407800000| Untracked +| 16|0x0000000408000000, 0x0000000408000000, 0x0000000408800000| 0%| F| |TAMS 0x0000000408000000, 0x0000000408000000| Untracked +| 17|0x0000000408800000, 0x0000000408800000, 0x0000000409000000| 0%| F| |TAMS 0x0000000408800000, 0x0000000408800000| Untracked +| 18|0x0000000409000000, 0x0000000409000000, 0x0000000409800000| 0%| F| |TAMS 0x0000000409000000, 0x0000000409000000| Untracked +| 19|0x0000000409800000, 0x0000000409800000, 0x000000040a000000| 0%| F| |TAMS 0x0000000409800000, 0x0000000409800000| Untracked +| 20|0x000000040a000000, 0x000000040a000000, 0x000000040a800000| 0%| F| |TAMS 0x000000040a000000, 0x000000040a000000| Untracked +| 21|0x000000040a800000, 0x000000040a800000, 0x000000040b000000| 0%| F| |TAMS 0x000000040a800000, 0x000000040a800000| Untracked +| 22|0x000000040b000000, 0x000000040b000000, 0x000000040b800000| 0%| F| |TAMS 0x000000040b000000, 0x000000040b000000| Untracked +| 23|0x000000040b800000, 0x000000040b800000, 0x000000040c000000| 0%| F| |TAMS 0x000000040b800000, 0x000000040b800000| Untracked +| 24|0x000000040c000000, 0x000000040c000000, 0x000000040c800000| 0%| F| |TAMS 0x000000040c000000, 0x000000040c000000| Untracked +| 25|0x000000040c800000, 0x000000040c800000, 0x000000040d000000| 0%| F| |TAMS 0x000000040c800000, 0x000000040c800000| Untracked +| 26|0x000000040d000000, 0x000000040d000000, 0x000000040d800000| 0%| F| |TAMS 0x000000040d000000, 0x000000040d000000| Untracked +| 27|0x000000040d800000, 0x000000040d800000, 0x000000040e000000| 0%| F| |TAMS 0x000000040d800000, 0x000000040d800000| Untracked +| 28|0x000000040e000000, 0x000000040e000000, 0x000000040e800000| 0%| F| |TAMS 0x000000040e000000, 0x000000040e000000| Untracked +| 29|0x000000040e800000, 0x000000040e800000, 0x000000040f000000| 0%| F| |TAMS 0x000000040e800000, 0x000000040e800000| Untracked +| 30|0x000000040f000000, 0x000000040f000000, 0x000000040f800000| 0%| F| |TAMS 0x000000040f000000, 0x000000040f000000| Untracked +| 31|0x000000040f800000, 0x000000040f800000, 0x0000000410000000| 0%| F| |TAMS 0x000000040f800000, 0x000000040f800000| Untracked +| 32|0x0000000410000000, 0x0000000410000000, 0x0000000410800000| 0%| F| |TAMS 0x0000000410000000, 0x0000000410000000| Untracked +| 33|0x0000000410800000, 0x0000000410800000, 0x0000000411000000| 0%| F| |TAMS 0x0000000410800000, 0x0000000410800000| Untracked +| 34|0x0000000411000000, 0x0000000411000000, 0x0000000411800000| 0%| F| |TAMS 0x0000000411000000, 0x0000000411000000| Untracked +| 35|0x0000000411800000, 0x0000000411800000, 0x0000000412000000| 0%| F| |TAMS 0x0000000411800000, 0x0000000411800000| Untracked +| 36|0x0000000412000000, 0x0000000412000000, 0x0000000412800000| 0%| F| |TAMS 0x0000000412000000, 0x0000000412000000| Untracked +| 37|0x0000000412800000, 0x0000000412800000, 0x0000000413000000| 0%| F| |TAMS 0x0000000412800000, 0x0000000412800000| Untracked +| 38|0x0000000413000000, 0x0000000413000000, 0x0000000413800000| 0%| F| |TAMS 0x0000000413000000, 0x0000000413000000| Untracked +| 39|0x0000000413800000, 0x0000000413800000, 0x0000000414000000| 0%| F| |TAMS 0x0000000413800000, 0x0000000413800000| Untracked +| 40|0x0000000414000000, 0x0000000414000000, 0x0000000414800000| 0%| F| |TAMS 0x0000000414000000, 0x0000000414000000| Untracked +| 41|0x0000000414800000, 0x0000000414800000, 0x0000000415000000| 0%| F| |TAMS 0x0000000414800000, 0x0000000414800000| Untracked +| 42|0x0000000415000000, 0x0000000415000000, 0x0000000415800000| 0%| F| |TAMS 0x0000000415000000, 0x0000000415000000| Untracked +| 43|0x0000000415800000, 0x0000000415800000, 0x0000000416000000| 0%| F| |TAMS 0x0000000415800000, 0x0000000415800000| Untracked +| 44|0x0000000416000000, 0x0000000416000000, 0x0000000416800000| 0%| F| |TAMS 0x0000000416000000, 0x0000000416000000| Untracked +| 45|0x0000000416800000, 0x0000000416800000, 0x0000000417000000| 0%| F| |TAMS 0x0000000416800000, 0x0000000416800000| Untracked +| 46|0x0000000417000000, 0x0000000417000000, 0x0000000417800000| 0%| F| |TAMS 0x0000000417000000, 0x0000000417000000| Untracked +| 47|0x0000000417800000, 0x0000000417800000, 0x0000000418000000| 0%| F| |TAMS 0x0000000417800000, 0x0000000417800000| Untracked +| 48|0x0000000418000000, 0x0000000418000000, 0x0000000418800000| 0%| F| |TAMS 0x0000000418000000, 0x0000000418000000| Untracked +| 49|0x0000000418800000, 0x0000000418800000, 0x0000000419000000| 0%| F| |TAMS 0x0000000418800000, 0x0000000418800000| Untracked +| 50|0x0000000419000000, 0x0000000419000000, 0x0000000419800000| 0%| F| |TAMS 0x0000000419000000, 0x0000000419000000| Untracked +| 51|0x0000000419800000, 0x0000000419800000, 0x000000041a000000| 0%| F| |TAMS 0x0000000419800000, 0x0000000419800000| Untracked +| 52|0x000000041a000000, 0x000000041a000000, 0x000000041a800000| 0%| F| |TAMS 0x000000041a000000, 0x000000041a000000| Untracked +| 53|0x000000041a800000, 0x000000041a800000, 0x000000041b000000| 0%| F| |TAMS 0x000000041a800000, 0x000000041a800000| Untracked +| 54|0x000000041b000000, 0x000000041b000000, 0x000000041b800000| 0%| F| |TAMS 0x000000041b000000, 0x000000041b000000| Untracked +| 55|0x000000041b800000, 0x000000041b800000, 0x000000041c000000| 0%| F| |TAMS 0x000000041b800000, 0x000000041b800000| Untracked +| 56|0x000000041c000000, 0x000000041c000000, 0x000000041c800000| 0%| F| |TAMS 0x000000041c000000, 0x000000041c000000| Untracked +| 57|0x000000041c800000, 0x000000041c800000, 0x000000041d000000| 0%| F| |TAMS 0x000000041c800000, 0x000000041c800000| Untracked +| 58|0x000000041d000000, 0x000000041d000000, 0x000000041d800000| 0%| F| |TAMS 0x000000041d000000, 0x000000041d000000| Untracked +| 59|0x000000041d800000, 0x000000041d800000, 0x000000041e000000| 0%| F| |TAMS 0x000000041d800000, 0x000000041d800000| Untracked +| 60|0x000000041e000000, 0x000000041e000000, 0x000000041e800000| 0%| F| |TAMS 0x000000041e000000, 0x000000041e000000| Untracked +| 61|0x000000041e800000, 0x000000041e800000, 0x000000041f000000| 0%| F| |TAMS 0x000000041e800000, 0x000000041e800000| Untracked +| 62|0x000000041f000000, 0x000000041f000000, 0x000000041f800000| 0%| F| |TAMS 0x000000041f000000, 0x000000041f000000| Untracked +| 63|0x000000041f800000, 0x000000041f800000, 0x0000000420000000| 0%| F| |TAMS 0x000000041f800000, 0x000000041f800000| Untracked +| 64|0x0000000420000000, 0x0000000420000000, 0x0000000420800000| 0%| F| |TAMS 0x0000000420000000, 0x0000000420000000| Untracked +| 65|0x0000000420800000, 0x0000000420800000, 0x0000000421000000| 0%| F| |TAMS 0x0000000420800000, 0x0000000420800000| Untracked +| 66|0x0000000421000000, 0x0000000421000000, 0x0000000421800000| 0%| F| |TAMS 0x0000000421000000, 0x0000000421000000| Untracked +| 67|0x0000000421800000, 0x0000000421800000, 0x0000000422000000| 0%| F| |TAMS 0x0000000421800000, 0x0000000421800000| Untracked +| 68|0x0000000422000000, 0x0000000422000000, 0x0000000422800000| 0%| F| |TAMS 0x0000000422000000, 0x0000000422000000| Untracked +| 69|0x0000000422800000, 0x0000000422800000, 0x0000000423000000| 0%| F| |TAMS 0x0000000422800000, 0x0000000422800000| Untracked +| 70|0x0000000423000000, 0x0000000423000000, 0x0000000423800000| 0%| F| |TAMS 0x0000000423000000, 0x0000000423000000| Untracked +| 71|0x0000000423800000, 0x0000000423800000, 0x0000000424000000| 0%| F| |TAMS 0x0000000423800000, 0x0000000423800000| Untracked +| 72|0x0000000424000000, 0x0000000424000000, 0x0000000424800000| 0%| F| |TAMS 0x0000000424000000, 0x0000000424000000| Untracked +| 73|0x0000000424800000, 0x0000000424800000, 0x0000000425000000| 0%| F| |TAMS 0x0000000424800000, 0x0000000424800000| Untracked +| 74|0x0000000425000000, 0x0000000425000000, 0x0000000425800000| 0%| F| |TAMS 0x0000000425000000, 0x0000000425000000| Untracked +| 75|0x0000000425800000, 0x0000000425800000, 0x0000000426000000| 0%| F| |TAMS 0x0000000425800000, 0x0000000425800000| Untracked +| 76|0x0000000426000000, 0x0000000426000000, 0x0000000426800000| 0%| F| |TAMS 0x0000000426000000, 0x0000000426000000| Untracked +| 77|0x0000000426800000, 0x0000000426800000, 0x0000000427000000| 0%| F| |TAMS 0x0000000426800000, 0x0000000426800000| Untracked +| 78|0x0000000427000000, 0x0000000427000000, 0x0000000427800000| 0%| F| |TAMS 0x0000000427000000, 0x0000000427000000| Untracked +| 79|0x0000000427800000, 0x0000000427800000, 0x0000000428000000| 0%| F| |TAMS 0x0000000427800000, 0x0000000427800000| Untracked +| 80|0x0000000428000000, 0x0000000428000000, 0x0000000428800000| 0%| F| |TAMS 0x0000000428000000, 0x0000000428000000| Untracked +| 81|0x0000000428800000, 0x0000000428800000, 0x0000000429000000| 0%| F| |TAMS 0x0000000428800000, 0x0000000428800000| Untracked +| 82|0x0000000429000000, 0x0000000429000000, 0x0000000429800000| 0%| F| |TAMS 0x0000000429000000, 0x0000000429000000| Untracked +| 83|0x0000000429800000, 0x0000000429800000, 0x000000042a000000| 0%| F| |TAMS 0x0000000429800000, 0x0000000429800000| Untracked +| 84|0x000000042a000000, 0x000000042a000000, 0x000000042a800000| 0%| F| |TAMS 0x000000042a000000, 0x000000042a000000| Untracked +| 85|0x000000042a800000, 0x000000042a800000, 0x000000042b000000| 0%| F| |TAMS 0x000000042a800000, 0x000000042a800000| Untracked +| 86|0x000000042b000000, 0x000000042b000000, 0x000000042b800000| 0%| F| |TAMS 0x000000042b000000, 0x000000042b000000| Untracked +| 87|0x000000042b800000, 0x000000042b800000, 0x000000042c000000| 0%| F| |TAMS 0x000000042b800000, 0x000000042b800000| Untracked +| 88|0x000000042c000000, 0x000000042c000000, 0x000000042c800000| 0%| F| |TAMS 0x000000042c000000, 0x000000042c000000| Untracked +| 89|0x000000042c800000, 0x000000042c800000, 0x000000042d000000| 0%| F| |TAMS 0x000000042c800000, 0x000000042c800000| Untracked +| 90|0x000000042d000000, 0x000000042d000000, 0x000000042d800000| 0%| F| |TAMS 0x000000042d000000, 0x000000042d000000| Untracked +| 91|0x000000042d800000, 0x000000042d800000, 0x000000042e000000| 0%| F| |TAMS 0x000000042d800000, 0x000000042d800000| Untracked +| 92|0x000000042e000000, 0x000000042e000000, 0x000000042e800000| 0%| F| |TAMS 0x000000042e000000, 0x000000042e000000| Untracked +| 93|0x000000042e800000, 0x000000042e800000, 0x000000042f000000| 0%| F| |TAMS 0x000000042e800000, 0x000000042e800000| Untracked +| 94|0x000000042f000000, 0x000000042f000000, 0x000000042f800000| 0%| F| |TAMS 0x000000042f000000, 0x000000042f000000| Untracked +| 95|0x000000042f800000, 0x000000042f800000, 0x0000000430000000| 0%| F| |TAMS 0x000000042f800000, 0x000000042f800000| Untracked +| 96|0x0000000430000000, 0x0000000430000000, 0x0000000430800000| 0%| F| |TAMS 0x0000000430000000, 0x0000000430000000| Untracked +| 97|0x0000000430800000, 0x0000000430800000, 0x0000000431000000| 0%| F| |TAMS 0x0000000430800000, 0x0000000430800000| Untracked +| 98|0x0000000431000000, 0x0000000431000000, 0x0000000431800000| 0%| F| |TAMS 0x0000000431000000, 0x0000000431000000| Untracked +| 99|0x0000000431800000, 0x0000000431800000, 0x0000000432000000| 0%| F| |TAMS 0x0000000431800000, 0x0000000431800000| Untracked +| 100|0x0000000432000000, 0x0000000432000000, 0x0000000432800000| 0%| F| |TAMS 0x0000000432000000, 0x0000000432000000| Untracked +| 101|0x0000000432800000, 0x0000000432800000, 0x0000000433000000| 0%| F| |TAMS 0x0000000432800000, 0x0000000432800000| Untracked +| 102|0x0000000433000000, 0x0000000433000000, 0x0000000433800000| 0%| F| |TAMS 0x0000000433000000, 0x0000000433000000| Untracked +| 103|0x0000000433800000, 0x0000000433800000, 0x0000000434000000| 0%| F| |TAMS 0x0000000433800000, 0x0000000433800000| Untracked +| 104|0x0000000434000000, 0x0000000434000000, 0x0000000434800000| 0%| F| |TAMS 0x0000000434000000, 0x0000000434000000| Untracked +| 105|0x0000000434800000, 0x0000000434800000, 0x0000000435000000| 0%| F| |TAMS 0x0000000434800000, 0x0000000434800000| Untracked +| 106|0x0000000435000000, 0x0000000435000000, 0x0000000435800000| 0%| F| |TAMS 0x0000000435000000, 0x0000000435000000| Untracked +| 107|0x0000000435800000, 0x0000000435800000, 0x0000000436000000| 0%| F| |TAMS 0x0000000435800000, 0x0000000435800000| Untracked +| 108|0x0000000436000000, 0x0000000436000000, 0x0000000436800000| 0%| F| |TAMS 0x0000000436000000, 0x0000000436000000| Untracked +| 109|0x0000000436800000, 0x0000000436800000, 0x0000000437000000| 0%| F| |TAMS 0x0000000436800000, 0x0000000436800000| Untracked +| 110|0x0000000437000000, 0x0000000437000000, 0x0000000437800000| 0%| F| |TAMS 0x0000000437000000, 0x0000000437000000| Untracked +| 111|0x0000000437800000, 0x0000000437800000, 0x0000000438000000| 0%| F| |TAMS 0x0000000437800000, 0x0000000437800000| Untracked +| 112|0x0000000438000000, 0x0000000438000000, 0x0000000438800000| 0%| F| |TAMS 0x0000000438000000, 0x0000000438000000| Untracked +| 113|0x0000000438800000, 0x0000000438800000, 0x0000000439000000| 0%| F| |TAMS 0x0000000438800000, 0x0000000438800000| Untracked +| 114|0x0000000439000000, 0x0000000439000000, 0x0000000439800000| 0%| F| |TAMS 0x0000000439000000, 0x0000000439000000| Untracked +| 115|0x0000000439800000, 0x0000000439800000, 0x000000043a000000| 0%| F| |TAMS 0x0000000439800000, 0x0000000439800000| Untracked +| 116|0x000000043a000000, 0x000000043a000000, 0x000000043a800000| 0%| F| |TAMS 0x000000043a000000, 0x000000043a000000| Untracked +| 117|0x000000043a800000, 0x000000043a800000, 0x000000043b000000| 0%| F| |TAMS 0x000000043a800000, 0x000000043a800000| Untracked +| 118|0x000000043b000000, 0x000000043b000000, 0x000000043b800000| 0%| F| |TAMS 0x000000043b000000, 0x000000043b000000| Untracked +| 119|0x000000043b800000, 0x000000043b800000, 0x000000043c000000| 0%| F| |TAMS 0x000000043b800000, 0x000000043b800000| Untracked +| 120|0x000000043c000000, 0x000000043c000000, 0x000000043c800000| 0%| F| |TAMS 0x000000043c000000, 0x000000043c000000| Untracked +| 121|0x000000043c800000, 0x000000043c800000, 0x000000043d000000| 0%| F| |TAMS 0x000000043c800000, 0x000000043c800000| Untracked +| 122|0x000000043d000000, 0x000000043d000000, 0x000000043d800000| 0%| F| |TAMS 0x000000043d000000, 0x000000043d000000| Untracked +| 123|0x000000043d800000, 0x000000043d800000, 0x000000043e000000| 0%| F| |TAMS 0x000000043d800000, 0x000000043d800000| Untracked +| 124|0x000000043e000000, 0x000000043e000000, 0x000000043e800000| 0%| F| |TAMS 0x000000043e000000, 0x000000043e000000| Untracked +| 125|0x000000043e800000, 0x000000043e800000, 0x000000043f000000| 0%| F| |TAMS 0x000000043e800000, 0x000000043e800000| Untracked +| 126|0x000000043f000000, 0x000000043f000000, 0x000000043f800000| 0%| F| |TAMS 0x000000043f000000, 0x000000043f000000| Untracked +| 127|0x000000043f800000, 0x000000043fae14b8, 0x0000000440000000| 36%| E| |TAMS 0x000000043f800000, 0x000000043f800000| Complete +|2046|0x00000007ff000000, 0x00000007ff778000, 0x00000007ff800000| 93%|OA| |TAMS 0x00000007ff000000, 0x00000007ff000000| Untracked +|2047|0x00000007ff800000, 0x00000007ff880000, 0x0000000800000000| 6%|CA| |TAMS 0x00000007ff800000, 0x00000007ff800000| Untracked + +Card table byte_map: [0x000000011b160000,0x000000011d160000] _byte_map_base: 0x0000000119160000 + +Marking Bits (Prev, Next): (CMBitMap*) 0x000000013780b810, (CMBitMap*) 0x000000013780b850 + Prev Bits: [0x0000000140000000, 0x0000000150000000) + Next Bits: [0x0000000150000000, 0x0000000160000000) + +Polling page: 0x00000001006d4000 + +Metaspace: + +Usage: + Non-class: 495.26 KB used. + Class: 53.48 KB used. + Both: 548.73 KB used. + +Virtual space: + Non-class space: 8.00 MB reserved, 576.00 KB ( 7%) committed, 1 nodes. + Class space: 1.00 GB reserved, 128.00 KB ( <1%) committed, 1 nodes. + Both: 1.01 GB reserved, 704.00 KB ( <1%) committed. + +Chunk freelists: + Non-Class: 3.85 MB + Class: 3.73 MB + Both: 7.58 MB + +MaxMetaspaceSize: unlimited +CompressedClassSpaceSize: 1.00 GB +Initial GC threshold: 21.00 MB +Current GC threshold: 21.00 MB +CDS: on +MetaspaceReclaimPolicy: balanced + - commit_granule_bytes: 65536. + - commit_granule_words: 8192. + - virtual_space_node_default_size: 1048576. + - enlarge_chunks_in_place: 1. + - new_chunks_are_fully_committed: 0. + - uncommit_free_chunks: 1. + - use_allocation_guard: 0. + - handle_deallocations: 1. + + +Internal statistics: + +num_allocs_failed_limit: 0. +num_arena_births: 6. +num_arena_deaths: 0. +num_vsnodes_births: 2. +num_vsnodes_deaths: 0. +num_space_committed: 11. +num_space_uncommitted: 0. +num_chunks_returned_to_freelist: 0. +num_chunks_taken_from_freelist: 18. +num_chunk_merges: 0. +num_chunk_splits: 9. +num_chunks_enlarged: 9. +num_purges: 0. +num_inconsistent_stats: 0. + +CodeHeap 'non-profiled nmethods': size=120032Kb used=37Kb max_used=37Kb free=119994Kb + bounds [0x0000000111c28000, 0x0000000111e98000, 0x0000000119160000] +CodeHeap 'profiled nmethods': size=120016Kb used=153Kb max_used=153Kb free=119862Kb + bounds [0x000000010a6f4000, 0x000000010a964000, 0x0000000111c28000] +CodeHeap 'non-nmethods': size=5712Kb used=1085Kb max_used=1093Kb free=4626Kb + bounds [0x000000010a160000, 0x000000010a3d0000, 0x000000010a6f4000] + total_blobs=497 nmethods=127 adapters=287 + compilation: enabled + stopped_count=0, restarted_count=0 + full_count=0 + +Compilation events (20 events): +Event: 0.051 Thread 0x0000000127816800 107 1 java.lang.invoke.MethodType::ptypes (5 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 107 0x0000000111c2eb90 code [0x0000000111c2ed00, 0x0000000111c2ede8] +Event: 0.051 Thread 0x0000000127816800 111 1 java.util.ArrayList::size (5 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 111 0x0000000111c2f490 code [0x0000000111c2f600, 0x0000000111c2f6e8] +Event: 0.051 Thread 0x0000000127816800 113 1 java.lang.invoke.MethodType::form (5 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 113 0x0000000111c2fd90 code [0x0000000111c2ff00, 0x0000000111c2ffe8] +Event: 0.051 Thread 0x0000000127816800 117 3 java.lang.invoke.MethodType::hashCode (53 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 117 0x000000010a715790 code [0x000000010a715980, 0x000000010a715d88] +Event: 0.051 Thread 0x0000000127816800 118 3 java.util.regex.Pattern::has (15 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 118 0x000000010a715f10 code [0x000000010a7160c0, 0x000000010a716268] +Event: 0.051 Thread 0x0000000127816800 120 3 java.lang.invoke.MethodType::makeImpl (109 bytes) +Event: 0.051 Thread 0x0000000127816800 nmethod 120 0x000000010a716310 code [0x000000010a716640, 0x000000010a717528] +Event: 0.051 Thread 0x0000000127816800 122 3 java.lang.Class::getClassLoader (28 bytes) +Event: 0.052 Thread 0x0000000127816800 nmethod 122 0x000000010a717a10 code [0x000000010a717cc0, 0x000000010a718708] +Event: 0.052 Thread 0x0000000127816800 121 1 java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry::hashCode (5 bytes) +Event: 0.052 Thread 0x0000000127816800 nmethod 121 0x0000000111c31290 code [0x0000000111c31400, 0x0000000111c314e8] +Event: 0.053 Thread 0x0000000127816800 126 3 java.lang.StringLatin1::replace (198 bytes) +Event: 0.054 Thread 0x0000000127816800 nmethod 126 0x000000010a718a90 code [0x000000010a718d80, 0x000000010a719b78] +Event: 0.054 Thread 0x0000000127816800 127 3 java.util.Arrays::copyOf (19 bytes) +Event: 0.054 Thread 0x0000000127816800 nmethod 127 0x000000010a71a090 code [0x000000010a71a240, 0x000000010a71a558] + +GC Heap History (0 events): +No events + +Deoptimization events (0 events): +No events + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (0 events): +No events + +VM Operations (0 events): +No events + +Events (20 events): +Event: 0.047 loading class java/util/stream/SpinedBuffer +Event: 0.047 loading class java/util/stream/AbstractSpinedBuffer +Event: 0.047 loading class java/util/stream/AbstractSpinedBuffer done +Event: 0.047 loading class java/util/stream/SpinedBuffer done +Event: 0.047 loading class java/util/stream/Nodes$SpinedNodeBuilder done +Event: 0.048 loading class java/lang/NoSuchFieldError +Event: 0.048 loading class java/lang/NoSuchFieldError done +Event: 0.049 loading class java/net/ProtocolFamily +Event: 0.049 loading class java/net/ProtocolFamily done +Event: 0.049 loading class java/net/SocketAddress +Event: 0.049 loading class java/net/SocketAddress done +Event: 0.049 loading class java/net/UnixDomainSocketAddress +Event: 0.049 loading class java/net/UnixDomainSocketAddress done +Event: 0.049 loading class java/lang/InterruptedException +Event: 0.049 loading class java/lang/InterruptedException done +Event: 0.051 loading class java/util/Formatter$FixedString +Event: 0.051 loading class java/util/Formatter$FixedString done +Event: 0.054 Loading shared library /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjavababushka.dylib failed, dlopen(/Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjavababushka.dylib, 0x0001): +Event: 0.054 Loading shared library /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjavababushka.jnilib failed, dlopen(/Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjavababushka.jnilib, 0x0001 +Event: 0.325 Loaded shared library /Users/andrewc/git/bq/babushka-go/java/target/debug/libjavababushka.dylib + + +Dynamic libraries: +0x0000000100634000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjli.dylib +0x00000001a5cec000 /usr/lib/libz.1.dylib +0x00000001a5da6000 /usr/lib/libSystem.B.dylib +0x00000001a5da0000 /usr/lib/system/libcache.dylib +0x00000001a5d5c000 /usr/lib/system/libcommonCrypto.dylib +0x00000001a5d87000 /usr/lib/system/libcompiler_rt.dylib +0x00000001a5d7d000 /usr/lib/system/libcopyfile.dylib +0x000000019a1a9000 /usr/lib/system/libcorecrypto.dylib +0x000000019a260000 /usr/lib/system/libdispatch.dylib +0x000000019a41a000 /usr/lib/system/libdyld.dylib +0x00000001a5d96000 /usr/lib/system/libkeymgr.dylib +0x00000001a5d36000 /usr/lib/system/libmacho.dylib +0x00000001a533b000 /usr/lib/system/libquarantine.dylib +0x00000001a5d93000 /usr/lib/system/libremovefile.dylib +0x000000019f0c8000 /usr/lib/system/libsystem_asl.dylib +0x000000019a145000 /usr/lib/system/libsystem_blocks.dylib +0x000000019a2ab000 /usr/lib/system/libsystem_c.dylib +0x00000001a5d8b000 /usr/lib/system/libsystem_collections.dylib +0x00000001a477a000 /usr/lib/system/libsystem_configuration.dylib +0x00000001a3810000 /usr/lib/system/libsystem_containermanager.dylib +0x00000001a5a2a000 /usr/lib/system/libsystem_coreservices.dylib +0x000000019d20f000 /usr/lib/system/libsystem_darwin.dylib +0x00000001a5d97000 /usr/lib/system/libsystem_dnssd.dylib +0x000000019a2a8000 /usr/lib/system/libsystem_featureflags.dylib +0x000000019a446000 /usr/lib/system/libsystem_info.dylib +0x00000001a5cfe000 /usr/lib/system/libsystem_m.dylib +0x000000019a234000 /usr/lib/system/libsystem_malloc.dylib +0x000000019f046000 /usr/lib/system/libsystem_networkextension.dylib +0x000000019d679000 /usr/lib/system/libsystem_notify.dylib +0x00000001a477f000 /usr/lib/system/libsystem_sandbox.dylib +0x00000001a5d90000 /usr/lib/system/libsystem_secinit.dylib +0x000000019a3d3000 /usr/lib/system/libsystem_kernel.dylib +0x000000019a43f000 /usr/lib/system/libsystem_platform.dylib +0x000000019a40d000 /usr/lib/system/libsystem_pthread.dylib +0x00000001a0890000 /usr/lib/system/libsystem_symptoms.dylib +0x000000019a18e000 /usr/lib/system/libsystem_trace.dylib +0x00000001a5d6a000 /usr/lib/system/libunwind.dylib +0x000000019a14a000 /usr/lib/system/libxpc.dylib +0x000000019a3b7000 /usr/lib/libc++abi.dylib +0x000000019a070000 /usr/lib/libobjc.A.dylib +0x00000001a5d75000 /usr/lib/liboah.dylib +0x000000019a32a000 /usr/lib/libc++.1.dylib +0x00000001b2a05000 /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa +0x000000019d6de000 /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x00000001a00e0000 /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData +0x000000019b40d000 /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation +0x000000019e5ee000 /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation +0x0000000209014000 /System/Library/PrivateFrameworks/CollectionViewCore.framework/Versions/A/CollectionViewCore +0x00000001acd1b000 /System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices +0x00000001a405e000 /System/Library/PrivateFrameworks/XCTTargetBootstrap.framework/Versions/A/XCTTargetBootstrap +0x00000001a87b8000 /System/Library/PrivateFrameworks/InternationalSupport.framework/Versions/A/InternationalSupport +0x00000001a883f000 /System/Library/PrivateFrameworks/UserActivity.framework/Versions/A/UserActivity +0x000000022111a000 /System/Library/PrivateFrameworks/WindowManagement.framework/Versions/A/WindowManagement +0x000000019b0da000 /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration +0x00000001a7c9b000 /usr/lib/libspindump.dylib +0x000000019e794000 /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers +0x00000001a206a000 /usr/lib/libapp_launch_measurement.dylib +0x00000001a151c000 /System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/CoreAnalytics +0x00000001a2071000 /System/Library/PrivateFrameworks/CoreAutoLayout.framework/Versions/A/CoreAutoLayout +0x00000001a3864000 /System/Library/Frameworks/Metal.framework/Versions/A/Metal +0x00000001a478b000 /usr/lib/liblangid.dylib +0x00000001a4064000 /System/Library/PrivateFrameworks/CoreSVG.framework/Versions/A/CoreSVG +0x000000019f0fe000 /System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight +0x000000019f52a000 /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics +0x00000001ad3f7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate +0x00000001a7708000 /System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices +0x00000001a3842000 /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface +0x00000001a154a000 /usr/lib/libDiagnosticMessagesClient.dylib +0x00000001b081b000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices +0x00000001a4046000 /System/Library/PrivateFrameworks/DFRFoundation.framework/Versions/A/DFRFoundation +0x000000019cf5b000 /usr/lib/libicucore.A.dylib +0x00000001a9750000 /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox +0x00000001a87c3000 /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore +0x00000001c0003000 /System/Library/PrivateFrameworks/TextInput.framework/Versions/A/TextInput +0x000000019f061000 /usr/lib/libMobileGestalt.dylib +0x00000001a3d12000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x00000001a19d9000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore +0x000000019cba5000 /System/Library/Frameworks/Security.framework/Versions/A/Security +0x00000001acd5b000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition +0x00000001a1da9000 /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI +0x000000019c511000 /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio +0x00000001a1627000 /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration +0x00000001a80dc000 /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport +0x000000019f05f000 /usr/lib/libenergytrace.dylib +0x000000019d59e000 /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit +0x00000001ad146000 /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices +0x00000001a1ff7000 /System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis +0x00000001ff018000 /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL +0x00000001a20bb000 /usr/lib/libxml2.2.dylib +0x00000001a5243000 /System/Library/PrivateFrameworks/MobileKeyBag.framework/Versions/A/MobileKeyBag +0x000000019fb71000 /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync +0x000000019a473000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x00000001a43a0000 /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage +0x000000019c32e000 /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText +0x00000001a409c000 /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO +0x00000001a5dac000 /System/Library/PrivateFrameworks/SoftLinking.framework/Versions/A/SoftLinking +0x00000001a6042000 /usr/lib/libcompression.dylib +0x00000001a8713000 /System/Library/PrivateFrameworks/TextureIO.framework/Versions/A/TextureIO +0x00000001a73d5000 /usr/lib/libate.dylib +0x00000001a728e000 /usr/lib/liblzma.5.dylib +0x00000001a5da8000 /usr/lib/libfakelink.dylib +0x000000019ec83000 /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork +0x00000001a5ee6000 /usr/lib/libarchive.2.dylib +0x00000001ab07f000 /System/Library/Frameworks/Combine.framework/Versions/A/Combine +0x00000001a912f000 /usr/lib/swift/libswiftCore.dylib +0x00000001bd08b000 /usr/lib/swift/libswiftCoreFoundation.dylib +0x00000001baffa000 /usr/lib/swift/libswiftDarwin.dylib +0x00000001ae693000 /usr/lib/swift/libswiftDispatch.dylib +0x00000001bd0ac000 /usr/lib/swift/libswiftIOKit.dylib +0x00000001b0c51000 /usr/lib/swift/libswiftObjectiveC.dylib +0x00000001bd09f000 /usr/lib/swift/libswiftXPC.dylib +0x0000000227ba3000 /usr/lib/swift/libswift_Concurrency.dylib +0x0000000227cf1000 /usr/lib/swift/libswift_StringProcessing.dylib +0x00000001b0c55000 /usr/lib/swift/libswiftos.dylib +0x000000019d522000 /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal +0x00000001a5362000 /usr/lib/libbsm.0.dylib +0x00000001a5d3c000 /usr/lib/system/libkxld.dylib +0x00000001a2033000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents +0x000000019d21a000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore +0x00000001a158e000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata +0x00000001a5a30000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices +0x00000001a5f6e000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit +0x00000001a0812000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE +0x000000019a94d000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices +0x00000001a7237000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices +0x00000001a2040000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList +0x00000001a600c000 /usr/lib/libapple_nghttp2.dylib +0x000000019ec7f000 /usr/lib/libnetwork.dylib +0x00000001a04c1000 /usr/lib/libsqlite3.dylib +0x00000001a0899000 /System/Library/Frameworks/Network.framework/Versions/A/Network +0x0000000226c82000 /usr/lib/libCoreEntitlements.dylib +0x0000000212c17000 /System/Library/PrivateFrameworks/MessageSecurity.framework/Versions/A/MessageSecurity +0x00000001a04a7000 /System/Library/PrivateFrameworks/ProtocolBuffer.framework/Versions/A/ProtocolBuffer +0x00000001a5958000 /System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression +0x00000001a534a000 /usr/lib/libcoretls.dylib +0x00000001a72a7000 /usr/lib/libcoretls_cfhelpers.dylib +0x00000001a603c000 /usr/lib/libpam.2.dylib +0x00000001a7313000 /usr/lib/libxar.1.dylib +0x00000001a76e2000 /usr/lib/libheimdal-asn1.dylib +0x00000001a5dad000 /usr/lib/libpcap.A.dylib +0x00000001a0886000 /usr/lib/libdns_services.dylib +0x00000001a4787000 /System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo +0x00000001a503e000 /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/Versions/A/IOMobileFramebuffer +0x00000001a5a1d000 /usr/lib/libbz2.1.0.dylib +0x00000001a533e000 /usr/lib/libCheckFix.dylib +0x000000019f0e0000 /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC +0x00000001a478d000 /System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/CoreNLP +0x00000001a154c000 /System/Library/PrivateFrameworks/MetadataUtilities.framework/Versions/A/MetadataUtilities +0x00000001a5374000 /usr/lib/libmecab.dylib +0x000000019b164000 /usr/lib/libCRFSuite.dylib +0x00000001a53d0000 /usr/lib/libgermantok.dylib +0x00000001a5fe5000 /usr/lib/libThaiTokenizer.dylib +0x00000001a1630000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage +0x00000001ad11d000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib +0x00000001a7359000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib +0x00000001a4f3d000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib +0x000000019ad05000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib +0x00000001a6117000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib +0x00000001a53d3000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib +0x00000001a6027000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib +0x00000001a6112000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib +0x00000001a4882000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib +0x000000019b072000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib +0x0000000211e45000 /System/Library/PrivateFrameworks/MIL.framework/Versions/A/MIL +0x00000001a5de2000 /usr/lib/libiconv.2.dylib +0x00000001a5d35000 /usr/lib/libcharset.1.dylib +0x00000001a2013000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory +0x00000001a2003000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory +0x00000001a72a9000 /System/Library/PrivateFrameworks/APFS.framework/Versions/A/APFS +0x00000001a5279000 /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation +0x00000001a7322000 /usr/lib/libutil.dylib +0x0000000210c99000 /System/Library/PrivateFrameworks/InstalledContentLibrary.framework/Versions/A/InstalledContentLibrary +0x000000019d561000 /System/Library/PrivateFrameworks/CoreServicesStore.framework/Versions/A/CoreServicesStore +0x00000002079a7000 /System/Library/PrivateFrameworks/AppleMobileFileIntegrity.framework/Versions/A/AppleMobileFileIntegrity +0x00000001bd06b000 /usr/lib/libmis.dylib +0x00000001cb25c000 /System/Library/PrivateFrameworks/MobileSystemServices.framework/Versions/A/MobileSystemServices +0x00000001e67bc000 /System/Library/PrivateFrameworks/ConfigProfileHelper.framework/Versions/A/ConfigProfileHelper +0x00000001a5fe7000 /System/Library/PrivateFrameworks/AppleSauce.framework/Versions/A/AppleSauce +0x000000019bdd3000 /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling +0x00000001a7326000 /usr/lib/libxslt.1.dylib +0x00000001a5ed4000 /usr/lib/libcmph.dylib +0x00000001a502b000 /System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/CoreEmoji +0x00000001a487c000 /System/Library/PrivateFrameworks/LinguisticData.framework/Versions/A/LinguisticData +0x000000019b02a000 /System/Library/PrivateFrameworks/Lexicon.framework/Versions/A/Lexicon +0x00000001a530b000 /System/Library/PrivateFrameworks/BackgroundTaskManagement.framework/Versions/A/BackgroundTaskManagement +0x0000000226e25000 /usr/lib/libTLE.dylib +0x0000000227c41000 /usr/lib/swift/libswift_RegexParser.dylib +0x00000001a7fa1000 /System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG +0x00000001a76c7000 /usr/lib/libexpat.1.dylib +0x00000001a8573000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib +0x00000001a859e000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib +0x00000001a8689000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib +0x00000001a7fe7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib +0x00000001a862e000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib +0x00000001a8625000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib +0x00000001a3b9f000 /System/Library/PrivateFrameworks/FontServices.framework/libFontParser.dylib +0x00000001a07b3000 /System/Library/PrivateFrameworks/RunningBoardServices.framework/Versions/A/RunningBoardServices +0x00000001b31b0000 /System/Library/PrivateFrameworks/IOSurfaceAccelerator.framework/Versions/A/IOSurfaceAccelerator +0x00000001a80d8000 /System/Library/PrivateFrameworks/WatchdogClient.framework/Versions/A/WatchdogClient +0x000000019bf4f000 /System/Library/Frameworks/CoreDisplay.framework/Versions/A/CoreDisplay +0x00000001a3a76000 /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia +0x00000001a385a000 /System/Library/PrivateFrameworks/IOAccelerator.framework/Versions/A/IOAccelerator +0x00000001a21a4000 /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo +0x00000001a603a000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/MetalPerformanceShaders +0x00000001a8119000 /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox +0x00000001a06f0000 /System/Library/PrivateFrameworks/BaseBoard.framework/Versions/A/BaseBoard +0x00000001a8620000 /System/Library/PrivateFrameworks/GPUWrangler.framework/Versions/A/GPUWrangler +0x00000001a8600000 /System/Library/PrivateFrameworks/IOPresentment.framework/Versions/A/IOPresentment +0x00000001a8628000 /System/Library/PrivateFrameworks/DSExternalDisplay.framework/Versions/A/DSExternalDisplay +0x000000020d2b6000 /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/31001/Libraries/libllvm-flatbuffers.dylib +0x00000001ff00b000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreFSCache.dylib +0x000000020d2b2000 /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/31001/Libraries/libGPUCompilerUtils.dylib +0x00000001a868f000 /System/Library/PrivateFrameworks/CMCaptureCore.framework/Versions/A/CMCaptureCore +0x000000020199f000 /System/Library/Frameworks/ExtensionFoundation.framework/Versions/A/ExtensionFoundation +0x00000001aee56000 /System/Library/PrivateFrameworks/CoreTime.framework/Versions/A/CoreTime +0x00000001a7c86000 /System/Library/PrivateFrameworks/AppServerSupport.framework/Versions/A/AppServerSupport +0x00000001aa034000 /System/Library/PrivateFrameworks/perfdata.framework/Versions/A/perfdata +0x000000019c06f000 /System/Library/PrivateFrameworks/AudioToolboxCore.framework/Versions/A/AudioToolboxCore +0x00000001a3a4d000 /System/Library/PrivateFrameworks/caulk.framework/Versions/A/caulk +0x00000001a98eb000 /usr/lib/libAudioStatistics.dylib +0x00000001bc4a9000 /System/Library/PrivateFrameworks/SystemPolicy.framework/Versions/A/SystemPolicy +0x00000001a9b8b000 /usr/lib/libSMC.dylib +0x00000001b28ce000 /System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI +0x00000001a8540000 /usr/lib/libAudioToolboxUtility.dylib +0x00000001b8125000 /System/Library/PrivateFrameworks/OSAServicesClient.framework/Versions/A/OSAServicesClient +0x00000001aa042000 /usr/lib/libperfcheck.dylib +0x00000001a75b2000 /System/Library/PrivateFrameworks/PlugInKit.framework/Versions/A/PlugInKit +0x00000001a526b000 /System/Library/PrivateFrameworks/AssertionServices.framework/Versions/A/AssertionServices +0x00000001ff06d000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib +0x00000001ff02c000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib +0x00000001ff207000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib +0x00000001ff035000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib +0x00000001ff029000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib +0x0000000226e04000 /usr/lib/libRosetta.dylib +0x00000001ff012000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib +0x00000001a46fe000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSCore.framework/Versions/A/MPSCore +0x00000001a58ce000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSImage.framework/Versions/A/MPSImage +0x00000001a53e8000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSNeuralNetwork.framework/Versions/A/MPSNeuralNetwork +0x00000001a57d0000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSMatrix.framework/Versions/A/MPSMatrix +0x00000001a55e2000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSRayIntersector.framework/Versions/A/MPSRayIntersector +0x00000001a57ff000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSNDArray.framework/Versions/A/MPSNDArray +0x0000000202e6f000 /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSFunctions.framework/Versions/A/MPSFunctions +0x000000019abca000 /System/Library/PrivateFrameworks/MetalTools.framework/Versions/A/MetalTools +0x00000001a4785000 /System/Library/PrivateFrameworks/AggregateDictionary.framework/Versions/A/AggregateDictionary +0x00000001a746a000 /usr/lib/libIOReport.dylib +0x00000001b1aba000 /System/Library/PrivateFrameworks/ASEProcessing.framework/Versions/A/ASEProcessing +0x0000000215ca1000 /System/Library/PrivateFrameworks/PhotosensitivityProcessing.framework/Versions/A/PhotosensitivityProcessing +0x00000001a7824000 /System/Library/PrivateFrameworks/GraphVisualizer.framework/Versions/A/GraphVisualizer +0x000000020d1d3000 /System/Library/PrivateFrameworks/FontServices.framework/Versions/A/FontServices +0x00000001a7c44000 /System/Library/PrivateFrameworks/OTSVG.framework/Versions/A/OTSVG +0x00000001a1d57000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib +0x00000001a7c90000 /System/Library/PrivateFrameworks/FontServices.framework/libhvf.dylib +0x000000020d1d4000 /System/Library/PrivateFrameworks/FontServices.framework/libXTFontStaticRegistryData.dylib +0x00000001c78c8000 /usr/lib/swift/libswiftMetal.dylib +0x00000001bff69000 /usr/lib/swift/libswiftsimd.dylib +0x000000021fc72000 /System/Library/PrivateFrameworks/VideoToolboxParavirtualizationSupport.framework/Versions/A/VideoToolboxParavirtualizationSupport +0x00000001a767b000 /System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA +0x00000001a992b000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS +0x000000019fc63000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices +0x00000001a869b000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore +0x00000001a9ce4000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD +0x00000001a9cd8000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSyncLegacy.framework/Versions/A/ColorSyncLegacy +0x00000001a98ff000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis +0x00000001a8659000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATSUI.framework/Versions/A/ATSUI +0x00000001a9c6b000 /usr/lib/libcups.2.dylib +0x00000001aa050000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos +0x00000001aa061000 /System/Library/Frameworks/GSS.framework/Versions/A/GSS +0x00000001a999d000 /usr/lib/libresolv.9.dylib +0x00000001a7ca0000 /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal +0x00000001b0bd3000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Libraries/libHeimdalProxy.dylib +0x00000001aa0b9000 /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth +0x0000000200ba7000 /System/Library/Frameworks/AVFAudio.framework/Versions/A/AVFAudio +0x00000001b8174000 /System/Library/PrivateFrameworks/AXCoreUtilities.framework/Versions/A/AXCoreUtilities +0x00000001a9877000 /System/Library/PrivateFrameworks/AudioSession.framework/Versions/A/AudioSession +0x00000001aae31000 /System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth +0x00000001a777d000 /System/Library/PrivateFrameworks/MediaExperience.framework/Versions/A/MediaExperience +0x00000001a9716000 /System/Library/PrivateFrameworks/AudioSession.framework/libSessionUtility.dylib +0x00000001a9cf0000 /System/Library/PrivateFrameworks/AudioResourceArbitration.framework/Versions/A/AudioResourceArbitration +0x00000001add59000 /System/Library/PrivateFrameworks/PowerLog.framework/Versions/A/PowerLog +0x00000001adc98000 /System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth +0x00000001b0bd4000 /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit +0x00000001a50ca000 /System/Library/PrivateFrameworks/CoreUtils.framework/Versions/A/CoreUtils +0x000000020baa6000 /System/Library/PrivateFrameworks/CoreUtilsExtras.framework/Versions/A/CoreUtilsExtras +0x0000000210b2f000 /System/Library/PrivateFrameworks/IO80211.framework/Versions/A/IO80211 +0x00000001a76ed000 /System/Library/PrivateFrameworks/IconFoundation.framework/Versions/A/IconFoundation +0x00000001acd47000 /System/Library/PrivateFrameworks/SpeechRecognitionCore.framework/Versions/A/SpeechRecognitionCore +0x00000001016d8000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/server/libjvm.dylib +0x00000001006e8000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjimage.dylib +0x0000000100730000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libjava.dylib +0x00000001009c4000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libnio.dylib +0x0000000100d24000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libnet.dylib +0x00000001009e4000 /Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home/lib/libzip.dylib +0x0000000130000000 /Users/andrewc/git/bq/babushka-go/java/target/debug/libjavababushka.dylib + + +VM Arguments: +jvm_args: -Djava.library.path=/Users/andrewc/git/bq/babushka-go/java/benchmarks/../target/debug -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant +java_command: javababushka.benchmarks.BenchmarkingApp -clients babushka_jni -dataSize 10 -concurrentTasks 1 -clientCount 1 +java_class_path (initial): /Users/andrewc/git/bq/babushka-go/java/benchmarks/build/classes/java/main:/Users/andrewc/git/bq/babushka-go/java/benchmarks/build/resources/main:/Users/andrewc/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/32.1.1-jre/ad575652d84153075dd41ec6177ccb15251262b2/guava-32.1.1-jre.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/redis.clients/jedis/4.4.3/a3841f38753f75ec0aa1f48f4b26ecb9434ce1fe/jedis-4.4.3.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/io.lettuce/lettuce-core/6.2.6.RELEASE/4d1c1700a271903b15384bf90c28471d750420ec/lettuce-core-6.2.6.RELEASE.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/commons-cli/commons-cli/1.5.0/dc98be5d5390230684a092589d70ea76a147925c/commons-cli-1.5.0.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.13.0/b7263237aa89c1f99b327197c41d0669707a462e/commons-lang3-3.13.0.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.24.3/8e0f08a59c21e3f17121667489a005a8df091af0/protobuf-java-3.24.3.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.33.0/de2b60b62da487644fc11f734e73c8b0b431238f/checker-qual-3.33.0.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.18.0/89b684257096f548fa39a7df9fdaa409d4d4df91/error_prone_annotations-2.18.0.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar:/Users/andrewc/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-pool2/2.11.1/8970fd110c965f285ed4c6e40be7630c62db6f68/commons-pool2-2.11.1.jar:/Us +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 4 {product} {ergonomic} + uint ConcGCThreads = 2 {product} {ergonomic} + uint G1ConcRefinementThreads = 9 {product} {ergonomic} + size_t G1HeapRegionSize = 8388608 {product} {ergonomic} + uintx GCDrainStackTargetSize = 64 {product} {ergonomic} + size_t InitialHeapSize = 1073741824 {product} {ergonomic} + size_t MarkStackSize = 4194304 {product} {ergonomic} + size_t MaxHeapSize = 17179869184 {product} {ergonomic} + size_t MaxNewSize = 10301210624 {product} {ergonomic} + size_t MinHeapDeltaBytes = 8388608 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5839564 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122909338 {pd product} {ergonomic} + uintx ProfiledCodeHeapSize = 122909338 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + size_t SoftMaxHeapSize = 17179869184 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {product lp64_product} {ergonomic} + bool UseCompressedOops = true {product lp64_product} {ergonomic} + bool UseG1GC = true {product} {ergonomic} + bool UseNUMA = false {product} {ergonomic} + bool UseNUMAInterleaving = false {product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=/Users/andrewc/Library/Java/JavaVirtualMachines/corretto-17.0.3/Contents/Home +PATH=/opt/homebrew/opt/node@16/bin:/usr/local/mysql/bin:/opt/homebrew/opt/ruby/bin:/Users/andrewc/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/andrewc/.cargo/bin +SHELL=/bin/zsh +LC_CTYPE=en_CA.UTF-8 + +Signal Handlers: + SIGSEGV: crash_handler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGBUS: crash_handler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGFPE: crash_handler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGPIPE: javaSignalHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGXFSZ: javaSignalHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGILL: crash_handler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGUSR2: SR_handler in libjvm.dylib, mask=00100000000000000000000000000000, flags=SA_RESTART|SA_SIGINFO + SIGHUP: UserHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGINT: UserHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGTERM: UserHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGQUIT: UserHandler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + *** Handler was modified! + *** Expected: javaSignalHandler in libjvm.dylib, mask=11100110100111111111111111111111, flags=SA_RESTART|SA_SIGINFO + SIGTRAP: crash_handler in libjvm.dylib, mask=11100110000111110111111111111111, flags=SA_RESTART|SA_SIGINFO + + +--------------- S Y S T E M --------------- + +OS: +uname: Darwin 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 arm64 +OS uptime: 2 days 3:32 hours +rlimit (soft/hard): STACK 8176k/65520k , CORE 0k/infinity , NPROC 10666/16000 , NOFILE 10240/infinity , AS infinity/infinity , CPU infinity/infinity , DATA infinity/infinity , FSIZE infinity/infinity , MEMLOCK infinity/infinity , RSS infinity/infinity +load average: 2.36 3.48 4.55 + +CPU: total 10 (initial active 10) 0x61:0x0:0x1b588bb3:0, fp, simd, crc, lse + +Memory: 16k page, physical 67108864k(1300816k free), swap 0k(0k free) + +vm_info: OpenJDK 64-Bit Server VM (17.0.3+6-LTS) for bsd-aarch64 JRE (17.0.3+6-LTS), built on Apr 16 2022 17:14:31 by "jenkins" with clang Apple LLVM 13.0.0 (clang-1300.0.29.30) + +END. diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 7cbe8093e1..6a2eb1f1db 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -9,6 +9,7 @@ import java.util.stream.Stream; import javababushka.benchmarks.clients.JedisClient; import javababushka.benchmarks.clients.JedisPseudoAsyncClient; +import javababushka.benchmarks.clients.JniSyncClient; import javababushka.benchmarks.clients.LettuceAsyncClient; import javababushka.benchmarks.clients.LettuceClient; import org.apache.commons.cli.CommandLine; @@ -62,6 +63,9 @@ public static void main(String[] args) { case LETTUCE_ASYNC: testClientSetGet(LettuceAsyncClient::new, runConfiguration, true); break; + case BABUSHKA_JNI: + testClientSetGet(JniSyncClient::new, runConfiguration, true); + break; case BABUSHKA_ASYNC: System.out.println("Babushka async not yet configured"); break; @@ -212,6 +216,7 @@ public enum ClientName { JEDIS_ASYNC("Jedis async"), LETTUCE("Lettuce"), LETTUCE_ASYNC("Lettuce async"), + BABUSHKA_JNI("JNI sync"), BABUSHKA_ASYNC("Babushka async"), ALL("All"), ALL_SYNC("All sync"), diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java new file mode 100644 index 0000000000..02c3cf3f9e --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java @@ -0,0 +1,307 @@ +package javababushka.benchmarks.clients; + +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 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 RedisClient client; + + private SocketChannel channel; + + private boolean isChannelWriting = false; + + @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 = 1000; + while (client.socketPath == null && timeout < maxTimeout) { + timeout++; + try { + Thread.sleep(250); + } 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(); + + makeConnection(request); + } + + @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(); + + ResponseOuterClass.Response response = makeRedisRequest(request); + // nothing to do with the response + } + + @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(); + + ResponseOuterClass.Response response = makeRedisRequest(getStringRequest); + return 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 |= (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 = (int) pair.getRight(); + byte[] responseBytes = + Arrays.copyOfRange(buffer, startIdx, startIdx + (int) (long) pair.getLeft()); + ResponseOuterClass.Response response = ResponseOuterClass.Response.parseFrom(responseBytes); + return response; + } + + private static Byte[] varintBytes(int value) { + ArrayList output = new ArrayList(); + int bits = value & 0x7F; + value >>= 7; + while (value > 0) { + output.add(new Byte((byte) (0x80 | bits))); + bits = value & 0x7F; + value >>= 7; + } + output.add(new Byte((byte) bits)); + Byte[] arr = new Byte[] {}; + return output.toArray(arr); + } + + 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 makeConnection( + connection_request.ConnectionRequestOuterClass.ConnectionRequest 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(); + while (isChannelWriting) { + try { + Thread.sleep(250); + } catch (InterruptedException interruptedException) { + // ignore... + } + } + isChannelWriting = true; + while (buffer.hasRemaining()) { + try { + channel.write(buffer); + } catch (IOException ioException) { + // ignore... + } + } + isChannelWriting = false; + + ResponseOuterClass.Response response = null; + int timeout = 0; + try { + byte[] responseBuffer = readSocketMessage(channel); + while (responseBuffer == null && timeout < MAX_TIMEOUT) { + Thread.sleep(250); + timeout++; + responseBuffer = readSocketMessage(channel); + } + + response = decodeMessage(responseBuffer); + } catch (Exception e) { + e.printStackTrace(); + } + return response; + } + + 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(); + while (isChannelWriting) { + try { + Thread.sleep(250); + } catch (InterruptedException interruptedException) { + // ignore... + } + } + isChannelWriting = true; + while (buffer.hasRemaining()) { + try { + channel.write(buffer); + } catch (IOException ioException) { + // ignore... + } + } + isChannelWriting = false; + + 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/utils/Benchmarking.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java index 646ee4a809..938e8e6f20 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -109,7 +109,9 @@ public static Map calculateResults( percentile(latencies, 50), percentile(latencies, 90), percentile(latencies, 99), - stdDeviation(latencies, avgLatency))); + stdDeviation(latencies, avgLatency), + latencies.size() + )); } return results; @@ -161,6 +163,8 @@ public static void printResults(Map resultsMap) { action + " p99 latency in ms: " + results.p99Latency / LATENCY_NORMALIZATION); System.out.println( action + " std dev in ms: " + results.stdDeviation / LATENCY_NORMALIZATION); + System.out.println( + action + " total hits: " + results.totalHits); } } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java index 4f62f840c0..f35c8023e5 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java @@ -8,12 +8,15 @@ public class LatencyResults { public final long p99Latency; public final double stdDeviation; + public final int totalHits; + public LatencyResults( - double avgLatency, long p50Latency, long p90Latency, long p99Latency, double stdDeviation) { + double avgLatency, long p50Latency, long p90Latency, long p99Latency, double stdDeviation, int totalHits) { this.avgLatency = avgLatency; this.p50Latency = p50Latency; this.p90Latency = p90Latency; this.p99Latency = p99Latency; this.stdDeviation = stdDeviation; + this.totalHits = totalHits; } } diff --git a/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java b/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java new file mode 100644 index 0000000000..3a9d695168 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/client/ConnectionRequestOuterClass.java @@ -0,0 +1,4289 @@ +// 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 new file mode 100644 index 0000000000..4f267de6e5 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/client/RedisClient.java @@ -0,0 +1,27 @@ +package javababushka.client; + +public class RedisClient { + public static native void startSocketListenerExternal(RedisClient callback); + + 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 new file mode 100644 index 0000000000..3b5022e1bb --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/client/RedisRequestOuterClass.java @@ -0,0 +1,6972 @@ +// 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 new file mode 100644 index 0000000000..d94678db3f --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/client/ResponseOuterClass.java @@ -0,0 +1,2283 @@ +// 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/src/lib.rs b/java/src/lib.rs index e69de29bb2..c2eefae8bd 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -0,0 +1,76 @@ +use babushka::start_socket_listener; + +use jni::objects::{JClass, JObject}; +use jni::JNIEnv; +use jni::sys::jlong; +use std::sync::mpsc; + +use redis::Value; + +fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<'local> { + match val { + Value::Nil => JObject::null(), + Value::Status(str) => JObject::from(env.new_string(str).unwrap()), + Value::Okay => JObject::from(env.new_string("OK").unwrap()), + Value::Int(num) => env.new_object("java/lang/Integer", "(I)Ljava/lang/Integer;", &[num.into()]).unwrap(), + Value::Data(data) => match std::str::from_utf8(data.as_ref()) { + Ok(val) => JObject::from(env.new_string(val).unwrap()), + Err(_err) => { + let _ = env.throw("Error decoding Unicode data"); + JObject::null() + }, + }, + Value::Bulk(_bulk) => { + let _ = env.throw("Not implemented"); + JObject::null() + /* + let elements: &PyList = PyList::new( + py, + bulk.into_iter() + .map(|item| redis_value_to_py(py, item).unwrap()), + ); + Ok(elements.into_py(py)) + */ + } + } +} + +#[no_mangle] +pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'local>( + mut env: JNIEnv<'local>, + _class: JClass<'local>, + pointer: jlong +) -> JObject<'local> { + let value = unsafe { Box::from_raw(pointer as *mut Value) }; + redis_value_to_java(env, *value) +} + +#[no_mangle] +pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal<'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(); +} From 73c448f276b1d0d70a3af133906f969ddabdd03d Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Thu, 19 Oct 2023 10:32:20 -0700 Subject: [PATCH 20/46] Handle Exceptions from client; add JniSyncClient fixes Signed-off-by: acarbonetto --- .../benchmarks/BenchmarkingApp.java | 2 +- .../benchmarks/clients/JedisClient.java | 4 ++ .../benchmarks/clients/JniSyncClient.java | 43 +++++--------- .../benchmarks/utils/Benchmarking.java | 58 ++++++++++++------- 4 files changed, 58 insertions(+), 49 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 6a2eb1f1db..018cf13c01 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -64,7 +64,7 @@ public static void main(String[] args) { testClientSetGet(LettuceAsyncClient::new, runConfiguration, true); break; case BABUSHKA_JNI: - testClientSetGet(JniSyncClient::new, runConfiguration, true); + testClientSetGet(JniSyncClient::new, runConfiguration, false); break; case BABUSHKA_ASYNC: System.out.println("Babushka async not yet configured"); diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java index d48e0eeeea..4cfd294fda 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java @@ -36,6 +36,10 @@ public void connectToRedis(ConnectionSettings connectionSettings) { jedisResource = new Jedis(connectionSettings.host, connectionSettings.port, connectionSettings.useSsl); jedisResource.connect(); + if (!jedisResource.isConnected()) { + throw new RuntimeException("failed to connect to jedis"); + } + String info_result = info(); } public String info() { diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java index 02c3cf3f9e..1dee8ea511 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java @@ -220,22 +220,15 @@ private ResponseOuterClass.Response makeConnection( } buffer.put(request.toByteArray()); buffer.flip(); - while (isChannelWriting) { - try { - Thread.sleep(250); - } catch (InterruptedException interruptedException) { - // ignore... - } - } - isChannelWriting = true; - while (buffer.hasRemaining()) { - try { - channel.write(buffer); - } catch (IOException ioException) { - // ignore... + try { + synchronized (buffer) { + while (buffer.hasRemaining()) { + channel.write(buffer); + } } + } catch (IOException ioException) { + // ignore... } - isChannelWriting = false; ResponseOuterClass.Response response = null; int timeout = 0; @@ -266,22 +259,16 @@ private ResponseOuterClass.Response makeRedisRequest( } buffer.put(request.toByteArray()); buffer.flip(); - while (isChannelWriting) { - try { - Thread.sleep(250); - } catch (InterruptedException interruptedException) { - // ignore... - } - } - isChannelWriting = true; - while (buffer.hasRemaining()) { - try { - channel.write(buffer); - } catch (IOException ioException) { - // ignore... + try { + // TODO: check that this is the most performant mutex solution + synchronized (buffer) { + while (buffer.hasRemaining()) { + channel.write(buffer); + } } + } catch (IOException ioException) { + // ignore... } - isChannelWriting = false; int timeout = 0; byte[] responseBuffer = null; 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 938e8e6f20..2004f1b7fb 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -10,7 +10,9 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -46,15 +48,15 @@ private static ChosenAction randomAction() { public static String generateKeyGet() { int range = SIZE_GET_KEYSPACE - SIZE_SET_KEYSPACE; - return Math.floor(Math.random() * range + SIZE_SET_KEYSPACE + 1) + ""; + return Integer.toString((int) Math.floor(Math.random() * range + SIZE_SET_KEYSPACE + 1)); } public static String generateKeySet() { - return (Math.floor(Math.random() * SIZE_SET_KEYSPACE) + 1) + ""; + return Integer.toString((int) (Math.floor(Math.random() * SIZE_SET_KEYSPACE) + 1)); } public interface Operation { - void go() throws Exception; + void go() throws InterruptedException, ExecutionException, TimeoutException; } private static Pair getLatency(Map actions) { @@ -62,8 +64,9 @@ private static Pair getLatency(Map long before = System.nanoTime(); try { actions.get(action).go(); - } catch (Exception e) { + } catch (InterruptedException | ExecutionException | TimeoutException e) { // timed out - exception from Future::get + return null; } long after = System.nanoTime(); return Pair.of(action, after - before); @@ -88,7 +91,7 @@ private static double stdDeviation(ArrayList latencies, Double avgLatency) return Math.sqrt(stdDeviation / latencies.size()); } - // This has the side-effect of sorting each latencies ArrayList + // This has the side effect of sorting each latency ArrayList public static Map calculateResults( Map> actionLatencies) { Map results = new HashMap(); @@ -97,21 +100,34 @@ public static Map calculateResults( ChosenAction action = entry.getKey(); ArrayList latencies = entry.getValue(); - Double avgLatency = - latencies.stream().collect(Collectors.summingLong(Long::longValue)) - / Double.valueOf(latencies.size()); + if (latencies.size() == 0) { + results.put( + action, + new LatencyResults( + 0, + 0, + 0, + 0, + 0, + 0 + )); + } else { + Double avgLatency = latencies.size() <= 0 ? 0 : + latencies.stream().collect(Collectors.summingLong(Long::longValue)) + / Double.valueOf(latencies.size()); - Collections.sort(latencies); - results.put( - action, - new LatencyResults( - avgLatency, - percentile(latencies, 50), - percentile(latencies, 90), - percentile(latencies, 99), - stdDeviation(latencies, avgLatency), - latencies.size() - )); + Collections.sort(latencies); + results.put( + action, + new LatencyResults( + avgLatency, + percentile(latencies, 50), + percentile(latencies, 90), + percentile(latencies, 99), + stdDeviation(latencies, avgLatency), + latencies.size() + )); + } } return results; @@ -215,7 +231,9 @@ public static void testClientSetGet( // operate and calculate tik-tok Pair result = measurePerformance(clients.get(clientIndex), dataSize, async); - actionResults.get(result.getLeft()).add(result.getRight()); + if (result != null) { + actionResults.get(result.getLeft()).add(result.getRight()); + } iterationIncrement = iterationCounter.getAndIncrement(); } From 79459f5e168f788985b19560210453655de0c134 Mon Sep 17 00:00:00 2001 From: acarbonetto Date: Thu, 19 Oct 2023 18:17:22 -0700 Subject: [PATCH 21/46] Clean up latency and add error checking Signed-off-by: acarbonetto --- .../benchmarks/clients/JniSyncClient.java | 89 +++++++++++-------- .../benchmarks/utils/Benchmarking.java | 66 ++++++++------ .../benchmarks/utils/LatencyResults.java | 7 +- 3 files changed, 99 insertions(+), 63 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java index 1dee8ea511..dcf2aa7076 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java @@ -18,13 +18,12 @@ public class JniSyncClient implements SyncClient { private static int MAX_TIMEOUT = 1000; + private static int TIMEOUT_INTERVAL = 100; private RedisClient client; private SocketChannel channel; - private boolean isChannelWriting = false; - @Override public void connectToRedis() { connectToRedis(new ConnectionSettings("localhost", 6379, false)); @@ -40,11 +39,11 @@ public void connectToRedis(ConnectionSettings connectionSettings) { RedisClient.startSocketListenerExternal(client); int timeout = 0; - int maxTimeout = 1000; + int maxTimeout = MAX_TIMEOUT; while (client.socketPath == null && timeout < maxTimeout) { - timeout++; + timeout += TIMEOUT_INTERVAL; try { - Thread.sleep(250); + Thread.sleep(TIMEOUT_INTERVAL); } catch (InterruptedException exception) { // ignored } @@ -98,7 +97,8 @@ public void connectToRedis(ConnectionSettings connectionSettings) { .setDatabaseId(0) .build(); - makeConnection(request); + makeRedisRequest(request.toByteArray()); + receiveRedisResponse(); } @Override @@ -119,8 +119,8 @@ public void set(String key, String value) { .setSimpleRoutes(RedisRequestOuterClass.SimpleRoutes.AllNodes)) .build(); - ResponseOuterClass.Response response = makeRedisRequest(request); - // nothing to do with the response + makeRedisRequest(request.toByteArray()); + receiveRedisResponse(); } @Override @@ -139,7 +139,8 @@ public String get(String key) { .setSimpleRoutes(RedisRequestOuterClass.SimpleRoutes.AllNodes)) .build(); - ResponseOuterClass.Response response = makeRedisRequest(getStringRequest); + makeRedisRequest(getStringRequest.toByteArray()); + ResponseOuterClass.Response response = receiveRedisResponse(); return response.toString(); } @@ -195,22 +196,9 @@ private static Byte[] varintBytes(int value) { return output.toArray(arr); } - 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 makeConnection( - connection_request.ConnectionRequestOuterClass.ConnectionRequest request) { - Byte[] varint = varintBytes(request.toByteArray().length); + private void makeRedisRequest( + byte[] request) { + Byte[] varint = varintBytes(request.length); // System.out.println("Request: \n" + request.toString()); ByteBuffer buffer = ByteBuffer.allocate(1024); @@ -218,10 +206,11 @@ private ResponseOuterClass.Response makeConnection( for (Byte b : varint) { buffer.put(b); } - buffer.put(request.toByteArray()); + buffer.put(request); buffer.flip(); try { - synchronized (buffer) { + // TODO: check that this is the most performant mutex solution + synchronized (channel) { while (buffer.hasRemaining()) { channel.write(buffer); } @@ -229,24 +218,54 @@ private ResponseOuterClass.Response makeConnection( } catch (IOException ioException) { // ignore... } + } + + private ResponseOuterClass.Response receiveRedisResponse() { + ByteBuffer readBuffer = ByteBuffer.allocate(1024); - ResponseOuterClass.Response response = null; int timeout = 0; + int bytesRead = 0; try { - byte[] responseBuffer = readSocketMessage(channel); - while (responseBuffer == null && timeout < MAX_TIMEOUT) { - Thread.sleep(250); - timeout++; - responseBuffer = readSocketMessage(channel); + 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); + } } - - response = decodeMessage(responseBuffer); + } 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); 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 2004f1b7fb..c524ea86bf 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -1,5 +1,7 @@ package javababushka.benchmarks.utils; +import static java.util.concurrent.CompletableFuture.runAsync; + import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; @@ -11,6 +13,8 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; @@ -101,20 +105,13 @@ public static Map calculateResults( ArrayList latencies = entry.getValue(); if (latencies.size() == 0) { - results.put( - action, - new LatencyResults( - 0, - 0, - 0, - 0, - 0, - 0 - )); + results.put(action, new LatencyResults(0, 0, 0, 0, 0, 0)); } else { - Double avgLatency = latencies.size() <= 0 ? 0 : - latencies.stream().collect(Collectors.summingLong(Long::longValue)) - / Double.valueOf(latencies.size()); + Double avgLatency = + latencies.size() <= 0 + ? 0 + : latencies.stream().collect(Collectors.summingLong(Long::longValue)) + / Double.valueOf(latencies.size()); Collections.sort(latencies); results.put( @@ -125,8 +122,7 @@ public static Map calculateResults( percentile(latencies, 90), percentile(latencies, 99), stdDeviation(latencies, avgLatency), - latencies.size() - )); + latencies.size())); } } @@ -179,8 +175,7 @@ public static void printResults(Map resultsMap) { action + " p99 latency in ms: " + results.p99Latency / LATENCY_NORMALIZATION); System.out.println( action + " std dev in ms: " + results.stdDeviation / LATENCY_NORMALIZATION); - System.out.println( - action + " total hits: " + results.totalHits); + System.out.println(action + " total hits: " + results.totalHits); } } @@ -225,16 +220,28 @@ public static void testClientSetGet( while (iterationIncrement < iterations) { if (config.debugLogging) { System.out.printf( - "> iteration = %d/%d, client# = %d/%d%n", - iterationIncrement + 1, iterations, clientIndex + 1, clientCount); + "> task = %d, iteration = %d/%d, client# = %d/%d%n", + taskNumDebugging, + iterationIncrement + 1, + iterations, + clientIndex + 1, + clientCount); } // operate and calculate tik-tok Pair result = measurePerformance(clients.get(clientIndex), dataSize, async); + if (config.debugLogging) { + System.out.printf( + "> task = %d, iteration = %d/%d, client# = %d/%d - DONE%n", + taskNumDebugging, + iterationIncrement + 1, + iterations, + clientIndex + 1, + clientCount); + } if (result != null) { actionResults.get(result.getLeft()).add(result.getRight()); } - iterationIncrement = iterationCounter.getAndIncrement(); } }); @@ -246,16 +253,21 @@ public static void testClientSetGet( concurrentNum, clientCount, tasks.size()); } long before = System.nanoTime(); + ExecutorService threadPool = Executors.newFixedThreadPool(concurrentNum); - // create threads and add them to the asyncpool. + // create threads and add them to the async pool. // This will start execution of all the concurrent tasks. List asyncTasks = - tasks.stream().map(CompletableFuture::runAsync).collect(Collectors.toList()); - try { - // wait 1 second before waiting for threads to complete - Thread.sleep(1000); - } catch (InterruptedException interruptedException) { - interruptedException.printStackTrace(); + tasks.stream().map((runnable) -> runAsync(runnable, threadPool)).collect(Collectors.toList()); + // close pool and await for tasks to complete + threadPool.shutdown(); + while (!threadPool.isTerminated()) { + try { + // wait 1 second before waiting for threads to complete + Thread.sleep(100); + } catch (InterruptedException interruptedException) { + interruptedException.printStackTrace(); + } } // wait for all futures to complete asyncTasks.forEach( diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java index f35c8023e5..662ae80797 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java @@ -11,7 +11,12 @@ public class LatencyResults { public final int totalHits; public LatencyResults( - double avgLatency, long p50Latency, long p90Latency, long p99Latency, double stdDeviation, int totalHits) { + double avgLatency, + long p50Latency, + long p90Latency, + long p99Latency, + double stdDeviation, + int totalHits) { this.avgLatency = avgLatency; this.p50Latency = p50Latency; this.p90Latency = p90Latency; From 9e62324fe548f34611badffd590d67ccdf7c6582 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 24 Oct 2023 16:33:17 -0700 Subject: [PATCH 22/46] Minor fixes. Signed-off-by: Yury-Fridlyand --- .../benchmarks/clients/JniSyncClient.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java index 0f05bf8622..1c3c376f07 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java @@ -7,6 +7,7 @@ import java.nio.channels.SocketChannel; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import javababushka.benchmarks.utils.ConnectionSettings; import javababushka.client.RedisClient; import org.apache.commons.lang3.tuple.MutablePair; @@ -141,7 +142,7 @@ public String get(String key) { makeRedisRequest(getStringRequest.toByteArray()); ResponseOuterClass.Response response = receiveRedisResponse(); - return response.toString(); + return response == null ? null : response.toString(); } @Override @@ -159,7 +160,7 @@ private static Pair decodeVarint(byte[] buffer, int pos) throws E long result = 0; while (true) { byte b = buffer[pos]; - result |= (b & 0x7F) << shift; + result |= (long) (b & 0x7F) << shift; pos += 1; if ((b & 0x80) == 0) { result &= mask; @@ -175,23 +176,22 @@ private static Pair decodeVarint(byte[] buffer, int pos) throws E private static ResponseOuterClass.Response decodeMessage(byte[] buffer) throws Exception { Pair pair = decodeVarint(buffer, 0); - int startIdx = (int) pair.getRight(); + int startIdx = pair.getRight(); byte[] responseBytes = Arrays.copyOfRange(buffer, startIdx, startIdx + (int) (long) pair.getLeft()); - ResponseOuterClass.Response response = ResponseOuterClass.Response.parseFrom(responseBytes); - return response; + return ResponseOuterClass.Response.parseFrom(responseBytes); } private static Byte[] varintBytes(int value) { - ArrayList output = new ArrayList(); + List output = new ArrayList<>(); int bits = value & 0x7F; value >>= 7; while (value > 0) { - output.add(new Byte((byte) (0x80 | bits))); + output.add((byte) (0x80 | bits)); bits = value & 0x7F; value >>= 7; } - output.add(new Byte((byte) bits)); + output.add((byte) bits); Byte[] arr = new Byte[] {}; return output.toArray(arr); } @@ -200,7 +200,9 @@ private void makeRedisRequest(byte[] request) { Byte[] varint = varintBytes(request.length); // System.out.println("Request: \n" + request.toString()); - ByteBuffer buffer = ByteBuffer.allocate(1024); + // 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); @@ -220,6 +222,7 @@ private void makeRedisRequest(byte[] request) { } private ResponseOuterClass.Response receiveRedisResponse() { + // TODO what if buffer is too small? re-allocate? ByteBuffer readBuffer = ByteBuffer.allocate(1024); int timeout = 0; @@ -233,7 +236,7 @@ private ResponseOuterClass.Response receiveRedisResponse() { throw new RuntimeException("Max timeout reached"); } - bytesRead = channel.read(readBuffer); + bytesRead += channel.read(readBuffer); Thread.sleep(TIMEOUT_INTERVAL); } } @@ -247,7 +250,7 @@ private ResponseOuterClass.Response receiveRedisResponse() { try { response = decodeMessage(bytes); } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); } return response; } @@ -305,7 +308,7 @@ private ResponseOuterClass.Response makeRedisRequest( try { response = decodeMessage(responseBuffer); } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); } return response; } From 11a78a370725fe065d91c424c8c28fea5ffa8868 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 25 Oct 2023 10:47:28 -0700 Subject: [PATCH 23/46] Fix result printing. Signed-off-by: Yury-Fridlyand --- .../benchmarks/utils/Benchmarking.java | 16 ++++++++-------- .../benchmarks/utils/LatencyResults.java | 18 +++--------------- 2 files changed, 11 insertions(+), 23 deletions(-) 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 a243413ed6..976ff9c1e2 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -128,19 +128,19 @@ public static Map calculateResults( public static void printResults( Map resultsMap, double duration, int iterations) { + System.out.printf("Runtime s: %f%n", duration); + System.out.printf("Iterations: %d%n", iterations); for (Map.Entry entry : resultsMap.entrySet()) { ChosenAction action = entry.getKey(); LatencyResults results = entry.getValue(); System.out.printf("===> %s <===%n", action); - System.out.printf("avg. time: %f%n", results.avgLatency / LATENCY_NORMALIZATION); - System.out.printf("p50 latency: %f%n", results.p50Latency / LATENCY_NORMALIZATION); - System.out.printf("p90 latency: %f%n", results.p90Latency / LATENCY_NORMALIZATION); - System.out.printf("p99 latency: %f%n", results.p99Latency / LATENCY_NORMALIZATION); - System.out.printf("std dev: %f%n", results.stdDeviation / LATENCY_NORMALIZATION); - System.out.printf("Total hits: %d", results.totalHits); - System.out.printf("Runtime: %f%n", duration); - System.out.printf("Iterations: %d%n", iterations); + System.out.printf("avg. time ms: %f%n", results.avgLatency); + System.out.printf("std dev ms: %f%n", results.stdDeviation); + System.out.printf("p50 latency ms: %f%n", results.p50Latency); + System.out.printf("p90 latency ms: %f%n", results.p90Latency); + System.out.printf("p99 latency ms: %f%n", results.p99Latency); + System.out.printf("Total hits: %d%n", results.totalHits); } } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java index 6098d6fe71..5d25d72a67 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/LatencyResults.java @@ -1,6 +1,9 @@ package javababushka.benchmarks.utils; +import lombok.AllArgsConstructor; + /** Raw timing results in nanoseconds */ +@AllArgsConstructor public class LatencyResults { public final double avgLatency; public final double p50Latency; @@ -8,19 +11,4 @@ public class LatencyResults { public final double p99Latency; public final double stdDeviation; public final int totalHits; - - public LatencyResults( - double avgLatency, - double p50Latency, - double p90Latency, - double p99Latency, - double stdDeviation, - int totalHits) { - this.avgLatency = avgLatency; - this.p50Latency = p50Latency; - this.p90Latency = p90Latency; - this.p99Latency = p99Latency; - this.stdDeviation = stdDeviation; - this.totalHits = totalHits; - } } From a2c267092442fae2a03c04dc7e89124bda9cb2b2 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 25 Oct 2023 10:58:40 -0700 Subject: [PATCH 24/46] Add TPS. Signed-off-by: Yury-Fridlyand --- .../main/java/javababushka/benchmarks/utils/Benchmarking.java | 1 + 1 file changed, 1 insertion(+) 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 976ff9c1e2..2e70c4386b 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -130,6 +130,7 @@ public static void printResults( Map resultsMap, double duration, int iterations) { System.out.printf("Runtime s: %f%n", duration); System.out.printf("Iterations: %d%n", iterations); + System.out.printf("TPS: %f%n", iterations / duration); for (Map.Entry entry : resultsMap.entrySet()) { ChosenAction action = entry.getKey(); LatencyResults results = entry.getValue(); From 4b9f8de55247669480759f6a73c8aaf473c616d6 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 25 Oct 2023 11:38:36 -0700 Subject: [PATCH 25/46] Remove duplicates. Reorganize and fix imports. Signed-off-by: Yury-Fridlyand --- .../javababushka/benchmarks/AsyncClient.java | 16 ---- .../benchmarks/BenchmarkingApp.java | 10 +-- .../java/javababushka/benchmarks/Client.java | 13 ---- .../javababushka/benchmarks/SyncClient.java | 7 -- .../clients/{ => babushka}/JniSyncClient.java | 3 +- .../clients/{ => jedis}/JedisClient.java | 4 +- .../{ => jedis}/JedisPseudoAsyncClient.java | 3 +- .../{ => lettuce}/LettuceAsyncClient.java | 3 +- .../clients/{ => lettuce}/LettuceClient.java | 3 +- .../benchmarks/jedis/JedisClient.java | 65 ----------------- .../jedis/JedisPseudoAsyncClient.java | 39 ---------- .../lettuce/LettuceAsyncClient.java | 73 ------------------- .../benchmarks/lettuce/LettuceClient.java | 56 -------------- .../benchmarks/jedis/JedisClientIT.java | 12 +-- .../lettuce/LettuceAsyncClientIT.java | 1 + .../benchmarks/lettuce/LettuceClientIT.java | 1 + 16 files changed, 21 insertions(+), 288 deletions(-) delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/AsyncClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/Client.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/SyncClient.java rename java/benchmarks/src/main/java/javababushka/benchmarks/clients/{ => babushka}/JniSyncClient.java (99%) rename java/benchmarks/src/main/java/javababushka/benchmarks/clients/{ => jedis}/JedisClient.java (93%) rename java/benchmarks/src/main/java/javababushka/benchmarks/clients/{ => jedis}/JedisPseudoAsyncClient.java (91%) rename java/benchmarks/src/main/java/javababushka/benchmarks/clients/{ => lettuce}/LettuceAsyncClient.java (94%) rename java/benchmarks/src/main/java/javababushka/benchmarks/clients/{ => lettuce}/LettuceClient.java (92%) delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisPseudoAsyncClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceAsyncClient.java delete mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceClient.java diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/AsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/AsyncClient.java deleted file mode 100644 index a688775084..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/AsyncClient.java +++ /dev/null @@ -1,16 +0,0 @@ -package javababushka.benchmarks; - -import java.util.concurrent.Future; - -public interface AsyncClient extends Client { - - long DEFAULT_TIMEOUT = 1000; - - Future asyncSet(String key, String value); - - Future asyncGet(String key); - - T waitForResult(Future future); - - T waitForResult(Future future, long timeout); -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index fb0578947f..9e19abd4e3 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -5,11 +5,11 @@ import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; -import javababushka.benchmarks.clients.JedisClient; -import javababushka.benchmarks.clients.JedisPseudoAsyncClient; -import javababushka.benchmarks.clients.JniSyncClient; -import javababushka.benchmarks.clients.LettuceAsyncClient; -import javababushka.benchmarks.clients.LettuceClient; +import javababushka.benchmarks.clients.babushka.JniSyncClient; +import javababushka.benchmarks.clients.jedis.JedisClient; +import javababushka.benchmarks.clients.jedis.JedisPseudoAsyncClient; +import javababushka.benchmarks.clients.lettuce.LettuceAsyncClient; +import javababushka.benchmarks.clients.lettuce.LettuceClient; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/Client.java b/java/benchmarks/src/main/java/javababushka/benchmarks/Client.java deleted file mode 100644 index 16ab36847d..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/Client.java +++ /dev/null @@ -1,13 +0,0 @@ -package javababushka.benchmarks; - -import javababushka.benchmarks.utils.ConnectionSettings; - -public interface Client { - void connectToRedis(); - - void connectToRedis(ConnectionSettings connectionSettings); - - default void closeConnection() {} - - String getName(); -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/SyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/SyncClient.java deleted file mode 100644 index c99174af3d..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/SyncClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package javababushka.benchmarks; - -public interface SyncClient extends Client { - void set(String key, String value); - - String get(String key); -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java similarity index 99% rename from java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java rename to java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java index 1c3c376f07..bf9b94b352 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JniSyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniSyncClient.java @@ -1,4 +1,4 @@ -package javababushka.benchmarks.clients; +package javababushka.benchmarks.clients.babushka; import java.io.IOException; import java.net.StandardProtocolFamily; @@ -8,6 +8,7 @@ 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; diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java similarity index 93% rename from java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java rename to java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java index 4cfd294fda..fe7722b324 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java @@ -1,5 +1,6 @@ -package javababushka.benchmarks.clients; +package javababushka.benchmarks.clients.jedis; +import javababushka.benchmarks.clients.SyncClient; import javababushka.benchmarks.utils.ConnectionSettings; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; @@ -39,7 +40,6 @@ public void connectToRedis(ConnectionSettings connectionSettings) { if (!jedisResource.isConnected()) { throw new RuntimeException("failed to connect to jedis"); } - String info_result = info(); } public String info() { diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java similarity index 91% rename from java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java rename to java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java index 1aff543c6f..e441b28ad8 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/JedisPseudoAsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisPseudoAsyncClient.java @@ -1,8 +1,9 @@ -package javababushka.benchmarks.clients; +package javababushka.benchmarks.clients.jedis; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import javababushka.benchmarks.clients.AsyncClient; /** * A jedis client with pseudo-sync capabilities. Jedis doesn't provide async API diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java similarity index 94% rename from java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java rename to java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java index 7251953845..fdde50d5f5 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceAsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClient.java @@ -1,4 +1,4 @@ -package javababushka.benchmarks.clients; +package javababushka.benchmarks.clients.lettuce; import io.lettuce.core.RedisClient; import io.lettuce.core.RedisFuture; @@ -6,6 +6,7 @@ import io.lettuce.core.api.async.RedisAsyncCommands; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.utils.ConnectionSettings; /** A Lettuce client with async capabilities see: https://lettuce.io/ */ diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java similarity index 92% rename from java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java rename to java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java index 674fb729b0..5e4b1a633c 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/LettuceClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java @@ -1,8 +1,9 @@ -package javababushka.benchmarks.clients; +package javababushka.benchmarks.clients.lettuce; import io.lettuce.core.RedisClient; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.sync.RedisStringCommands; +import javababushka.benchmarks.clients.SyncClient; import javababushka.benchmarks.utils.ConnectionSettings; /** A Lettuce client with sync capabilities see: https://lettuce.io/ */ diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisClient.java deleted file mode 100644 index 214a6cae10..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisClient.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ -package javababushka.benchmarks.jedis; - -import javababushka.benchmarks.SyncClient; -import javababushka.benchmarks.utils.ConnectionSettings; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class JedisClient implements SyncClient { - - public static final String DEFAULT_HOST = "localhost"; - public static final int DEFAULT_PORT = 6379; - - protected Jedis jedisResource; - - public boolean someLibraryMethod() { - return true; - } - - @Override - public void connectToRedis() { - JedisPool pool = new JedisPool(DEFAULT_HOST, DEFAULT_PORT); - jedisResource = pool.getResource(); - } - - @Override - public void closeConnection() { - try { - jedisResource.close(); - } catch (Exception ignored) { - } - } - - @Override - public String getName() { - return "Jedis"; - } - - @Override - public void connectToRedis(ConnectionSettings connectionSettings) { - jedisResource = - new Jedis(connectionSettings.host, connectionSettings.port, connectionSettings.useSsl); - jedisResource.connect(); - } - - public String info() { - return jedisResource.info(); - } - - public String info(String section) { - return jedisResource.info(section); - } - - @Override - public void set(String key, String value) { - jedisResource.set(key, value); - } - - @Override - public String get(String key) { - return jedisResource.get(key); - } -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisPseudoAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisPseudoAsyncClient.java deleted file mode 100644 index 598c455d1e..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/jedis/JedisPseudoAsyncClient.java +++ /dev/null @@ -1,39 +0,0 @@ -package javababushka.benchmarks.jedis; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import javababushka.benchmarks.AsyncClient; - -// Jedis doesn't provide async API -// https://github.com/redis/jedis/issues/241 -public class JedisPseudoAsyncClient extends JedisClient implements AsyncClient { - @Override - public Future asyncSet(String key, String value) { - return CompletableFuture.runAsync(() -> super.set(key, value)); - } - - @Override - public Future asyncGet(String key) { - return CompletableFuture.supplyAsync(() -> super.get(key)); - } - - @Override - public T waitForResult(Future future) { - return waitForResult(future, DEFAULT_TIMEOUT); - } - - @Override - public T waitForResult(Future future, long timeout) { - try { - return future.get(timeout, TimeUnit.MILLISECONDS); - } catch (Exception ignored) { - return null; - } - } - - @Override - public String getName() { - return "Jedis pseudo-async"; - } -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceAsyncClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceAsyncClient.java deleted file mode 100644 index 1b8c4ba9b7..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceAsyncClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ -package javababushka.benchmarks.lettuce; - -import io.lettuce.core.RedisClient; -import io.lettuce.core.RedisFuture; -import io.lettuce.core.api.StatefulRedisConnection; -import io.lettuce.core.api.async.RedisAsyncCommands; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import javababushka.benchmarks.AsyncClient; -import javababushka.benchmarks.utils.ConnectionSettings; - -public class LettuceAsyncClient implements AsyncClient { - - RedisClient client; - RedisAsyncCommands asyncCommands; - StatefulRedisConnection connection; - - @Override - public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); - } - - @Override - public void connectToRedis(ConnectionSettings connectionSettings) { - client = - RedisClient.create( - String.format( - "%s://%s:%d", - connectionSettings.useSsl ? "rediss" : "redis", - connectionSettings.host, - connectionSettings.port)); - connection = client.connect(); - asyncCommands = connection.async(); - } - - @Override - public RedisFuture asyncSet(String key, String value) { - return asyncCommands.set(key, value); - } - - @Override - public RedisFuture asyncGet(String key) { - return asyncCommands.get(key); - } - - @Override - public Object waitForResult(Future future) { - return waitForResult(future, DEFAULT_TIMEOUT); - } - - @Override - public Object waitForResult(Future future, long timeoutMS) { - try { - return future.get(timeoutMS, TimeUnit.MILLISECONDS); - } catch (Exception ignored) { - return null; - } - } - - @Override - public void closeConnection() { - connection.close(); - client.shutdown(); - } - - @Override - public String getName() { - return "Lettuce Async"; - } -} diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceClient.java deleted file mode 100644 index e4e1830bda..0000000000 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/lettuce/LettuceClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ -package javababushka.benchmarks.lettuce; - -import io.lettuce.core.RedisClient; -import io.lettuce.core.api.StatefulRedisConnection; -import io.lettuce.core.api.sync.RedisStringCommands; -import javababushka.benchmarks.SyncClient; -import javababushka.benchmarks.utils.ConnectionSettings; - -public class LettuceClient implements SyncClient { - - RedisClient client; - RedisStringCommands syncCommands; - StatefulRedisConnection connection; - - @Override - public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); - } - - @Override - public void connectToRedis(ConnectionSettings connectionSettings) { - client = - RedisClient.create( - String.format( - "%s://%s:%d", - connectionSettings.useSsl ? "rediss" : "redis", - connectionSettings.host, - connectionSettings.port)); - connection = client.connect(); - syncCommands = connection.sync(); - } - - @Override - public void set(String key, String value) { - syncCommands.set(key, value); - } - - @Override - public String get(String key) { - return (String) syncCommands.get(key); - } - - @Override - public void closeConnection() { - connection.close(); - client.shutdown(); - } - - @Override - public String getName() { - return "Lettuce"; - } -} diff --git a/java/benchmarks/src/test/java/javababushka/benchmarks/jedis/JedisClientIT.java b/java/benchmarks/src/test/java/javababushka/benchmarks/jedis/JedisClientIT.java index 12f800260f..9a6dbbe93e 100644 --- a/java/benchmarks/src/test/java/javababushka/benchmarks/jedis/JedisClientIT.java +++ b/java/benchmarks/src/test/java/javababushka/benchmarks/jedis/JedisClientIT.java @@ -7,7 +7,9 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import javababushka.benchmarks.clients.jedis.JedisClient; import javababushka.benchmarks.utils.Benchmarking; import javababushka.benchmarks.utils.ChosenAction; import org.junit.jupiter.api.BeforeAll; @@ -23,12 +25,6 @@ static void initializeJedisClient() { jedisClient.connectToRedis(); } - @Test - public void someLibraryMethodReturnsTrue() { - JedisClient classUnderTest = new JedisClient(); - assertTrue(classUnderTest.someLibraryMethod(), "someLibraryMethod should return 'true'"); - } - @Test public void testResourceInfo() { String result = jedisClient.info(); @@ -56,7 +52,7 @@ public void testResourceSetGet() { ChosenAction.GET_NON_EXISTING, () -> jedisClient.get(Benchmarking.generateKeyGet())); actions.put(ChosenAction.SET, () -> jedisClient.set(Benchmarking.generateKeySet(), value)); - Map> latencies = + Map> latencies = Map.of( ChosenAction.GET_EXISTING, new ArrayList<>(), ChosenAction.GET_NON_EXISTING, new ArrayList<>(), @@ -66,6 +62,6 @@ public void testResourceSetGet() { latencies.get(latency.getKey()).add(latency.getValue()); } - Benchmarking.printResults(Benchmarking.calculateResults(latencies)); + Benchmarking.printResults(Benchmarking.calculateResults(latencies), 0, iterations); } } diff --git a/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceAsyncClientIT.java b/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceAsyncClientIT.java index c051c1b2a4..ee9ad8cb35 100644 --- a/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceAsyncClientIT.java +++ b/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceAsyncClientIT.java @@ -7,6 +7,7 @@ import static org.junit.jupiter.api.Assertions.fail; import io.lettuce.core.RedisFuture; +import javababushka.benchmarks.clients.lettuce.LettuceAsyncClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceClientIT.java b/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceClientIT.java index 445cc5b584..5cbf8186b0 100644 --- a/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceClientIT.java +++ b/java/benchmarks/src/test/java/javababushka/benchmarks/lettuce/LettuceClientIT.java @@ -4,6 +4,7 @@ package javababushka.benchmarks.lettuce; import java.util.HashMap; +import javababushka.benchmarks.clients.lettuce.LettuceClient; import javababushka.benchmarks.utils.Benchmarking; import javababushka.benchmarks.utils.ChosenAction; import org.junit.jupiter.api.AfterAll; From d6b72ac7db6c8e4c33c8de873f513332d10f9efd Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 25 Oct 2023 20:29:38 -0700 Subject: [PATCH 26/46] Int ctor fix. Signed-off-by: Yury-Fridlyand --- java/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/lib.rs b/java/src/lib.rs index c2eefae8bd..133890dcb6 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -12,7 +12,7 @@ fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<' Value::Nil => JObject::null(), Value::Status(str) => JObject::from(env.new_string(str).unwrap()), Value::Okay => JObject::from(env.new_string("OK").unwrap()), - Value::Int(num) => env.new_object("java/lang/Integer", "(I)Ljava/lang/Integer;", &[num.into()]).unwrap(), + Value::Int(num) => env.new_object("java/lang/Integer", "(I)V", &[num.into()]).unwrap(), Value::Data(data) => match std::str::from_utf8(data.as_ref()) { Ok(val) => JObject::from(env.new_string(val).unwrap()), Err(_err) => { From 58f7b589a020e3ed3531ffd3ded79cac9f2165d2 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 31 Oct 2023 15:07:44 -0700 Subject: [PATCH 27/46] Iteration 1. Signed-off-by: Yury-Fridlyand --- babushka-core/src/socket_listener.rs | 2 + java/Cargo.toml | 1 + java/benchmarks/build.gradle | 4 + .../clients/babushka/ChannelHandler.java | 18 +++ .../clients/babushka/JniNettyClient.java | 151 ++++++++++++++++++ .../benchmarks/utils/Benchmarking.java | 1 + .../java/javababushka/client/RedisClient.java | 2 + java/javababushka_client_RedisClient.h | 37 +++++ java/src/lib.rs | 57 ++++++- 9 files changed, 270 insertions(+), 3 deletions(-) create mode 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java create mode 100755 java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java create mode 100644 java/javababushka_client_RedisClient.h diff --git a/babushka-core/src/socket_listener.rs b/babushka-core/src/socket_listener.rs index d2f319fce4..c9be8fb7c8 100644 --- a/babushka-core/src/socket_listener.rs +++ b/babushka-core/src/socket_listener.rs @@ -525,6 +525,8 @@ async fn read_values_loop( return reason; } ReceivedValues(received_requests) => { + print!("Received {} requests: {:?}", received_requests.len(), received_requests); + log_error("parse input", format!("Received {} requests: {:?}", received_requests.len(), received_requests)); handle_requests(received_requests, client, &writer).await; } } diff --git a/java/Cargo.toml b/java/Cargo.toml index 197bb4d4bc..d9d0db8a4f 100644 --- a/java/Cargo.toml +++ b/java/Cargo.toml @@ -16,6 +16,7 @@ tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] logger_core = {path = "../logger_core"} tracing-subscriber = "0.3.16" jni = "0.21.1" +log = "0.4.20" [profile.release] lto = true diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index f9a6d60982..14bee3268d 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -22,6 +22,9 @@ dependencies { // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java 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 + implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.100.Final', classifier: 'linux-x86_64' compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' @@ -37,6 +40,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" } 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 new file mode 100644 index 0000000000..a49229db89 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/ChannelHandler.java @@ -0,0 +1,18 @@ +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 new file mode 100755 index 0000000000..cc18878999 --- /dev/null +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -0,0 +1,151 @@ +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 io.netty.bootstrap.Bootstrap; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandler; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOutboundHandler; +import io.netty.channel.ChannelOutboundHandlerAdapter; +import io.netty.channel.CombinedChannelDuplexHandler; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.SimpleUserEventChannelHandler; +import io.netty.channel.epoll.EpollDomainSocketChannel; +import io.netty.channel.epoll.EpollEventLoopGroup; +import io.netty.channel.unix.UnixChannel; +import javababushka.benchmarks.clients.SyncClient; +import javababushka.benchmarks.utils.ConnectionSettings; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.channel.unix.DomainSocketAddress; +import javababushka.client.RedisClient; + +import java.nio.charset.StandardCharsets; + +public class JniNettyClient implements SyncClient { + + private final static String unixSocket = getSocket(); + + private Channel channel = null; + + // 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); + return null; + } + } + + @Override + public void connectToRedis() { + connectToRedis(new ConnectionSettings("localhost", 6379, false)); + } + + @Override + public void connectToRedis(ConnectionSettings connectionSettings) { + + // TODO maybe move to constructor or to static? + // ====== + Bootstrap bootstrap = new Bootstrap(); + EventLoopGroup group = new EpollEventLoopGroup(); + //EventLoopGroup group = new NioEventLoopGroup(); + try { + bootstrap + .group(group) + .channel(EpollDomainSocketChannel.class) + .handler(new ChannelInitializer() { + @Override + public void initChannel(UnixChannel ch) throws Exception { + ch + .pipeline() + // TODO encoder/decoder + .addLast(new ChannelInboundHandlerAdapter()) + .addLast(new ChannelOutboundHandlerAdapter()); + /* + .addLast(new SimpleUserEventChannelHandler() { + @Override + protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Exception { + + } + }); + */ + //.addLast(new CombinedChannelDuplexHandler(new ChannelInboundHandler(), new ChannelOutboundHandler())); + } + }); + channel = bootstrap.connect(new DomainSocketAddress(unixSocket)).sync().channel(); + + + //channel.writeAndFlush(request); + + //channel.closeFuture().sync(); + } + catch (Exception e) { + int a = 5; + } finally { + //epollEventLoopGroup.shutdownGracefully(); + } + // ====== + + var request = ConnectionRequest.newBuilder() + .addAddresses( + AddressInfo.newBuilder() + .setHost(connectionSettings.host) + .setPort(connectionSettings.port)) + .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)) + .setAuthenticationInfo( + AuthenticationInfo.newBuilder() + .setPassword("") + .setUsername("default")) + .setDatabaseId(0) + .build(); + + channel.writeAndFlush(request.toByteArray()); + channel.read(); + } + + @Override + public String getName() { + return "JNI Netty"; + } + + @Override + public void set(String key, String value) { + + } + + @Override + public String get(String key) { + return null; + } + + public static void main(String[] args) { + var client = new JniNettyClient(); + client.connectToRedis(); + } +} 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 2e70c4386b..1ab295c258 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -156,6 +156,7 @@ public static void testClientSetGet( "%n =====> %s <===== %d clients %d concurrent %d data %n%n", clientCreator.get().getName(), clientCount, concurrentNum, dataSize); AtomicInteger iterationCounter = new AtomicInteger(0); + // Collections.synchronizedList Map> actionResults = Map.of( ChosenAction.GET_EXISTING, new ArrayList<>(), diff --git a/java/benchmarks/src/main/java/javababushka/client/RedisClient.java b/java/benchmarks/src/main/java/javababushka/client/RedisClient.java index 4f267de6e5..423f1a9992 100644 --- a/java/benchmarks/src/main/java/javababushka/client/RedisClient.java +++ b/java/benchmarks/src/main/java/javababushka/client/RedisClient.java @@ -3,6 +3,8 @@ 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 { diff --git a/java/javababushka_client_RedisClient.h b/java/javababushka_client_RedisClient.h new file mode 100644 index 0000000000..a52938203d --- /dev/null +++ b/java/javababushka_client_RedisClient.h @@ -0,0 +1,37 @@ +/* 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 133890dcb6..60fcdb4bb7 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -1,10 +1,11 @@ use babushka::start_socket_listener; -use jni::objects::{JClass, JObject}; +use jni::objects::{JClass, JObject, JThrowable}; use jni::JNIEnv; use jni::sys::jlong; use std::sync::mpsc; - +use log::error; +use logger_core::Level; use redis::Value; fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<'local> { @@ -46,7 +47,7 @@ pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'lo } #[no_mangle] -pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal<'local>( +pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal__Ljavababushka_client_RedisClient_2<'local>( mut env: JNIEnv<'local>, _class: JClass<'local>, callback: JObject<'local> @@ -74,3 +75,53 @@ pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerE // Wait until the thread has started rx.recv().unwrap(); } + +#[no_mangle] +pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerExternal__<'local>( + mut env: JNIEnv<'local>, + _class: JClass<'local> +) -> JObject<'local> { + let (tx, rx) = mpsc::channel::>(); + + logger_core::init(Some(Level::Trace), None); + + start_socket_listener(move |socket_path : Result| { + // Signals that thread has started + let _ = tx.send(socket_path); + }); + + // Wait until the thread has started + let socket_path = rx.recv(); + + match socket_path { + Ok(Ok(path)) => { + env.new_string(path).unwrap().into() + }, + Ok(Err(error_message)) => { + throw_java_exception(env, error_message); + JObject::null() + }, + Err(error) => { + throw_java_exception(env, error.to_string()); + JObject::null() + } + } +} + +fn throw_java_exception(mut env: JNIEnv, message: String) { + let res = env.new_object( + "java/lang/Exception", + "(Ljava/lang/String;)V", + &[ + (&env.new_string(message.clone()).unwrap()).into(), + ]); + + match res { + Ok(res) => { + env.throw(JThrowable::from(res)); + }, + Err(err) => { + error!("Failed to create exception with string {}: {}", message, err.to_string()); + } + }; +} \ No newline at end of file From d145bdf0fdde9095ebafb119fdfe241b58b14f7c Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 31 Oct 2023 16:29:50 -0700 Subject: [PATCH 28/46] Iteration 2: connected! Signed-off-by: Yury-Fridlyand --- babushka-core/src/client/mod.rs | 2 + babushka-core/src/rotating_buffer.rs | 8 ++ .../clients/babushka/JniNettyClient.java | 73 +++++++++++++++++-- 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/babushka-core/src/client/mod.rs b/babushka-core/src/client/mod.rs index f9927b6c56..3aa16c4edd 100644 --- a/babushka-core/src/client/mod.rs +++ b/babushka-core/src/client/mod.rs @@ -264,6 +264,8 @@ impl Client { pub async fn new(request: ConnectionRequest) -> Result { const DEFAULT_CLIENT_CREATION_TIMEOUT: Duration = Duration::from_millis(2500); + log_info("Connection configuration", format!("received {} addresses", request.addresses.len())); + log_info( "Connection configuration", sanitized_request_string(&request), diff --git a/babushka-core/src/rotating_buffer.rs b/babushka-core/src/rotating_buffer.rs index 2a00642cec..6b31b21f54 100644 --- a/babushka-core/src/rotating_buffer.rs +++ b/babushka-core/src/rotating_buffer.rs @@ -28,11 +28,17 @@ impl RotatingBuffer { if (start_pos + request_len as usize) > buffer_len { break; } else { + log_error("parse input", format!("incoming: start {start_pos}, len {request_len}, buffer_len: {buffer_len}")); + let bytes = buffer.slice(start_pos..start_pos + request_len as usize); + log_error("parse input", format!("{:#x?}", bytes.as_ref())); + //let str_bytes = std::str::from_utf8(&bytes[..]); + //log_error("String bytes", str_bytes.unwrap().to_string()); match T::parse_from_tokio_bytes( &buffer.slice(start_pos..start_pos + request_len as usize), ) { Ok(request) => { prev_position += request_len as usize + bytes_read; + results.push(request); } Err(err) => { @@ -46,6 +52,8 @@ impl RotatingBuffer { } } + log_error("parse input", format!("results: {}", results.len())); + if prev_position != buffer.len() { self.backing_buffer .extend_from_slice(&buffer[prev_position..]); 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 cc18878999..dca31cba95 100755 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -8,6 +8,7 @@ import static connection_request.ConnectionRequestOuterClass.TlsMode; import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; @@ -16,6 +17,7 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOutboundHandler; import io.netty.channel.ChannelOutboundHandlerAdapter; +import io.netty.channel.ChannelPromise; import io.netty.channel.CombinedChannelDuplexHandler; import io.netty.channel.EventLoopGroup; import io.netty.channel.SimpleChannelInboundHandler; @@ -31,7 +33,11 @@ import io.netty.channel.unix.DomainSocketAddress; import javababushka.client.RedisClient; +import java.net.SocketAddress; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; public class JniNettyClient implements SyncClient { @@ -73,7 +79,34 @@ public void initChannel(UnixChannel ch) throws Exception { .pipeline() // TODO encoder/decoder .addLast(new ChannelInboundHandlerAdapter()) - .addLast(new ChannelOutboundHandlerAdapter()); + .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 arr = (byte[])msg; + //new ByteBuf().writeBytes(arr, 0, arr.length); + + super.write(ctx, Unpooled.copiedBuffer((byte[])msg), promise); + } + + @Override + public void flush(ChannelHandlerContext ctx) throws Exception { + System.out.printf("=== flush %s %n", ctx); + super.flush(ctx); + } + }); /* .addLast(new SimpleUserEventChannelHandler() { @Override @@ -103,7 +136,8 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep .addAddresses( AddressInfo.newBuilder() .setHost(connectionSettings.host) - .setPort(connectionSettings.port)) + .setPort(connectionSettings.port) + .build()) .setTlsMode(connectionSettings.useSsl // TODO: secure or insecure TLS? ? TlsMode.SecureTls : TlsMode.NoTls) @@ -117,16 +151,43 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep ConnectionRetryStrategy.newBuilder() .setNumberOfRetries(1) .setFactor(1) - .setExponentBase(1)) + .setExponentBase(1) + .build()) .setAuthenticationInfo( AuthenticationInfo.newBuilder() .setPassword("") - .setUsername("default")) + .setUsername("default") + .build()) .setDatabaseId(0) .build(); - channel.writeAndFlush(request.toByteArray()); - channel.read(); + var bytes = request.toByteArray(); + var varint = getVarInt(bytes.length); + + ByteBuffer buffer = ByteBuffer.allocate(bytes.length + varint.length); + buffer.clear(); + for (Byte b : varint) { + buffer.put(b); + } + buffer.put(bytes); + buffer.flip(); + + channel.writeAndFlush(buffer.array()); + //channel.read(); + } + + private static Byte[] getVarInt(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); } @Override From 0b03dc50cb42b529787a1536f96588c656d2512c Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 1 Nov 2023 11:47:06 -0700 Subject: [PATCH 29/46] Iteration 3: `get` and `set`. Signed-off-by: Yury-Fridlyand --- babushka-core/src/socket_listener.rs | 10 + java/benchmarks/build.gradle | 5 + .../benchmarks/clients/AsyncClient.java | 21 +- .../clients/babushka/JniNettyClient.java | 302 ++++++++++++++---- .../clients/jedis/JedisPseudoAsyncClient.java | 20 +- .../clients/lettuce/LettuceAsyncClient.java | 37 ++- java/src/lib.rs | 4 + 7 files changed, 302 insertions(+), 97 deletions(-) diff --git a/babushka-core/src/socket_listener.rs b/babushka-core/src/socket_listener.rs index c9be8fb7c8..c861c30eb0 100644 --- a/babushka-core/src/socket_listener.rs +++ b/babushka-core/src/socket_listener.rs @@ -134,6 +134,9 @@ async fn write_to_output(writer: &Rc) { if output.is_empty() { return; } + + log_warn("write_to_output", format!("output: {} {:?}", output.len(), output)); + let mut total_written_bytes = 0; while total_written_bytes < output.len() { if let Err(err) = writer.socket.writable().await { @@ -165,6 +168,8 @@ async fn write_closing_error( callback_index: u32, writer: &Rc, ) -> Result<(), io::Error> { + log_warn("write_closing_error", format!("err: {}, callback: {callback_index}", err.err_message)); + let err = err.err_message; log_error("client creation", err.as_str()); let mut response = Response::new(); @@ -179,6 +184,9 @@ async fn write_result( callback_index: u32, writer: &Rc, ) -> Result<(), io::Error> { + + log_warn("write_result", format!("resp_result: {resp_result:?}, callback: {callback_index}")); + let mut response = Response::new(); response.callback_idx = callback_index; response.value = match resp_result { @@ -241,6 +249,8 @@ async fn write_to_writer(response: Response, writer: &Rc) -> Result<(), let mut vec = writer.accumulated_outputs.take(); let encode_result = response.write_length_delimited_to_vec(&mut vec); + log_warn("write_to_writer", format!("Response: {response:?}")); + // Write the response' length to the buffer match encode_result { Ok(_) => { diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index 14bee3268d..0ae52dad19 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -22,9 +22,14 @@ dependencies { // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java 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 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' + + //testImplementation group: 'org.slf4j', name: 'slf4j-reload4j', version: '2.0.9' + //testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.9' compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' 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 f35a233cfa..0181cc052e 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java @@ -1,17 +1,30 @@ package javababushka.benchmarks.clients; +import javababushka.benchmarks.utils.ConnectionSettings; + import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; /** A Redis client with async capabilities */ -public interface AsyncClient extends Client { +public interface AsyncClient extends Client { long DEFAULT_TIMEOUT = 1000; - Future asyncSet(String key, String value); + Future asyncConnectToRedis(ConnectionSettings connectionSettings); + + Future asyncSet(String key, String value); Future asyncGet(String key); - T waitForResult(Future future); + default T waitForResult(Future future) { + return waitForResult(future, DEFAULT_TIMEOUT); + } - T waitForResult(Future future, long timeout); + default T waitForResult(Future future, long timeout) { + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (Exception ignored) { + return null; + } + } } 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 dca31cba95..8e1d6eadf0 100755 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -6,7 +6,16 @@ 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 response.ResponseOuterClass.ConstantResponse; +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.protobuf.InvalidProtocolBufferException; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -24,7 +33,22 @@ import io.netty.channel.SimpleUserEventChannelHandler; 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.LengthFieldBasedFrameDecoder; +import io.netty.handler.codec.LengthFieldPrepender; +import io.netty.handler.codec.protobuf.ProtobufDecoder; +import io.netty.handler.codec.protobuf.ProtobufEncoder; +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.InternalLogLevel; +import io.netty.util.internal.logging.InternalLoggerFactory; +import io.netty.util.internal.logging.Slf4JLoggerFactory; +import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.SyncClient; import javababushka.benchmarks.utils.ConnectionSettings; import io.netty.channel.nio.NioEventLoopGroup; @@ -32,18 +56,26 @@ import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.channel.unix.DomainSocketAddress; import javababushka.client.RedisClient; +import response.ResponseOuterClass; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +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; -public class JniNettyClient implements SyncClient { +public class JniNettyClient implements SyncClient, AsyncClient, AutoCloseable { - private final static String unixSocket = getSocket(); + // Futures to handle responses. Index is callback id, starting from 1 (0 index is for connection request always). + private final List> responses = Collections.synchronizedList(new ArrayList<>()); - private Channel channel = null; + private final static String unixSocket = getSocket(); // TODO static or move to constructor? private static String getSocket() { @@ -55,6 +87,23 @@ private static String getSocket() { } } + private Channel channel = null; + private EventLoopGroup group = null; + + 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 { + InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); + } + @Override public void connectToRedis() { connectToRedis(new ConnectionSettings("localhost", 6379, false)); @@ -63,22 +112,56 @@ public void connectToRedis() { @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? // ====== - Bootstrap bootstrap = new Bootstrap(); - EventLoopGroup group = new EpollEventLoopGroup(); //EventLoopGroup group = new NioEventLoopGroup(); try { - bootstrap - .group(group) - .channel(EpollDomainSocketChannel.class) + channel = new Bootstrap() + .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() - // TODO encoder/decoder - .addLast(new ChannelInboundHandlerAdapter()) + .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 { @@ -95,8 +178,6 @@ public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, Sock @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { System.out.printf("=== write %s %s %s %n", ctx, msg, promise); - //var arr = (byte[])msg; - //new ByteBuf().writeBytes(arr, 0, arr.length); super.write(ctx, Unpooled.copiedBuffer((byte[])msg), promise); } @@ -117,20 +198,115 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep */ //.addLast(new CombinedChannelDuplexHandler(new ChannelInboundHandler(), new ChannelOutboundHandler())); } - }); - channel = bootstrap.connect(new DomainSocketAddress(unixSocket)).sync().channel(); - + }) + .connect(new DomainSocketAddress(unixSocket)).sync().channel(); - //channel.writeAndFlush(request); - - //channel.closeFuture().sync(); } catch (Exception e) { - int a = 5; + System.err.printf("Failed to create a channel %s: %s%n", e.getClass().getSimpleName(), e.getMessage()); + e.printStackTrace(System.err); + } + } + + @Override + public void closeConnection() { + try { +// channel.closeFuture().sync(); +// } catch (InterruptedException ignored) { } finally { - //epollEventLoopGroup.shutdownGracefully(); + group.shutdownGracefully(); } - // ====== + } + + @Override + public String getName() { + return "JNI Netty"; + } + + @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); + + client.closeConnection(); + } + + @Override + public void close() throws Exception { + closeConnection(); + } + + @Override + public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { + createChannel(); var request = ConnectionRequest.newBuilder() .addAddresses( @@ -161,52 +337,54 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep .setDatabaseId(0) .build(); - var bytes = request.toByteArray(); - var varint = getVarInt(bytes.length); - - ByteBuffer buffer = ByteBuffer.allocate(bytes.length + varint.length); - buffer.clear(); - for (Byte b : varint) { - buffer.put(b); - } - buffer.put(bytes); - buffer.flip(); - - channel.writeAndFlush(buffer.array()); - //channel.read(); - } - - private static Byte[] getVarInt(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); - } - - @Override - public String getName() { - return "JNI Netty"; + var future = new CompletableFuture(); + responses.add(future); + channel.writeAndFlush(request.toByteArray()); + return future; } @Override - public void set(String key, String value) { - + public Future asyncSet(String key, String value) { + int callbackId = getNextCallbackId(); + System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); + RedisRequest request = + RedisRequest.newBuilder() + .setCallbackIdx(callbackId) + .setSingleCommand( + Command.newBuilder() + .setRequestType(RequestType.SetString) + .setArgsArray(ArgsArray.newBuilder().addArgs(key).addArgs(value).build()) + .build()) + .setRoute( + Routes.newBuilder() + .setSimpleRoutes(SimpleRoutes.AllNodes) + .build()) + .build(); + channel.writeAndFlush(request.toByteArray()); + return responses.get(callbackId); } @Override - public String get(String key) { - return null; - } - - public static void main(String[] args) { - var client = new JniNettyClient(); - client.connectToRedis(); + public Future asyncGet(String key) { + int callbackId = getNextCallbackId(); + System.out.printf("== get(%s), callback %d%n", key, callbackId); + RedisRequest request = + RedisRequest.newBuilder() + .setCallbackIdx(callbackId) + .setSingleCommand( + Command.newBuilder() + .setRequestType(RequestType.GetString) + .setArgsArray(ArgsArray.newBuilder().addArgs(key).build()) + .build()) + .setRoute( + Routes.newBuilder() + .setSimpleRoutes(SimpleRoutes.AllNodes) + .build()) + .build(); + channel.writeAndFlush(request.toByteArray()); + return responses.get(callbackId) + .thenApply(response -> response.hasRespPointer() + ? RedisClient.valueFromPointer(response.getRespPointer()).toString() + : null); } } 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 e441b28ad8..d3776663e1 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 @@ -4,6 +4,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import javababushka.benchmarks.clients.AsyncClient; +import javababushka.benchmarks.utils.ConnectionSettings; /** * A jedis client with pseudo-sync capabilities. Jedis doesn't provide async API @@ -12,6 +13,11 @@ *

See: https://github.com/redis/jedis */ public class JedisPseudoAsyncClient extends JedisClient implements AsyncClient { + @Override + public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { + return CompletableFuture.runAsync(() -> super.connectToRedis(connectionSettings)); + } + @Override public Future asyncSet(String key, String value) { return CompletableFuture.runAsync(() -> super.set(key, value)); @@ -22,20 +28,6 @@ public Future asyncGet(String key) { return CompletableFuture.supplyAsync(() -> super.get(key)); } - @Override - public T waitForResult(Future future) { - return waitForResult(future, DEFAULT_TIMEOUT); - } - - @Override - public T waitForResult(Future future, long timeout) { - try { - return future.get(timeout, TimeUnit.MILLISECONDS); - } catch (Exception ignored) { - return null; - } - } - @Override public String getName() { return "Jedis pseudo-async"; 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 fdde50d5f5..bf5bc08117 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 @@ -2,18 +2,21 @@ import io.lettuce.core.RedisClient; import io.lettuce.core.RedisFuture; +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 javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.utils.ConnectionSettings; /** A Lettuce client with async capabilities see: https://lettuce.io/ */ -public class LettuceAsyncClient implements AsyncClient { +public class LettuceAsyncClient implements AsyncClient { RedisClient client; - RedisAsyncCommands asyncCommands; + RedisAsyncCommands asyncCommands; StatefulRedisConnection connection; @Override @@ -35,27 +38,27 @@ public void connectToRedis(ConnectionSettings connectionSettings) { } @Override - public RedisFuture asyncSet(String key, String value) { - return asyncCommands.set(key, value); - } - - @Override - public RedisFuture asyncGet(String key) { - return asyncCommands.get(key); + 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))); + asyncConnection.whenComplete((connection, exception) -> asyncCommands = connection.async()); + return asyncConnection.thenApply((connection) -> "OK"); } @Override - public Object waitForResult(Future future) { - return waitForResult(future, DEFAULT_TIMEOUT); + public RedisFuture asyncSet(String key, String value) { + return asyncCommands.set(key, value); } @Override - public Object waitForResult(Future future, long timeoutMS) { - try { - return future.get(timeoutMS, TimeUnit.MILLISECONDS); - } catch (Exception ignored) { - return null; - } + public RedisFuture asyncGet(String key) { + return asyncCommands.get(key); } @Override diff --git a/java/src/lib.rs b/java/src/lib.rs index 60fcdb4bb7..cf0d728508 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -9,10 +9,12 @@ use logger_core::Level; use redis::Value; fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<'local> { + println!("==r value {:?}", val); match val { Value::Nil => JObject::null(), Value::Status(str) => JObject::from(env.new_string(str).unwrap()), Value::Okay => JObject::from(env.new_string("OK").unwrap()), + // TODO use primitive integer Value::Int(num) => env.new_object("java/lang/Integer", "(I)V", &[num.into()]).unwrap(), Value::Data(data) => match std::str::from_utf8(data.as_ref()) { Ok(val) => JObject::from(env.new_string(val).unwrap()), @@ -42,7 +44,9 @@ pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'lo _class: JClass<'local>, pointer: jlong ) -> JObject<'local> { + println!("==r pointer {:?}", pointer); let value = unsafe { Box::from_raw(pointer as *mut Value) }; + println!("==r value {:?}", value); redis_value_to_java(env, *value) } From a3075d5ae3eaff3796cd0049431a2aef299fdd4b Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 1 Nov 2023 12:22:30 -0700 Subject: [PATCH 30/46] Iteration 4: benchmark. Signed-off-by: Yury-Fridlyand --- babushka-core/src/client/mod.rs | 2 - babushka-core/src/rotating_buffer.rs | 8 --- babushka-core/src/socket_listener.rs | 12 ---- benchmarks/utilities/csv_exporter.py | 8 ++- java/benchmarks/build.gradle | 2 +- .../benchmarks/BenchmarkingApp.java | 12 +++- .../clients/babushka/JniNettyClient.java | 55 +++++++++++++++---- .../benchmarks/utils/Benchmarking.java | 4 +- java/src/lib.rs | 5 +- 9 files changed, 63 insertions(+), 45 deletions(-) mode change 100644 => 100755 benchmarks/utilities/csv_exporter.py diff --git a/babushka-core/src/client/mod.rs b/babushka-core/src/client/mod.rs index 3aa16c4edd..f9927b6c56 100644 --- a/babushka-core/src/client/mod.rs +++ b/babushka-core/src/client/mod.rs @@ -264,8 +264,6 @@ impl Client { pub async fn new(request: ConnectionRequest) -> Result { const DEFAULT_CLIENT_CREATION_TIMEOUT: Duration = Duration::from_millis(2500); - log_info("Connection configuration", format!("received {} addresses", request.addresses.len())); - log_info( "Connection configuration", sanitized_request_string(&request), diff --git a/babushka-core/src/rotating_buffer.rs b/babushka-core/src/rotating_buffer.rs index 6b31b21f54..2a00642cec 100644 --- a/babushka-core/src/rotating_buffer.rs +++ b/babushka-core/src/rotating_buffer.rs @@ -28,17 +28,11 @@ impl RotatingBuffer { if (start_pos + request_len as usize) > buffer_len { break; } else { - log_error("parse input", format!("incoming: start {start_pos}, len {request_len}, buffer_len: {buffer_len}")); - let bytes = buffer.slice(start_pos..start_pos + request_len as usize); - log_error("parse input", format!("{:#x?}", bytes.as_ref())); - //let str_bytes = std::str::from_utf8(&bytes[..]); - //log_error("String bytes", str_bytes.unwrap().to_string()); match T::parse_from_tokio_bytes( &buffer.slice(start_pos..start_pos + request_len as usize), ) { Ok(request) => { prev_position += request_len as usize + bytes_read; - results.push(request); } Err(err) => { @@ -52,8 +46,6 @@ impl RotatingBuffer { } } - log_error("parse input", format!("results: {}", results.len())); - if prev_position != buffer.len() { self.backing_buffer .extend_from_slice(&buffer[prev_position..]); diff --git a/babushka-core/src/socket_listener.rs b/babushka-core/src/socket_listener.rs index c861c30eb0..d2f319fce4 100644 --- a/babushka-core/src/socket_listener.rs +++ b/babushka-core/src/socket_listener.rs @@ -134,9 +134,6 @@ async fn write_to_output(writer: &Rc) { if output.is_empty() { return; } - - log_warn("write_to_output", format!("output: {} {:?}", output.len(), output)); - let mut total_written_bytes = 0; while total_written_bytes < output.len() { if let Err(err) = writer.socket.writable().await { @@ -168,8 +165,6 @@ async fn write_closing_error( callback_index: u32, writer: &Rc, ) -> Result<(), io::Error> { - log_warn("write_closing_error", format!("err: {}, callback: {callback_index}", err.err_message)); - let err = err.err_message; log_error("client creation", err.as_str()); let mut response = Response::new(); @@ -184,9 +179,6 @@ async fn write_result( callback_index: u32, writer: &Rc, ) -> Result<(), io::Error> { - - log_warn("write_result", format!("resp_result: {resp_result:?}, callback: {callback_index}")); - let mut response = Response::new(); response.callback_idx = callback_index; response.value = match resp_result { @@ -249,8 +241,6 @@ async fn write_to_writer(response: Response, writer: &Rc) -> Result<(), let mut vec = writer.accumulated_outputs.take(); let encode_result = response.write_length_delimited_to_vec(&mut vec); - log_warn("write_to_writer", format!("Response: {response:?}")); - // Write the response' length to the buffer match encode_result { Ok(_) => { @@ -535,8 +525,6 @@ async fn read_values_loop( return reason; } ReceivedValues(received_requests) => { - print!("Received {} requests: {:?}", received_requests.len(), received_requests); - log_error("parse input", format!("Received {} requests: {:?}", received_requests.len(), received_requests)); handle_requests(received_requests, client, &writer).await; } } diff --git a/benchmarks/utilities/csv_exporter.py b/benchmarks/utilities/csv_exporter.py old mode 100644 new mode 100755 index 3d48adfe17..af8d1b9259 --- a/benchmarks/utilities/csv_exporter.py +++ b/benchmarks/utilities/csv_exporter.py @@ -1,3 +1,5 @@ +#!/bin/python3 + import csv import json import os @@ -12,7 +14,7 @@ "is_cluster", "num_of_tasks", "data_size", - "clientCount", + "client_count", "tps", "get_non_existing_p50_latency", "get_non_existing_p90_latency", @@ -51,5 +53,5 @@ values = [json_object[field] for field in base_fields] writer.writerow(values) -for json_file_full_path in sys.argv[1:-1]: - os.remove(json_file_full_path) +# for json_file_full_path in sys.argv[1:-1]: +# os.remove(json_file_full_path) diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index 0ae52dad19..e719004762 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -45,7 +45,7 @@ java { application { // Define the main class for the application. mainClass = 'javababushka.benchmarks.BenchmarkingApp' - mainClass = 'javababushka.benchmarks.clients.babushka.JniNettyClient' + // mainClass = 'javababushka.benchmarks.clients.babushka.JniNettyClient' applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/debug" } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 9e19abd4e3..ad5bffe1a2 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -5,6 +5,8 @@ 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; @@ -64,6 +66,10 @@ public static void main(String[] args) { case BABUSHKA_JNI: testClientSetGet(JniSyncClient::new, runConfiguration, false); break; + case JNI_NETTY: + testClientSetGet(() -> new JniNettyClient(false), runConfiguration, false); + testClientSetGet(() -> new JniNettyClient(true), runConfiguration, true); + break; case BABUSHKA_ASYNC: System.out.println("Babushka async not yet configured"); break; @@ -195,6 +201,7 @@ private static int[] parseIntListOption(String line) throws ParseException { } public enum ClientName { + JNI_NETTY("JNI netty"), JEDIS("Jedis"), JEDIS_ASYNC("Jedis async"), LETTUCE("Lettuce"), @@ -236,13 +243,14 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; - resultsFile = Optional.empty(); + resultsFile = Optional.of("res_java.json");//Optional.empty(); dataSize = new int[] {100, 4000}; concurrentTasks = new int[] {100, 1000}; clients = new ClientName[] { // ClientName.BABUSHKA_ASYNC, - ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + //ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + ClientName.JNI_NETTY }; host = "localhost"; port = 6379; 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 8e1d6eadf0..600d674580 100755 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -104,6 +104,19 @@ private static boolean isMacOs() { InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); } + public JniNettyClient(boolean async) { + name += async ? " async" : " sync"; + } + + public JniNettyClient() {} + + private String name = "JNI Netty"; + + @Override + public String getName() { + return name; + } + @Override public void connectToRedis() { connectToRedis(new ConnectionSettings("localhost", 6379, false)); @@ -150,7 +163,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception 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()); + //System.out.printf("== Received response with callback %d%n", response.getCallbackIdx()); responses.get(response.getCallbackIdx()).complete(response); super.channelRead(ctx, bytes); } @@ -165,26 +178,26 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E .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); + //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); + //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); + //System.out.printf("=== write %s %s %s %n", ctx, msg, promise); super.write(ctx, Unpooled.copiedBuffer((byte[])msg), promise); } @Override public void flush(ChannelHandlerContext ctx) throws Exception { - System.out.printf("=== flush %s %n", ctx); + //System.out.printf("=== flush %s %n", ctx); super.flush(ctx); } }); @@ -218,11 +231,6 @@ public void closeConnection() { } } - @Override - public String getName() { - return "JNI Netty"; - } - @Override public void set(String key, String value) { waitForResult(asyncSet(key, value)); @@ -296,6 +304,29 @@ public static void main(String[] args) { 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(); } @@ -346,7 +377,7 @@ public Future asyncConnectToRedis(ConnectionSettings connectionSetting @Override public Future asyncSet(String key, String value) { int callbackId = getNextCallbackId(); - System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); + //System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); RedisRequest request = RedisRequest.newBuilder() .setCallbackIdx(callbackId) @@ -367,7 +398,7 @@ public Future asyncSet(String key, String value) { @Override public Future asyncGet(String key) { int callbackId = getNextCallbackId(); - System.out.printf("== get(%s), callback %d%n", key, callbackId); + //System.out.printf("== get(%s), callback %d%n", key, callbackId); RedisRequest request = RedisRequest.newBuilder() .setCallbackIdx(callbackId) 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 1ab295c258..c385dc333b 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -148,7 +148,7 @@ public static void printResults( public static void testClientSetGet( Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { - int iterations = + int iterations = 1000; Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { @@ -249,6 +249,8 @@ public static void testClientSetGet( }); long after = System.nanoTime(); + clients.forEach(Client::closeConnection); + var calculatedResults = calculateResults(actionResults); if (config.resultsFile.isPresent()) { JsonWriter.Write( diff --git a/java/src/lib.rs b/java/src/lib.rs index cf0d728508..020ace59eb 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -9,7 +9,6 @@ use logger_core::Level; use redis::Value; fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<'local> { - println!("==r value {:?}", val); match val { Value::Nil => JObject::null(), Value::Status(str) => JObject::from(env.new_string(str).unwrap()), @@ -44,9 +43,7 @@ pub extern "system" fn Java_javababushka_client_RedisClient_valueFromPointer<'lo _class: JClass<'local>, pointer: jlong ) -> JObject<'local> { - println!("==r pointer {:?}", pointer); let value = unsafe { Box::from_raw(pointer as *mut Value) }; - println!("==r value {:?}", value); redis_value_to_java(env, *value) } @@ -87,7 +84,7 @@ pub extern "system" fn Java_javababushka_client_RedisClient_startSocketListenerE ) -> JObject<'local> { let (tx, rx) = mpsc::channel::>(); - logger_core::init(Some(Level::Trace), None); + //logger_core::init(Some(Level::Trace), None); start_socket_listener(move |socket_path : Result| { // Signals that thread has started From 5f10964407bda17bd02bfd46c1e53e9167c11048 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 1 Nov 2023 18:47:13 -0700 Subject: [PATCH 31/46] Iteration 5: some fixes. Signed-off-by: Yury-Fridlyand --- .../benchmarks/BenchmarkingApp.java | 4 +- .../clients/babushka/JniNettyClient.java | 115 +++++++++++++----- .../benchmarks/utils/Benchmarking.java | 5 +- 3 files changed, 92 insertions(+), 32 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index ad5bffe1a2..ff4573693b 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -245,12 +245,12 @@ public RunConfiguration() { configuration = "Release"; resultsFile = Optional.of("res_java.json");//Optional.empty(); dataSize = new int[] {100, 4000}; - concurrentTasks = new int[] {100, 1000}; + concurrentTasks = new int[] {100}; clients = new ClientName[] { // ClientName.BABUSHKA_ASYNC, //ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC - ClientName.JNI_NETTY + ClientName.JNI_NETTY, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC }; host = "localhost"; port = 6379; 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 600d674580..5c9e9023fc 100755 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -18,12 +18,14 @@ import com.google.protobuf.InvalidProtocolBufferException; 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.ChannelInboundHandler; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOutboundHandler; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPromise; @@ -31,6 +33,7 @@ import io.netty.channel.EventLoopGroup; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleUserEventChannelHandler; +import io.netty.channel.WriteBufferWaterMark; import io.netty.channel.epoll.EpollDomainSocketChannel; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.kqueue.KQueue; @@ -69,13 +72,23 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; public class JniNettyClient implements SyncClient, AsyncClient, AutoCloseable { + // https://netty.io/3.6/api/org/jboss/netty/handler/queue/BufferedWriteHandler.html + private final static int AUTO_FLUSH_THRESHOLD = 512;//1024; + private final AtomicInteger nonFlushedCounter = new AtomicInteger(0); + + private final static int AUTO_FLUSH_TIMEOUT_MILLIS = 100; + + private final 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 static String unixSocket = getSocket(); + private final String unixSocket = getSocket(); // TODO static or move to constructor? private static String getSocket() { @@ -83,13 +96,15 @@ private static String getSocket() { return RedisClient.startSocketListenerExternal(); } catch (Exception | UnsatisfiedLinkError e) { System.err.printf("Failed to get UDS from babushka and dedushka: %s%n%n", e); - return null; + 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 { @@ -101,6 +116,7 @@ private static boolean isMacOs() { } static { + // TODO fix: netty still doesn't use slf4j nor log4j InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); } @@ -128,7 +144,7 @@ public void connectToRedis(ConnectionSettings connectionSettings) { Response connected = null; try { connected = waitForResult(asyncConnectToRedis(connectionSettings)); - System.out.printf("Connection %s%n", connected != null ? connected.getConstantResponse() : null); + //System.out.printf("Connection %s%n", connected != null ? connected.getConstantResponse() : null); } catch (Exception e) { System.err.println("Connection time out"); } @@ -139,9 +155,11 @@ public void connectToRedis(ConnectionSettings connectionSettings) { private void createChannel() { // TODO maybe move to constructor or to static? // ====== - //EventLoopGroup group = new NioEventLoopGroup(); try { channel = new Bootstrap() + .option(ChannelOption.WRITE_BUFFER_WATER_MARK, + new WriteBufferWaterMark(1024 * 1024 * 2 + 10, 1024 * 1024 * 10)) + .option(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT) .group(group = isMacOs ? new KQueueEventLoopGroup() : new EpollEventLoopGroup()) .channel(isMacOs ? KQueueDomainSocketChannel.class : EpollDomainSocketChannel.class) .handler(new ChannelInitializer() { @@ -191,8 +209,21 @@ public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, Sock @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { //System.out.printf("=== write %s %s %s %n", ctx, msg, promise); - - super.write(ctx, Unpooled.copiedBuffer((byte[])msg), promise); + var bytes = (byte[])msg; + + boolean needFlush = false; + synchronized (nonFlushedCounter) { + if (nonFlushedCounter.addAndGet(bytes.length) >= AUTO_FLUSH_THRESHOLD) { + nonFlushedCounter.set(0); + needFlush = true; + } + } + if (needFlush) { + // flush outside the sync block + flush(ctx); + //System.out.println("-- auto flush - buffer"); + } + super.write(ctx, Unpooled.copiedBuffer(bytes), promise); } @Override @@ -224,6 +255,24 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep @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 { @@ -374,46 +423,54 @@ public Future asyncConnectToRedis(ConnectionSettings connectionSetting return future; } - @Override - public Future asyncSet(String key, String value) { + private CompletableFuture submitNewCommand(RequestType command, List args) { int callbackId = getNextCallbackId(); - //System.out.printf("== set(%s, %s), callback %d%n", key, value, callbackId); + //System.out.printf("== %s(%s), callback %d%n", command, String.join(", ", args), callbackId); RedisRequest request = RedisRequest.newBuilder() .setCallbackIdx(callbackId) .setSingleCommand( Command.newBuilder() - .setRequestType(RequestType.SetString) - .setArgsArray(ArgsArray.newBuilder().addArgs(key).addArgs(value).build()) + .setRequestType(command) + .setArgsArray(ArgsArray.newBuilder().addAllArgs(args).build()) .build()) .setRoute( Routes.newBuilder() .setSimpleRoutes(SimpleRoutes.AllNodes) .build()) .build(); - channel.writeAndFlush(request.toByteArray()); - return responses.get(callbackId); + channel.write(request.toByteArray()); + return autoFlushFutureWrapper(responses.get(callbackId)); + } + + private CompletableFuture autoFlushFutureWrapper(Future future) { + return CompletableFuture.supplyAsync(() -> { + try { + return future.get(AUTO_FLUSH_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } catch (TimeoutException e) { + //System.out.println("-- auto flush - timeout"); + channel.flush(); + } + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + } + + @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)); } @Override public Future asyncGet(String key) { - int callbackId = getNextCallbackId(); //System.out.printf("== get(%s), callback %d%n", key, callbackId); - RedisRequest request = - RedisRequest.newBuilder() - .setCallbackIdx(callbackId) - .setSingleCommand( - Command.newBuilder() - .setRequestType(RequestType.GetString) - .setArgsArray(ArgsArray.newBuilder().addArgs(key).build()) - .build()) - .setRoute( - Routes.newBuilder() - .setSimpleRoutes(SimpleRoutes.AllNodes) - .build()) - .build(); - channel.writeAndFlush(request.toByteArray()); - return responses.get(callbackId) + return submitNewCommand(RequestType.GetString, List.of(key)) .thenApply(response -> response.hasRespPointer() ? RedisClient.valueFromPointer(response.getRespPointer()).toString() : null); 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 c385dc333b..95d3a8ffac 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -148,7 +148,7 @@ public static void printResults( public static void testClientSetGet( Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { - int iterations = 1000; + int iterations = 100000; Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { @@ -263,6 +263,9 @@ public static void testClientSetGet( iterations / ((after - before) / TPS_NORMALIZATION)); } printResults(calculatedResults, (after - before) / TPS_NORMALIZATION, iterations); + try { + Thread.sleep(2000); + } catch (InterruptedException ignored) {} } } } From e3f7596a0ddc80834c93d6556467b20c26aab088 Mon Sep 17 00:00:00 2001 From: Jonathan Louie Date: Thu, 2 Nov 2023 11:37:27 -0700 Subject: [PATCH 32/46] Change number of threads in Benchmarking threadpool --- .../main/java/javababushka/benchmarks/utils/Benchmarking.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..8b4245ab62 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -220,7 +220,7 @@ public static void testClientSetGet( concurrentNum, clientCount, tasks.size()); } long before = System.nanoTime(); - ExecutorService threadPool = Executors.newFixedThreadPool(concurrentNum); + ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); // create threads and add them to the async pool. // This will start execution of all the concurrent tasks. From 49c91190d63693651a5bb06ef7a39685581039ea Mon Sep 17 00:00:00 2001 From: Jonathan Louie Date: Thu, 2 Nov 2023 11:51:32 -0700 Subject: [PATCH 33/46] Revert "Change number of threads in Benchmarking threadpool" This reverts commit e3f7596a0ddc80834c93d6556467b20c26aab088. --- .../main/java/javababushka/benchmarks/utils/Benchmarking.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8b4245ab62..95d3a8ffac 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -220,7 +220,7 @@ public static void testClientSetGet( concurrentNum, clientCount, tasks.size()); } long before = System.nanoTime(); - ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + ExecutorService threadPool = Executors.newFixedThreadPool(concurrentNum); // create threads and add them to the async pool. // This will start execution of all the concurrent tasks. From dd7413b1e136bdd44920e51ec910afc6820299d8 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 2 Nov 2023 22:40:52 -0700 Subject: [PATCH 34/46] Add more flushing rules and UT. Signed-off-by: Yury-Fridlyand --- java/benchmarks/build.gradle | 18 +- .../benchmarks/BenchmarkingApp.java | 6 +- .../clients/babushka/JniNettyClient.java | 75 +++++--- .../benchmarks/JniNettyTests.java | 180 ++++++++++++++++++ java/src/lib.rs | 4 +- 5 files changed, 243 insertions(+), 40 deletions(-) mode change 100755 => 100644 java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java create mode 100644 java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index e719004762..90c633d9f1 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -1,6 +1,7 @@ plugins { // Apply the application plugin to add support for building a CLI application in Java. id 'application' + id 'io.freefair.lombok' } repositories { @@ -25,14 +26,18 @@ dependencies { 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' compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' + testCompileOnly 'org.projectlombok:lombok:1.18.30' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.30' } // Apply a specific Java toolchain to ease working on different environments. @@ -45,14 +50,15 @@ java { application { // Define the main class for the application. mainClass = 'javababushka.benchmarks.BenchmarkingApp' - // mainClass = 'javababushka.benchmarks.clients.babushka.JniNettyClient' + mainClass = 'javababushka.benchmarks.clients.babushka.JniNettyClient' applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/debug" } tasks.withType(Test) { - testLogging { - exceptionFormat "full" - events "started", "skipped", "passed", "failed" - showStandardStreams true - } + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams true + } + jvmArgs "-Djava.library.path=${projectDir}/../target/debug" } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index ff4573693b..b3d269cf35 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -244,17 +244,17 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; resultsFile = Optional.of("res_java.json");//Optional.empty(); - dataSize = new int[] {100, 4000}; + 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.JNI_NETTY//, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC }; host = "localhost"; port = 6379; - clientCount = new int[] {1, 2}; + clientCount = new int[] {2}; tls = false; } } 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 old mode 100755 new mode 100644 index 5c9e9023fc..eef968e343 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/babushka/JniNettyClient.java @@ -7,7 +7,6 @@ import static connection_request.ConnectionRequestOuterClass.AuthenticationInfo; import static connection_request.ConnectionRequestOuterClass.TlsMode; import static response.ResponseOuterClass.Response; -import static response.ResponseOuterClass.ConstantResponse; import static redis_request.RedisRequestOuterClass.Command.ArgsArray; import static redis_request.RedisRequestOuterClass.Command; import static redis_request.RedisRequestOuterClass.RequestType; @@ -15,24 +14,19 @@ import static redis_request.RedisRequestOuterClass.SimpleRoutes; import static redis_request.RedisRequestOuterClass.Routes; -import com.google.protobuf.InvalidProtocolBufferException; +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.ChannelInboundHandler; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; -import io.netty.channel.ChannelOutboundHandler; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPromise; -import io.netty.channel.CombinedChannelDuplexHandler; import io.netty.channel.EventLoopGroup; -import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.channel.SimpleUserEventChannelHandler; import io.netty.channel.WriteBufferWaterMark; import io.netty.channel.epoll.EpollDomainSocketChannel; import io.netty.channel.epoll.EpollEventLoopGroup; @@ -40,33 +34,24 @@ import io.netty.channel.kqueue.KQueueDomainSocketChannel; import io.netty.channel.kqueue.KQueueEventLoopGroup; import io.netty.channel.unix.UnixChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; -import io.netty.handler.codec.LengthFieldPrepender; -import io.netty.handler.codec.protobuf.ProtobufDecoder; -import io.netty.handler.codec.protobuf.ProtobufEncoder; 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.InternalLogLevel; import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.Slf4JLoggerFactory; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.SyncClient; import javababushka.benchmarks.utils.ConnectionSettings; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.channel.unix.DomainSocketAddress; import javababushka.client.RedisClient; -import response.ResponseOuterClass; import java.net.SocketAddress; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; 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; @@ -74,15 +59,26 @@ 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 - private final static int AUTO_FLUSH_THRESHOLD = 512;//1024; - private final AtomicInteger nonFlushedCounter = new AtomicInteger(0); + // 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); - private final static int AUTO_FLUSH_TIMEOUT_MILLIS = 100; + // 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; - private final static int PENDING_RESPONSES_ON_CLOSE_TIMEOUT_MILLIS = 1000; + 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 @@ -158,7 +154,7 @@ private void createChannel() { try { channel = new Bootstrap() .option(ChannelOption.WRITE_BUFFER_WATER_MARK, - new WriteBufferWaterMark(1024 * 1024 * 2 + 10, 1024 * 1024 * 10)) + new WriteBufferWaterMark(1024, 4096)) .option(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT) .group(group = isMacOs ? new KQueueEventLoopGroup() : new EpollEventLoopGroup()) .channel(isMacOs ? KQueueDomainSocketChannel.class : EpollDomainSocketChannel.class) @@ -212,18 +208,22 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) var bytes = (byte[])msg; boolean needFlush = false; - synchronized (nonFlushedCounter) { - if (nonFlushedCounter.addAndGet(bytes.length) >= AUTO_FLUSH_THRESHOLD) { - nonFlushedCounter.set(0); - needFlush = true; + 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"); } - super.write(ctx, Unpooled.copiedBuffer(bytes), promise); } @Override @@ -250,6 +250,17 @@ protected void eventReceived(ChannelHandlerContext ctx, String evt) throws Excep 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 @@ -439,6 +450,10 @@ private CompletableFuture submitNewCommand(RequestType command, List submitNewCommand(RequestType command, List CompletableFuture autoFlushFutureWrapper(Future future) { return CompletableFuture.supplyAsync(() -> { try { - return future.get(AUTO_FLUSH_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); + 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(); diff --git a/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java b/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java new file mode 100644 index 0000000000..692790b8ec --- /dev/null +++ b/java/benchmarks/src/test/java/javababushka/benchmarks/JniNettyTests.java @@ -0,0 +1,180 @@ +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/src/lib.rs b/java/src/lib.rs index 020ace59eb..f752d9596a 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -8,7 +8,7 @@ use log::error; use logger_core::Level; use redis::Value; -fn redis_value_to_java<'local>(mut env: JNIEnv<'local>, val: Value) -> JObject<'local> { +fn redis_value_to_java(mut env: JNIEnv, val: Value) -> JObject { match val { Value::Nil => JObject::null(), Value::Status(str) => JObject::from(env.new_string(str).unwrap()), @@ -119,7 +119,7 @@ fn throw_java_exception(mut env: JNIEnv, message: String) { match res { Ok(res) => { - env.throw(JThrowable::from(res)); + let _ = env.throw(JThrowable::from(res)); }, Err(err) => { error!("Failed to create exception with string {}: {}", message, err.to_string()); From a70c90776892d9063a595e4cdacb64e4c66098d7 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Wed, 15 Nov 2023 17:48:09 -0800 Subject: [PATCH 35/46] 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> { From fbea0074001de713cc2621de71abc17238894780 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 12:19:08 -0800 Subject: [PATCH 36/46] Client optimizations. (#37) * Client optimizations. Signed-off-by: Yury-Fridlyand * minor cleanup. Signed-off-by: Yury-Fridlyand * Optimize building a command. Signed-off-by: Yury-Fridlyand * Typo fix. Signed-off-by: Yury-Fridlyand * Minor rename. Signed-off-by: Yury-Fridlyand * Clean up Redis close connection Signed-off-by: Andrew Carbonetto * Clean up Redis close connection Signed-off-by: Andrew Carbonetto * Minor changes. Signed-off-by: Yury-Fridlyand * Add todos to closeConnection() Signed-off-by: Andrew Carbonetto --------- Signed-off-by: Yury-Fridlyand Signed-off-by: Andrew Carbonetto Co-authored-by: Andrew Carbonetto --- java/benchmarks/build.gradle | 6 ++-- .../clients/babushka/JniNettyClient.java | 2 +- .../benchmarks/utils/Benchmarking.java | 19 +++++++----- java/client/build.gradle | 20 ++++++++++--- .../src/main/java/javababushka/Client.java | 30 +++++++++++++------ 5 files changed, 52 insertions(+), 25 deletions(-) diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index 3f1f0f0608..1a481388d0 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -45,14 +45,14 @@ java { application { // Define the main class for the application. mainClass = 'javababushka.benchmarks.BenchmarkingApp' - applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/release" + applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/release:${projectDir}/../target/debug" } -tasks.withType(Test) { +tasks.withType(Test) { testLogging { exceptionFormat "full" events "started", "skipped", "passed", "failed" showStandardStreams true } - jvmArgs "-Djava.library.path=${projectDir}/../target/debug" + jvmArgs "-Djava.library.path=${projectDir}/../target/release:${projectDir}/../target/debug" } 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 0a98478fef..e9d192e9e2 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 @@ -35,7 +35,7 @@ public void connectToRedis() { @Override public void connectToRedis(ConnectionSettings connectionSettings) { -waitForResult(asyncConnectToRedis(connectionSettings)); + waitForResult(asyncConnectToRedis(connectionSettings)); } @Override 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 b94b9544fa..ee14f7836c 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -148,15 +148,12 @@ public static void printResults( 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); + int iterations = + Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { - System.out.printf( - "%n =====> %s <===== %d clients %d concurrent %d data %n%n", - clientCreator.get().getName(), clientCount, concurrentNum, dataSize); AtomicInteger iterationCounter = new AtomicInteger(0); - // Collections.synchronizedList + Map> actionResults = Map.of( ChosenAction.GET_EXISTING, new ArrayList<>(), @@ -172,6 +169,12 @@ public static void testClientSetGet( clients.add(newClient); } + String clientName = clients.get(0).getName(); + + System.out.printf( + "%n =====> %s <===== %d clients %d concurrent %d data %n%n", + clientName, clientCount, concurrentNum, dataSize); + for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { final int taskNumDebugging = taskNum; tasks.add( @@ -214,7 +217,7 @@ public static void testClientSetGet( }); } if (config.debugLogging) { - System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); + System.out.printf("%s client Benchmarking: %n", clientName); System.out.printf( "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", concurrentNum, clientCount, tasks.size()); @@ -257,7 +260,7 @@ public static void testClientSetGet( calculatedResults, config.resultsFile.get(), dataSize, - clientCreator.get().getName(), + clientName, clientCount, concurrentNum, iterations / ((after - before) / TPS_NORMALIZATION)); diff --git a/java/client/build.gradle b/java/client/build.gradle index b4a061ad13..8dd4e5b7c5 100644 --- a/java/client/build.gradle +++ b/java/client/build.gradle @@ -22,17 +22,23 @@ dependencies { tasks.register('protobuf', Exec) { doFirst { - project.mkdir(Paths.get(project.projectDir.path, 'src/main/java/org/babushka/javababushka/generated').toString()) + project.mkdir(Paths.get(project.projectDir.path, 'src/main/java/javababushka/generated').toString()) } commandLine 'protoc', '-Iprotobuf=babushka-core/src/protobuf/', - '--java_out=java/client/src/main/java/org/babushka/javababushka/generated', + '--java_out=java/client/src/main/java/javababushka/generated', '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() } +tasks.register('cleanProtobuf') { + doFirst { + project.delete(Paths.get(project.projectDir.path, 'src/main/java/javababushka/generated').toString()) + } +} + tasks.register('buildRust', Exec) { commandLine 'cargo', 'build', '--release' workingDir project.rootDir @@ -54,7 +60,13 @@ tasks.register('buildAll') { } compileJava.dependsOn('protobuf') +clean.dependsOn('cleanProtobuf') -test { - systemProperty("java.library.path", "${projectDir}/../target/release") +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams true + } + jvmArgs "-Djava.library.path=${projectDir}/../target/release:${projectDir}/../target/debug" } diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java index 6cd4415d14..73bc8f613d 100644 --- a/java/client/src/main/java/javababushka/Client.java +++ b/java/client/src/main/java/javababushka/Client.java @@ -227,28 +227,40 @@ public void run() { } public void closeConnection() { - try { - channel.flush(); + // flush and close the channel + channel.flush(); + channel.close(); + // TODO: check that the channel is closed + + // shutdown the event loop group gracefully by waiting for the remaining response + // and then shutting down the connection + try { 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()) { + for (var responseFuture : responses) { + if (responseFuture == null || responseFuture.isDone()) { continue; } try { - future.get(waitUntil - System.nanoTime(), TimeUnit.NANOSECONDS); + responseFuture.get(waitUntil - System.nanoTime(), TimeUnit.NANOSECONDS); } catch (InterruptedException | ExecutionException ignored) { + // TODO: print warning } catch (TimeoutException e) { - future.cancel(true); - // TODO cancel the rest + responseFuture.cancel(true); + // TODO: cancel the rest break; } } } finally { - // channel.closeFuture().sync() - group.shutdownGracefully(); + var shuttingDown = group.shutdownGracefully(); + try { + shuttingDown.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + assert group.isShutdown() : "Redis connection did not shutdown gracefully"; } } From 2f8f93a01d30185f7b6b6e499882acd935c332f8 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 15:41:01 -0800 Subject: [PATCH 37/46] Address PR feedback. Signed-off-by: Yury-Fridlyand --- benchmarks/utilities/csv_exporter.py | 4 ++-- .../javababushka/benchmarks/BenchmarkingApp.java | 8 ++++---- .../benchmarks/clients/AsyncClient.java | 4 ++-- .../clients/babushka/JniNettyClient.java | 4 ++-- .../clients/lettuce/LettuceAsyncClient.java | 2 +- .../lettuce/LettuceAsyncClusterClient.java | 2 +- .../clients/lettuce/LettuceClient.java | 2 +- .../benchmarks/utils/Benchmarking.java | 2 +- .../benchmarks/utils/ConnectionSettings.java | 16 +++++++--------- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/benchmarks/utilities/csv_exporter.py b/benchmarks/utilities/csv_exporter.py index af8d1b9259..753df2e5ab 100755 --- a/benchmarks/utilities/csv_exporter.py +++ b/benchmarks/utilities/csv_exporter.py @@ -53,5 +53,5 @@ values = [json_object[field] for field in base_fields] writer.writerow(values) -# for json_file_full_path in sys.argv[1:-1]: -# os.remove(json_file_full_path) +for json_file_full_path in sys.argv[1:-1]: + os.remove(json_file_full_path) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index 1205722867..d8efc8da78 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -253,9 +253,9 @@ public static class RunConfiguration { public RunConfiguration() { configuration = "Release"; - resultsFile = Optional.of("res_java.json"); // Optional.empty(); - dataSize = new int[] {100}; - concurrentTasks = new int[] {100}; + resultsFile = Optional.empty(); + dataSize = new int[] {100, 4000}; + concurrentTasks = new int[] {100, 1000}; clients = new ClientName[] { // ClientName.BABUSHKA_ASYNC, @@ -266,7 +266,7 @@ public RunConfiguration() { }; host = "localhost"; port = 6379; - clientCount = new int[] {2}; + clientCount = new int[] {1, 2}; tls = false; clusterModeEnabled = false; } 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 5255f63287..deae2ceee5 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/AsyncClient.java @@ -7,7 +7,7 @@ /** A Redis client with async capabilities */ public interface AsyncClient extends Client { - long DEFAULT_TIMEOUT = 1000; + long DEFAULT_TIMEOUT_MILLISECOND = 1000; Future asyncConnectToRedis(ConnectionSettings connectionSettings); @@ -16,7 +16,7 @@ public interface AsyncClient extends Client { Future asyncGet(String key); default T waitForResult(Future future) { - return waitForResult(future, DEFAULT_TIMEOUT); + return waitForResult(future, DEFAULT_TIMEOUT_MILLISECOND); } default T waitForResult(Future future, long timeout) { 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 e9d192e9e2..1e2bb05201 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 @@ -30,7 +30,7 @@ public void closeConnection() { @Override public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); + connectToRedis(new ConnectionSettings("localhost", 6379, false, false)); } @Override @@ -41,7 +41,7 @@ public void connectToRedis(ConnectionSettings connectionSettings) { @Override public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { return testClient.asyncConnectToRedis( - connectionSettings.host, connectionSettings.port, connectionSettings.useSsl, false); + connectionSettings.host, connectionSettings.port, connectionSettings.useSsl, connectionSettings.clusterMode); } @Override 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 f3a82640c0..ded154b3c5 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 @@ -19,7 +19,7 @@ public class LettuceAsyncClient implements AsyncClient { @Override public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); + connectToRedis(new ConnectionSettings("localhost", 6379, false, false)); } @Override diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java index fc9d98707c..7f70b1781c 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java @@ -18,7 +18,7 @@ public class LettuceAsyncClusterClient extends LettuceAsyncClient { @Override public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); + connectToRedis(new ConnectionSettings("localhost", 6379, false, false)); } @Override diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java index 5e4b1a633c..87d7bc9d2e 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceClient.java @@ -15,7 +15,7 @@ public class LettuceClient implements SyncClient { @Override public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false)); + connectToRedis(new ConnectionSettings("localhost", 6379, false, false)); } @Override 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 7d43cbd478..440f93d2ca 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -170,7 +170,7 @@ public static void testClientSetGet( List clients = new LinkedList<>(); for (int cc = 0; cc < clientCount; cc++) { Client newClient = clientCreator.get(); - newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls)); + newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls, config.clusterModeEnabled)); clients.add(newClient); } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java index 1866908835..91c11c76a8 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ConnectionSettings.java @@ -1,14 +1,12 @@ package javababushka.benchmarks.utils; +import lombok.AllArgsConstructor; + /** Redis-client settings */ +@AllArgsConstructor public class ConnectionSettings { - public String host; - public int port; - public boolean useSsl; - - public ConnectionSettings(String host, int port, boolean useSsl) { - this.host = host; - this.port = port; - this.useSsl = useSsl; - } + public final String host; + public final int port; + public final boolean useSsl; + public final boolean clusterMode; } From f0f0e790e5c06d1f1d7f5c508fe464571bb3c989 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 19:04:39 -0800 Subject: [PATCH 38/46] Rename Signed-off-by: Yury-Fridlyand --- .../{RustWrapper.java => BabushkaCoreNativeDefinitions.java} | 2 +- java/client/src/main/java/javababushka/Client.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename java/client/src/main/java/javababushka/{RustWrapper.java => BabushkaCoreNativeDefinitions.java} (83%) diff --git a/java/client/src/main/java/javababushka/RustWrapper.java b/java/client/src/main/java/javababushka/BabushkaCoreNativeDefinitions.java similarity index 83% rename from java/client/src/main/java/javababushka/RustWrapper.java rename to java/client/src/main/java/javababushka/BabushkaCoreNativeDefinitions.java index 315a3c63a2..3f26ebef91 100644 --- a/java/client/src/main/java/javababushka/RustWrapper.java +++ b/java/client/src/main/java/javababushka/BabushkaCoreNativeDefinitions.java @@ -1,6 +1,6 @@ package javababushka; -public class RustWrapper { +public class BabushkaCoreNativeDefinitions { public static native String startSocketListenerExternal() throws Exception; public static native Object valueFromPointer(long pointer); diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java index 73bc8f613d..b42db3ae65 100644 --- a/java/client/src/main/java/javababushka/Client.java +++ b/java/client/src/main/java/javababushka/Client.java @@ -88,7 +88,7 @@ public class Client implements AutoCloseable { private static String getSocket() { try { - return RustWrapper.startSocketListenerExternal(); + return BabushkaCoreNativeDefinitions.startSocketListenerExternal(); } catch (Exception | UnsatisfiedLinkError e) { System.err.printf("Failed to get UDS from babushka and dedushka: %s%n%n", e); throw new RuntimeException(e); @@ -382,7 +382,7 @@ public Future asyncGet(String key) { .thenApply( response -> response.getRespPointer() != 0 - ? RustWrapper.valueFromPointer(response.getRespPointer()).toString() + ? BabushkaCoreNativeDefinitions.valueFromPointer(response.getRespPointer()).toString() : null); } From 06ca6b4e1598e980e8f2ab2fbac5356e4a83fd7e Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 19:08:49 -0800 Subject: [PATCH 39/46] Rename2 Signed-off-by: Yury-Fridlyand --- .../clients/babushka/JniNettyClient.java | 5 +- .../benchmarks/utils/Benchmarking.java | 138 +++++++++--------- .../src/main/java/javababushka/Client.java | 3 +- java/src/lib.rs | 4 +- 4 files changed, 77 insertions(+), 73 deletions(-) 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 1e2bb05201..a4fc37f4d9 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 @@ -41,7 +41,10 @@ public void connectToRedis(ConnectionSettings connectionSettings) { @Override public Future asyncConnectToRedis(ConnectionSettings connectionSettings) { return testClient.asyncConnectToRedis( - connectionSettings.host, connectionSettings.port, connectionSettings.useSsl, connectionSettings.clusterMode); + connectionSettings.host, + connectionSettings.port, + connectionSettings.useSsl, + connectionSettings.clusterMode); } @Override 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 440f93d2ca..5ea846c438 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -1,5 +1,7 @@ package javababushka.benchmarks.utils; +import static java.util.concurrent.CompletableFuture.runAsync; + import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -7,22 +9,18 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import java.util.stream.Collectors; - import javababushka.benchmarks.BenchmarkingApp; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.Client; import javababushka.benchmarks.clients.SyncClient; import org.apache.commons.lang3.tuple.Pair; -import static java.util.concurrent.CompletableFuture.runAsync; - /** Class to calculate latency on client-actions */ public class Benchmarking { static final double PROB_GET = 0.8; @@ -151,81 +149,83 @@ public static void printResults( } public static void testClientSetGet( - Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { + Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { int iterations = - 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) { AtomicInteger iterationCounter = new AtomicInteger(0); Map> actionResults = - Map.of( - ChosenAction.GET_EXISTING, new ArrayList<>(), - ChosenAction.GET_NON_EXISTING, new ArrayList<>(), - ChosenAction.SET, new ArrayList<>()); + Map.of( + ChosenAction.GET_EXISTING, new ArrayList<>(), + ChosenAction.GET_NON_EXISTING, new ArrayList<>(), + ChosenAction.SET, new ArrayList<>()); List tasks = new ArrayList<>(); // create clients List clients = new LinkedList<>(); for (int cc = 0; cc < clientCount; cc++) { Client newClient = clientCreator.get(); - newClient.connectToRedis(new ConnectionSettings(config.host, config.port, config.tls, config.clusterModeEnabled)); + newClient.connectToRedis( + new ConnectionSettings( + config.host, config.port, config.tls, config.clusterModeEnabled)); clients.add(newClient); } String clientName = clients.get(0).getName(); System.out.printf( - "%n =====> %s <===== %d clients %d concurrent %d data %n%n", - clientName, clientCount, concurrentNum, dataSize); + "%n =====> %s <===== %d clients %d concurrent %d data %n%n", + clientName, clientCount, concurrentNum, dataSize); for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { final int taskNumDebugging = taskNum; tasks.add( - () -> { - int iterationIncrement = iterationCounter.getAndIncrement(); - int clientIndex = iterationIncrement % clients.size(); + () -> { + int iterationIncrement = iterationCounter.getAndIncrement(); + int clientIndex = iterationIncrement % clients.size(); - if (config.debugLogging) { - System.out.printf( - "%n concurrent = %d/%d, client# = %d/%d%n", - taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); - } - while (iterationIncrement < iterations) { - if (config.debugLogging) { - System.out.printf( - "> task = %d, iteration = %d/%d, client# = %d/%d%n", - taskNumDebugging, - iterationIncrement + 1, - iterations, - clientIndex + 1, - clientCount); - } - var actions = getActionMap(clients.get(clientIndex), dataSize, async); - // operate and calculate tik-tok - Pair result = measurePerformance(actions); - if (config.debugLogging) { - System.out.printf( - "> task = %d, iteration = %d/%d, client# = %d/%d - DONE%n", - taskNumDebugging, - iterationIncrement + 1, - iterations, - clientIndex + 1, - clientCount); - } - if (result != null) { - actionResults.get(result.getLeft()).add(result.getRight()); - } - iterationIncrement = iterationCounter.getAndIncrement(); - } - }); + if (config.debugLogging) { + System.out.printf( + "%n concurrent = %d/%d, client# = %d/%d%n", + taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); + } + while (iterationIncrement < iterations) { + if (config.debugLogging) { + System.out.printf( + "> task = %d, iteration = %d/%d, client# = %d/%d%n", + taskNumDebugging, + iterationIncrement + 1, + iterations, + clientIndex + 1, + clientCount); + } + var actions = getActionMap(clients.get(clientIndex), dataSize, async); + // operate and calculate tik-tok + Pair result = measurePerformance(actions); + if (config.debugLogging) { + System.out.printf( + "> task = %d, iteration = %d/%d, client# = %d/%d - DONE%n", + taskNumDebugging, + iterationIncrement + 1, + iterations, + clientIndex + 1, + clientCount); + } + if (result != null) { + actionResults.get(result.getLeft()).add(result.getRight()); + } + iterationIncrement = iterationCounter.getAndIncrement(); + } + }); } if (config.debugLogging) { System.out.printf("%s client Benchmarking: %n", clientName); System.out.printf( - "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", - concurrentNum, clientCount, tasks.size()); + "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", + concurrentNum, clientCount, tasks.size()); } long before = System.nanoTime(); ExecutorService threadPool = Executors.newFixedThreadPool(concurrentNum); @@ -233,9 +233,9 @@ public static void testClientSetGet( // create threads and add them to the async pool. // This will start execution of all the concurrent tasks. List asyncTasks = - tasks.stream() - .map((runnable) -> runAsync(runnable, threadPool)) - .collect(Collectors.toList()); + tasks.stream() + .map((runnable) -> runAsync(runnable, threadPool)) + .collect(Collectors.toList()); // close pool and await for tasks to complete threadPool.shutdown(); while (!threadPool.isTerminated()) { @@ -248,13 +248,13 @@ public static void testClientSetGet( } // wait for all futures to complete asyncTasks.forEach( - future -> { - try { - future.get(); - } catch (Exception e) { - e.printStackTrace(); - } - }); + future -> { + try { + future.get(); + } catch (Exception e) { + e.printStackTrace(); + } + }); long after = System.nanoTime(); clients.forEach(Client::closeConnection); @@ -262,14 +262,14 @@ public static void testClientSetGet( var calculatedResults = calculateResults(actionResults); if (config.resultsFile.isPresent()) { JsonWriter.Write( - calculatedResults, - config.resultsFile.get(), - config.clusterModeEnabled, - dataSize, - clientName, - clientCount, - concurrentNum, - iterations / ((after - before) / TPS_NORMALIZATION)); + calculatedResults, + config.resultsFile.get(), + config.clusterModeEnabled, + dataSize, + clientName, + clientCount, + concurrentNum, + iterations / ((after - before) / TPS_NORMALIZATION)); } printResults(calculatedResults, (after - before) / TPS_NORMALIZATION, iterations); try { diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java index b42db3ae65..34760f7086 100644 --- a/java/client/src/main/java/javababushka/Client.java +++ b/java/client/src/main/java/javababushka/Client.java @@ -382,7 +382,8 @@ public Future asyncGet(String key) { .thenApply( response -> response.getRespPointer() != 0 - ? BabushkaCoreNativeDefinitions.valueFromPointer(response.getRespPointer()).toString() + ? BabushkaCoreNativeDefinitions.valueFromPointer(response.getRespPointer()) + .toString() : null); } diff --git a/java/src/lib.rs b/java/src/lib.rs index cef7526b5a..aa29e734f5 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_RustWrapper_valueFromPointer<'local>( +pub extern "system" fn Java_javababushka_BabushkaCoreNativeDefinitions_valueFromPointer<'local>( mut env: JNIEnv<'local>, _class: JClass<'local>, pointer: jlong @@ -48,7 +48,7 @@ pub extern "system" fn Java_javababushka_RustWrapper_valueFromPointer<'local>( } #[no_mangle] -pub extern "system" fn Java_javababushka_RustWrapper_startSocketListenerExternal<'local>( +pub extern "system" fn Java_javababushka_BabushkaCoreNativeDefinitions_startSocketListenerExternal<'local>( mut env: JNIEnv<'local>, _class: JClass<'local> ) -> JObject<'local> { From 33a09c054e4de87943649617cb35e9d4395cda7d Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 19:13:41 -0800 Subject: [PATCH 40/46] Fix CI Signed-off-by: Yury-Fridlyand --- .github/workflows/java.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 3faffc3bc0..e6c417575f 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -41,12 +41,10 @@ jobs: distribution: "temurin" java-version: ${{ matrix.java }} - - name: Install and run protoc (protobuf) + - name: Install protoc (protobuf) run: | sudo apt update sudo apt install -y protobuf-compiler - mkdir -p java/client/src/main/java/org/babushka/javababushka/generated - protoc -Iprotobuf=babushka-core/src/protobuf/ --java_out=java/client/src/main/java/org/babushka/javababushka/generated babushka-core/src/protobuf/*.proto - name: Build rust part working-directory: java From 444a28ced2f75b502ee1b45da0d6e094285078fa Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 16 Nov 2023 19:41:34 -0800 Subject: [PATCH 41/46] More fixes. Signed-off-by: Yury-Fridlyand --- .../benchmarks/utils/Benchmarking.java | 159 ++++++++---------- .../benchmarks/utils/ChosenAction.java | 1 - .../src/main/java/javababushka/Client.java | 16 +- java/src/lib.rs | 2 +- 4 files changed, 80 insertions(+), 98 deletions(-) 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 5ea846c438..96dad1d15b 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -1,7 +1,5 @@ package javababushka.benchmarks.utils; -import static java.util.concurrent.CompletableFuture.runAsync; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -9,12 +7,10 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; -import java.util.stream.Collectors; import javababushka.benchmarks.BenchmarkingApp; import javababushka.benchmarks.clients.AsyncClient; import javababushka.benchmarks.clients.Client; @@ -60,7 +56,6 @@ public interface Operation { void go() throws Exception; } - // private static Pair getLatency(Map actions) { public static Pair measurePerformance(Map actions) { var action = randomAction(); long before = System.nanoTime(); @@ -151,19 +146,14 @@ public static void printResults( public static void testClientSetGet( Supplier clientCreator, BenchmarkingApp.RunConfiguration config, boolean async) { for (int concurrentNum : config.concurrentTasks) { - int iterations = - Math.min(Math.max(LATENCY_MIN, concurrentNum * LATENCY_MULTIPLIER), LATENCY_MAX); + int iterations = Math.min(Math.max(100000, concurrentNum * 10000), 10000000); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { + System.out.printf( + "%n =====> %s <===== %d clients %d concurrent %n%n", + clientCreator.get().getName(), clientCount, concurrentNum); AtomicInteger iterationCounter = new AtomicInteger(0); - Map> actionResults = - Map.of( - ChosenAction.GET_EXISTING, new ArrayList<>(), - ChosenAction.GET_NON_EXISTING, new ArrayList<>(), - ChosenAction.SET, new ArrayList<>()); - List tasks = new ArrayList<>(); - // create clients List clients = new LinkedList<>(); for (int cc = 0; cc < clientCount; cc++) { @@ -174,108 +164,97 @@ public static void testClientSetGet( clients.add(newClient); } - String clientName = clients.get(0).getName(); - - System.out.printf( - "%n =====> %s <===== %d clients %d concurrent %d data %n%n", - clientName, clientCount, concurrentNum, dataSize); - + long started = System.nanoTime(); + List>>> asyncTasks = + new ArrayList<>(); for (int taskNum = 0; taskNum < concurrentNum; taskNum++) { final int taskNumDebugging = taskNum; - tasks.add( - () -> { - int iterationIncrement = iterationCounter.getAndIncrement(); - int clientIndex = iterationIncrement % clients.size(); + asyncTasks.add( + CompletableFuture.supplyAsync( + () -> { + Map> taskActionResults = + Map.of( + ChosenAction.GET_EXISTING, new ArrayList<>(), + ChosenAction.GET_NON_EXISTING, new ArrayList<>(), + ChosenAction.SET, new ArrayList<>()); + int iterationIncrement = iterationCounter.getAndIncrement(); + int clientIndex = iterationIncrement % clients.size(); - if (config.debugLogging) { - System.out.printf( - "%n concurrent = %d/%d, client# = %d/%d%n", - taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); - } - while (iterationIncrement < iterations) { - if (config.debugLogging) { - System.out.printf( - "> task = %d, iteration = %d/%d, client# = %d/%d%n", - taskNumDebugging, - iterationIncrement + 1, - iterations, - clientIndex + 1, - clientCount); - } - var actions = getActionMap(clients.get(clientIndex), dataSize, async); - // operate and calculate tik-tok - Pair result = measurePerformance(actions); - if (config.debugLogging) { - System.out.printf( - "> task = %d, iteration = %d/%d, client# = %d/%d - DONE%n", - taskNumDebugging, - iterationIncrement + 1, - iterations, - clientIndex + 1, - clientCount); - } - if (result != null) { - actionResults.get(result.getLeft()).add(result.getRight()); - } - iterationIncrement = iterationCounter.getAndIncrement(); - } - }); + if (config.debugLogging) { + System.out.printf( + "%n concurrent = %d/%d, client# = %d/%d%n", + taskNumDebugging, concurrentNum, clientIndex + 1, clientCount); + } + while (iterationIncrement < iterations) { + if (config.debugLogging) { + System.out.printf( + "> iteration = %d/%d, client# = %d/%d%n", + iterationIncrement + 1, iterations, clientIndex + 1, clientCount); + } + + var actions = getActionMap(clients.get(clientIndex), dataSize, async); + // operate and calculate tik-tok + Pair result = measurePerformance(actions); + taskActionResults.get(result.getLeft()).add(result.getRight()); + + iterationIncrement = iterationCounter.getAndIncrement(); + clientIndex = iterationIncrement % clients.size(); + } + return taskActionResults; + })); } if (config.debugLogging) { - System.out.printf("%s client Benchmarking: %n", clientName); + System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); System.out.printf( "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", - concurrentNum, clientCount, tasks.size()); + concurrentNum, clientCount, asyncTasks.size()); } - long before = System.nanoTime(); - ExecutorService threadPool = Executors.newFixedThreadPool(concurrentNum); - // create threads and add them to the async pool. - // This will start execution of all the concurrent tasks. - List asyncTasks = - tasks.stream() - .map((runnable) -> runAsync(runnable, threadPool)) - .collect(Collectors.toList()); - // close pool and await for tasks to complete - threadPool.shutdown(); - while (!threadPool.isTerminated()) { - try { - // wait 1 second before waiting for threads to complete - Thread.sleep(100); - } catch (InterruptedException interruptedException) { - interruptedException.printStackTrace(); - } + // This will start execution of all the concurrent tasks asynchronously + CompletableFuture>>[] completableAsyncTaskArray = + asyncTasks.toArray(new CompletableFuture[asyncTasks.size()]); + try { + // wait for all futures to complete + CompletableFuture.allOf(completableAsyncTaskArray).get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + throw new RuntimeException(e); } - // wait for all futures to complete + long after = System.nanoTime(); + + // Map to save latency results separately for each action + Map> actionResults = + Map.of( + ChosenAction.GET_EXISTING, new ArrayList<>(), + ChosenAction.GET_NON_EXISTING, new ArrayList<>(), + ChosenAction.SET, new ArrayList<>()); + + // for each task, call future.get() to retrieve & save the result in the map asyncTasks.forEach( future -> { try { - future.get(); + var futureResult = future.get(); + futureResult.forEach( + (action, result) -> actionResults.get(action).addAll(result)); } catch (Exception e) { e.printStackTrace(); } }); - long after = System.nanoTime(); - - clients.forEach(Client::closeConnection); - var calculatedResults = calculateResults(actionResults); + if (config.resultsFile.isPresent()) { + double tps = iterationCounter.get() * NANO_TO_SECONDS / (after - started); JsonWriter.Write( calculatedResults, config.resultsFile.get(), config.clusterModeEnabled, dataSize, - clientName, + clientCreator.get().getName(), clientCount, concurrentNum, - iterations / ((after - before) / TPS_NORMALIZATION)); - } - printResults(calculatedResults, (after - before) / TPS_NORMALIZATION, iterations); - try { - Thread.sleep(2000); - } catch (InterruptedException ignored) { + tps); } + printResults(calculatedResults, (after - started) / TPS_NORMALIZATION, iterations); } } } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java index b6bfe118ee..bd9f01fd90 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/ChosenAction.java @@ -1,6 +1,5 @@ package javababushka.benchmarks.utils; -/** enum for actions */ public enum ChosenAction { GET_NON_EXISTING, GET_EXISTING, diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java index 34760f7086..f927150b1e 100644 --- a/java/client/src/main/java/javababushka/Client.java +++ b/java/client/src/main/java/javababushka/Client.java @@ -55,6 +55,10 @@ public class Client implements AutoCloseable { + private static final int RESPONSE_TIMEOUT_MILLISECONDS = 250; + private static final int CLIENT_CREATION_TIMEOUT_MILLISECONDS = 250; + private static final int HIGH_WRITE_WATERMARK = 4096; + private static final int LOW_WRITE_WATERMARK = 1024; private static final long DEFAULT_TIMEOUT_MILLISECONDS = 1000; public static boolean ALWAYS_FLUSH_ON_WRITE = false; @@ -78,12 +82,12 @@ public class Client implements AutoCloseable { // 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(); + // TODO move to a [static] constructor. private final String unixSocket = getSocket(); private static String getSocket() { @@ -122,7 +126,9 @@ private void createChannel() { try { channel = new Bootstrap() - .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024, 4096)) + .option( + ChannelOption.WRITE_BUFFER_WATER_MARK, + new WriteBufferWaterMark(LOW_WRITE_WATERMARK, HIGH_WRITE_WATERMARK)) .option(ChannelOption.ALLOCATOR, ByteBufAllocator.DEFAULT) .group(group = isMacOs ? new KQueueEventLoopGroup() : new EpollEventLoopGroup()) .channel(isMacOs ? KQueueDomainSocketChannel.class : EpollDomainSocketChannel.class) @@ -297,10 +303,8 @@ public Future asyncConnectToRedis( ? TlsMode.SecureTls : TlsMode.NoTls) .setClusterModeEnabled(clusterMode) - // In millis - .setResponseTimeout(250) - // In millis - .setClientCreationTimeout(2500) + .setResponseTimeout(RESPONSE_TIMEOUT_MILLISECONDS) + .setClientCreationTimeout(CLIENT_CREATION_TIMEOUT_MILLISECONDS) .setReadFromReplicaStrategy(ReadFromReplicaStrategy.AlwaysFromPrimary) .setConnectionRetryStrategy( ConnectionRetryStrategy.newBuilder() diff --git a/java/src/lib.rs b/java/src/lib.rs index aa29e734f5..468d8797e7 100644 --- a/java/src/lib.rs +++ b/java/src/lib.rs @@ -95,4 +95,4 @@ fn throw_java_exception(mut env: JNIEnv, message: String) { error!("Failed to create exception with string {}: {}", message, err.to_string()); } }; -} \ No newline at end of file +} From e11a0ee003dd3f8d33db01f76cbc31c5231d7601 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Fri, 17 Nov 2023 10:58:20 -0800 Subject: [PATCH 42/46] Some changes. Signed-off-by: Yury-Fridlyand --- .../benchmarks/utils/Benchmarking.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) 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 96dad1d15b..e0bc2e455d 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -149,21 +149,23 @@ public static void testClientSetGet( int iterations = Math.min(Math.max(100000, concurrentNum * 10000), 10000000); for (int clientCount : config.clientCount) { for (int dataSize : config.dataSize) { - System.out.printf( - "%n =====> %s <===== %d clients %d concurrent %n%n", - clientCreator.get().getName(), clientCount, concurrentNum); - AtomicInteger iterationCounter = new AtomicInteger(0); - // create clients List clients = new LinkedList<>(); for (int cc = 0; cc < clientCount; cc++) { Client newClient = clientCreator.get(); newClient.connectToRedis( - new ConnectionSettings( - config.host, config.port, config.tls, config.clusterModeEnabled)); + new ConnectionSettings( + config.host, config.port, config.tls, config.clusterModeEnabled)); clients.add(newClient); } + var clientName = clients.get(0).getName(); + + System.out.printf( + "%n =====> %s <===== %d clients %d concurrent %n%n", + clientName, clientCount, concurrentNum); + AtomicInteger iterationCounter = new AtomicInteger(0); + long started = System.nanoTime(); List>>> asyncTasks = new ArrayList<>(); @@ -204,7 +206,7 @@ public static void testClientSetGet( })); } if (config.debugLogging) { - System.out.printf("%s client Benchmarking: %n", clientCreator.get().getName()); + System.out.printf("%s client Benchmarking: %n", clientName); System.out.printf( "===> concurrentNum = %d, clientNum = %d, tasks = %d%n", concurrentNum, clientCount, asyncTasks.size()); @@ -242,6 +244,8 @@ public static void testClientSetGet( }); var calculatedResults = calculateResults(actionResults); + clients.forEach(Client::closeConnection); + if (config.resultsFile.isPresent()) { double tps = iterationCounter.get() * NANO_TO_SECONDS / (after - started); JsonWriter.Write( @@ -249,7 +253,7 @@ public static void testClientSetGet( config.resultsFile.get(), config.clusterModeEnabled, dataSize, - clientCreator.get().getName(), + clientName, clientCount, concurrentNum, tps); From 29ba2a38fc372af3adbe793c4979f4502210cb56 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 20 Nov 2023 13:09:08 -0800 Subject: [PATCH 43/46] add null check Signed-off-by: Yury-Fridlyand --- .../main/java/javababushka/benchmarks/utils/Benchmarking.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 e0bc2e455d..2e04ca9c96 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -197,7 +197,9 @@ public static void testClientSetGet( var actions = getActionMap(clients.get(clientIndex), dataSize, async); // operate and calculate tik-tok Pair result = measurePerformance(actions); - taskActionResults.get(result.getLeft()).add(result.getRight()); + if (result != null) { + taskActionResults.get(result.getLeft()).add(result.getRight()); + } iterationIncrement = iterationCounter.getAndIncrement(); clientIndex = iterationIncrement % clients.size(); From 16a868073b62d2f1d9d1ef9b948ebd9e46b15b3c Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 20 Nov 2023 14:08:55 -0800 Subject: [PATCH 44/46] autoflush Signed-off-by: Yury-Fridlyand --- java/client/src/main/java/javababushka/Client.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/client/src/main/java/javababushka/Client.java b/java/client/src/main/java/javababushka/Client.java index f927150b1e..d6cb16e591 100644 --- a/java/client/src/main/java/javababushka/Client.java +++ b/java/client/src/main/java/javababushka/Client.java @@ -60,7 +60,7 @@ public class Client implements AutoCloseable { private static final int HIGH_WRITE_WATERMARK = 4096; private static final int LOW_WRITE_WATERMARK = 1024; private static final long DEFAULT_TIMEOUT_MILLISECONDS = 1000; - public static boolean ALWAYS_FLUSH_ON_WRITE = false; + public static boolean ALWAYS_FLUSH_ON_WRITE = true; // https://netty.io/3.6/api/org/jboss/netty/handler/queue/BufferedWriteHandler.html // Flush every N bytes if !ALWAYS_FLUSH_ON_WRITE From 3f47ba2e37b4397b4db66591f2cb8aff94a6d3f7 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 21 Nov 2023 17:50:17 -0800 Subject: [PATCH 45/46] Apply suggestions from code review Signed-off-by: Yury-Fridlyand Co-authored-by: Andrew Carbonetto --- .../java/javababushka/benchmarks/clients/jedis/JedisClient.java | 2 +- .../benchmarks/clients/jedis/JedisPseudoAsyncClient.java | 2 +- .../benchmarks/clients/lettuce/LettuceAsyncClusterClient.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java index fe7722b324..f088d5ac07 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/jedis/JedisClient.java @@ -5,7 +5,7 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; -/** A jedis client with sync capabilities. See: https://github.com/redis/jedis */ +/** A Jedis client with sync capabilities. See: https://github.com/redis/jedis */ public class JedisClient implements SyncClient { public static final String DEFAULT_HOST = "localhost"; 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 dbd8c8bbd2..3970826a33 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 @@ -6,7 +6,7 @@ import javababushka.benchmarks.utils.ConnectionSettings; /** - * A jedis client with pseudo-sync capabilities. Jedis doesn't provide async API + * A Jedis client with pseudo-async capabilities. Jedis doesn't provide async API * https://github.com/redis/jedis/issues/241 * *

See: https://github.com/redis/jedis diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java index 7f70b1781c..6e5ed09ce3 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/clients/lettuce/LettuceAsyncClusterClient.java @@ -18,7 +18,7 @@ public class LettuceAsyncClusterClient extends LettuceAsyncClient { @Override public void connectToRedis() { - connectToRedis(new ConnectionSettings("localhost", 6379, false, false)); + connectToRedis(new ConnectionSettings("localhost", 6379, false, true)); } @Override From 61baa41ee7f1d70737857eb7a37ba57999b2b0af Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 21 Nov 2023 17:52:12 -0800 Subject: [PATCH 46/46] minor changes Signed-off-by: Yury-Fridlyand --- java/benchmarks/build.gradle | 3 --- .../java/javababushka/benchmarks/BenchmarkingApp.java | 10 ++++------ .../javababushka/benchmarks/utils/Benchmarking.java | 6 +++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/java/benchmarks/build.gradle b/java/benchmarks/build.gradle index ecc330f781..6ade7532b0 100644 --- a/java/benchmarks/build.gradle +++ b/java/benchmarks/build.gradle @@ -23,9 +23,6 @@ dependencies { implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' - //testImplementation group: 'org.slf4j', name: 'slf4j-reload4j', version: '2.0.9' - //testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.9' - compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' } diff --git a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java index d8efc8da78..b401488584 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java @@ -240,9 +240,9 @@ public boolean isEqual(String other) { public static class RunConfiguration { public String configuration; + public Optional resultsFile; public int[] dataSize; public int[] concurrentTasks; - public Optional resultsFile; public ClientName[] clients; public String host; public int port; @@ -258,11 +258,9 @@ public RunConfiguration() { concurrentTasks = new int[] {100, 1000}; clients = new ClientName[] { - // ClientName.BABUSHKA_ASYNC, - // ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, - // ClientName.LETTUCE_ASYNC - ClientName.BABUSHKA_ASYNC, - ClientName.BABUSHKA // , ClientName.LETTUCE, ClientName.LETTUCE_ASYNC + // ClientName.LETTUCE, + // ClientName.LETTUCE_ASYNC, + ClientName.BABUSHKA_ASYNC, ClientName.BABUSHKA, }; host = "localhost"; port = 6379; 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 2e04ca9c96..4d826c427b 100644 --- a/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java +++ b/java/benchmarks/src/main/java/javababushka/benchmarks/utils/Benchmarking.java @@ -154,8 +154,8 @@ public static void testClientSetGet( for (int cc = 0; cc < clientCount; cc++) { Client newClient = clientCreator.get(); newClient.connectToRedis( - new ConnectionSettings( - config.host, config.port, config.tls, config.clusterModeEnabled)); + new ConnectionSettings( + config.host, config.port, config.tls, config.clusterModeEnabled)); clients.add(newClient); } @@ -163,7 +163,7 @@ public static void testClientSetGet( System.out.printf( "%n =====> %s <===== %d clients %d concurrent %n%n", - clientName, clientCount, concurrentNum); + clientName, clientCount, concurrentNum); AtomicInteger iterationCounter = new AtomicInteger(0); long started = System.nanoTime();