RATIS-1517. Remove core Ratis protos (#2)
diff --git a/pom.xml b/pom.xml
index 9d45f9f..b045f5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,6 @@
</licenses>
<modules>
- <module>ratis-proto</module>
<module>ratis-resource-bundle</module>
<module>ratis-hadoop</module>
<module>ratis-logservice</module>
@@ -197,7 +196,6 @@
<!-- Need these for the protobuf compiler. *MUST* match what is in ratis-thirdparty -->
<shaded.protobuf.version>3.12.0</shaded.protobuf.version>
- <shaded.grpc.version>1.33.0</shaded.grpc.version>
<hadoop.protobuf.version>2.5.0</hadoop.protobuf.version>
diff --git a/ratis-hadoop/pom.xml b/ratis-hadoop/pom.xml
index f1e5776..310883c 100644
--- a/ratis-hadoop/pom.xml
+++ b/ratis-hadoop/pom.xml
@@ -74,6 +74,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -88,6 +93,11 @@
</dependency>
<dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>annotations-api</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<scope>provided</scope>
@@ -100,25 +110,73 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
- <configuration>
- <protocArtifact>
- com.google.protobuf:protoc:${hadoop.protobuf.version}:exe:${os.detected.classifier}
- </protocArtifact>
- <!-- Place these in a location that compiler-plugin is already looking -->
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution -->
- <clearOutputDirectory>false</clearOutputDirectory>
- </configuration>
<executions>
<execution>
- <id>compile-protobuf</id>
+ <id>compile-protobuf-2</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
+ <configuration>
+ <protocArtifact>
+ com.google.protobuf:protoc:${hadoop.protobuf.version}:exe:${os.detected.classifier}
+ </protocArtifact>
+ <includes>
+ <include>HadoopCompatability.proto</include>
+ </includes>
+ <!-- Place these in a location that compiler-plugin is already looking -->
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution -->
+ <clearOutputDirectory>false</clearOutputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>compile-protobuf-3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <protocArtifact>
+ com.google.protobuf:protoc:${shaded.protobuf.version}:exe:${os.detected.classifier}
+ </protocArtifact>
+ <includes>
+ <include>Hadoop.proto</include>
+ </includes>
+ <!-- Place these in a location that compiler-plugin is already looking -->
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution -->
+ <clearOutputDirectory>false</clearOutputDirectory>
+ </configuration>
</execution>
</executions>
</plugin>
+ <!-- Modify the generated source to use our shaded protobuf -->
+ <plugin>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>replacer</artifactId>
+ <version>1.5.3</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <basedir>${project.build.directory}/generated-sources</basedir>
+ <includes>
+ <include>**/HadoopProtos.java</include>
+ </includes>
+ <replacements>
+ <replacement>
+ <token>([^\.])com.google</token>
+ <value>$1org.apache.ratis.thirdparty.com.google</value>
+ </replacement>
+ </replacements>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
diff --git a/ratis-proto/src/main/proto/Hadoop.proto b/ratis-hadoop/src/main/proto/Hadoop.proto
similarity index 100%
rename from ratis-proto/src/main/proto/Hadoop.proto
rename to ratis-hadoop/src/main/proto/Hadoop.proto
diff --git a/ratis-proto/pom.xml b/ratis-proto/pom.xml
deleted file mode 100644
index e2f64d0..0000000
--- a/ratis-proto/pom.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. See accompanying LICENSE file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>ratis</artifactId>
- <groupId>org.apache.ratis</groupId>
- <version>2.3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>ratis-proto</artifactId>
- <name>Apache Ratis Protocols</name>
-
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- <spotbugs.skip>true</spotbugs.skip>
- </properties>
-
- <build>
- <extensions>
- <!-- Use os-maven-plugin to initialize the "os.detected" properties -->
- <extension>
- <groupId>kr.motd.maven</groupId>
- <artifactId>os-maven-plugin</artifactId>
- <version>1.5.0.Final</version>
- </extension>
- </extensions>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <compilerArgs>
- <!-- disable all javac warnings for shaded sources -->
- <arg>-Xlint:none</arg>
- <arg>-XDignore.symbol.file</arg>
- </compilerArgs>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration/>
- </plugin>
- <!-- Make a jar and put the sources in the jar -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- </plugin>
- <plugin>
- <!--Make it so assembly:single does nothing in here-->
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <skipAssembly>true</skipAssembly>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- <configuration>
- <protocArtifact>
- com.google.protobuf:protoc:${shaded.protobuf.version}:exe:${os.detected.classifier}
- </protocArtifact>
- <!-- Place these in a location that compiler-plugin is already looking -->
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution -->
- <clearOutputDirectory>false</clearOutputDirectory>
- </configuration>
- <executions>
- <execution>
- <id>compile-protobuf</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>compile-grpc</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>compile-custom</goal>
- </goals>
- <configuration>
- <pluginId>grpc-java</pluginId>
- <pluginArtifact>
- io.grpc:protoc-gen-grpc-java:${shaded.grpc.version}:exe:${os.detected.classifier}
- </pluginArtifact>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <!-- Replace the "default" jar-plugin execution -->
- <!-- This is a super-dirty hack to work around Yetus
- PreCommit not using the package lifecycle phase -->
- <id>default-jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- Modify the generated source to use our shaded protobuf -->
- <plugin>
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>replacer</artifactId>
- <version>1.5.3</version>
- <executions>
- <execution>
- <phase>process-sources</phase>
- <goals>
- <goal>replace</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <basedir>${project.build.directory}/generated-sources</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
- <replacements>
- <replacement>
- <token>([^\.])com.google</token>
- <value>$1org.apache.ratis.thirdparty.com.google</value>
- </replacement>
- <replacement>
- <token>([^\.])io.grpc</token>
- <value>$1org.apache.ratis.thirdparty.io.grpc</value>
- </replacement>
- </replacements>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- com.google.code.maven-replacer-plugin
- </groupId>
- <artifactId>replacer</artifactId>
- <versionRange>
- [1.5.3,)
- </versionRange>
- <goals>
- <goal>replace</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.ratis</groupId>
- <artifactId>ratis-thirdparty-misc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>annotations-api</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ratis-proto/src/main/proto/Examples.proto b/ratis-proto/src/main/proto/Examples.proto
deleted file mode 100644
index ecf750d..0000000
--- a/ratis-proto/src/main/proto/Examples.proto
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto";
-option java_outer_classname = "ExamplesProtos";
-option java_generate_equals_and_hash = true;
-package ratis.example;
-
-message FileStoreRequestProto {
- oneof Request {
- WriteRequestHeaderProto writeHeader = 1;
- WriteRequestProto write = 2;
- DeleteRequestProto delete = 3;
- StreamWriteRequestProto stream = 4;
- }
-}
-
-message ReadRequestProto {
- bytes path = 1;
- uint64 offset = 2;
- uint64 length = 3;
-}
-
-message WriteRequestHeaderProto {
- bytes path = 1;
- bool close = 2; // close the file after write?
- uint64 offset = 3;
- uint64 length = 4;
- bool sync = 5;
-}
-
-message StreamWriteRequestProto {
- bytes path = 1;
- uint64 length = 2;
-}
-
-message WriteRequestProto {
- WriteRequestHeaderProto header = 1;
- bytes data = 2;
-}
-
-message DeleteRequestProto {
- bytes path = 1;
-}
-
-message ReadReplyProto {
- bytes resolvedPath = 1;
- uint64 offset = 2;
- bytes data = 3; // returned data size may be smaller than the requested size
-}
-
-message WriteReplyProto {
- bytes resolvedPath = 1;
- uint64 offset = 2;
- uint64 length = 3; // bytes actually written
-}
-
-message DeleteReplyProto {
- bytes resolvedPath = 1;
-}
-
-message StreamWriteReplyProto {
- bool isSuccess = 1;
- uint64 byteWritten = 2;
-}
diff --git a/ratis-proto/src/main/proto/Experiments.proto b/ratis-proto/src/main/proto/Experiments.proto
deleted file mode 100644
index a3eec28..0000000
--- a/ratis-proto/src/main/proto/Experiments.proto
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto";
-option java_outer_classname = "ExperimentsProtos";
-option java_generate_equals_and_hash = true;
-package ratis.experiments;
-
-message TransferMsgProto {
- uint32 partId = 1;
- bytes data = 2;
-}
-
-message TransferReplyProto {
- uint32 partId = 1;
- string message = 2;
-}
-
-service FileTransferExampleService {
- rpc sendData(stream TransferMsgProto) returns (stream TransferReplyProto);
-}
\ No newline at end of file
diff --git a/ratis-proto/src/main/proto/Grpc.proto b/ratis-proto/src/main/proto/Grpc.proto
deleted file mode 100644
index 799b3ac..0000000
--- a/ratis-proto/src/main/proto/Grpc.proto
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto.grpc";
-option java_outer_classname = "GrpcProtos";
-option java_generate_equals_and_hash = true;
-package ratis.grpc;
-
-import "Raft.proto";
-
-service RaftClientProtocolService {
- // A client-to-server stream RPC to ordered async requests
- rpc ordered(stream ratis.common.RaftClientRequestProto)
- returns (stream ratis.common.RaftClientReplyProto) {}
-
- // A client-to-server stream RPC for unordered async requests
- rpc unordered(stream ratis.common.RaftClientRequestProto)
- returns (stream ratis.common.RaftClientReplyProto) {}
-}
-
-service RaftServerProtocolService {
- rpc requestVote(ratis.common.RequestVoteRequestProto)
- returns(ratis.common.RequestVoteReplyProto) {}
-
- rpc startLeaderElection(ratis.common.StartLeaderElectionRequestProto)
- returns(ratis.common.StartLeaderElectionReplyProto) {}
-
- rpc appendEntries(stream ratis.common.AppendEntriesRequestProto)
- returns(stream ratis.common.AppendEntriesReplyProto) {}
-
- rpc installSnapshot(stream ratis.common.InstallSnapshotRequestProto)
- returns(ratis.common.InstallSnapshotReplyProto) {}
-}
-
-service AdminProtocolService {
- // A client-to-server RPC to set new raft configuration
- rpc setConfiguration(ratis.common.SetConfigurationRequestProto)
- returns(ratis.common.RaftClientReplyProto) {}
-
- rpc transferLeadership(ratis.common.TransferLeadershipRequestProto)
- returns(ratis.common.RaftClientReplyProto) {}
-
- // A client-to-server RPC to add a new group
- rpc groupManagement(ratis.common.GroupManagementRequestProto)
- returns(ratis.common.RaftClientReplyProto) {}
-
- rpc snapshotManagement(ratis.common.SnapshotManagementRequestProto)
- returns(ratis.common.RaftClientReplyProto) {}
-
- rpc groupList(ratis.common.GroupListRequestProto)
- returns(ratis.common.GroupListReplyProto) {}
-
- rpc groupInfo(ratis.common.GroupInfoRequestProto)
- returns(ratis.common.GroupInfoReplyProto) {}
-}
diff --git a/ratis-proto/src/main/proto/Netty.proto b/ratis-proto/src/main/proto/Netty.proto
deleted file mode 100644
index ec8a0fc..0000000
--- a/ratis-proto/src/main/proto/Netty.proto
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto.netty";
-option java_outer_classname = "NettyProtos";
-option java_generate_equals_and_hash = true;
-package ratis.netty;
-
-import "Raft.proto";
-
-message RaftNettyExceptionReplyProto {
- ratis.common.RaftRpcReplyProto rpcReply = 1;
- bytes exception = 2;
-}
-
-message RaftNettyServerRequestProto {
- oneof raftNettyServerRequest {
- ratis.common.RequestVoteRequestProto requestVoteRequest = 1;
- ratis.common.AppendEntriesRequestProto appendEntriesRequest = 2;
- ratis.common.InstallSnapshotRequestProto installSnapshotRequest = 3;
- ratis.common.RaftClientRequestProto raftClientRequest = 4;
- ratis.common.SetConfigurationRequestProto setConfigurationRequest = 5;
- ratis.common.GroupManagementRequestProto groupManagementRequest = 6;
- ratis.common.GroupListRequestProto groupListRequest = 7;
- ratis.common.GroupInfoRequestProto groupInfoRequest = 8;
- ratis.common.TransferLeadershipRequestProto transferLeadershipRequest = 9;
- ratis.common.StartLeaderElectionRequestProto startLeaderElectionRequest = 10;
- ratis.common.SnapshotManagementRequestProto snapshotManagementRequest = 11;
- }
-}
-
-message RaftNettyServerReplyProto {
- oneof raftNettyServerReply {
- ratis.common.RequestVoteReplyProto requestVoteReply = 1;
- ratis.common.AppendEntriesReplyProto appendEntriesReply = 2;
- ratis.common.InstallSnapshotReplyProto installSnapshotReply = 3;
- ratis.common.RaftClientReplyProto raftClientReply = 4;
- ratis.common.GroupListReplyProto groupListReply = 5;
- ratis.common.GroupInfoReplyProto groupInfoReply = 6;
- RaftNettyExceptionReplyProto exceptionReply = 7;
- ratis.common.StartLeaderElectionReplyProto startLeaderElectionReply = 8;
- }
-}
diff --git a/ratis-proto/src/main/proto/RMap.proto b/ratis-proto/src/main/proto/RMap.proto
deleted file mode 100644
index 43c9377..0000000
--- a/ratis-proto/src/main/proto/RMap.proto
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto.rmap";
-option java_outer_classname = "RMapProtos";
-option java_generate_equals_and_hash = true;
-package ratis.rmap;
-
-// TODO: This .proto file should go to the ratis-replicated-map module, but we need it here
-// due to shading.
-
-// Metadata about a replicated map
-message RMapInfo {
- int64 rmap_id = 1;
- string name = 2;
- string key_class = 3;
- string value_class = 4;
- string key_serde_class = 5;
- string value_serde_class = 6;
- string key_comparator_class = 7;
-}
-
-// An entry in a replicated map.`
-message Entry {
- bytes key = 1;
- bytes value = 2;
-}
-
-// TODO: raft client should allow a Service decleration, and calling a method from the service
-// similar to how coprocessor calls work in HBase.
-message Request {
- oneof RequestType {
- MultiActionRequest multi_action_request = 1;
- ScanRequest scan_request = 2;
- CreateRMapRequest create_rmap_request = 3;
- DeleteRMapRequest delete_rmap_request = 4;
- ListRMapInfosRequest list_rmap_infos_request = 5;
- }
-}
-
-message Response {
- ExceptionResponse exception = 1;
- oneof ResponseType {
- MultiActionResponse multi_action_response = 2;
- ScanResponse scan_response = 3;
- CreateRMapResponse create_rmap_response = 4;
- DeleteRMapResponse delete_rmap_response = 5;
- ListRMapInfosResponse list_rmap_infos_response = 6;
- }
-}
-
-message MultiActionRequest {
- int64 rmap_id = 1;
- repeated Action action = 2;
-}
-
-message Action {
- oneof ActionType {
- GetRequest get_request = 1;
- PutRequest put_request = 2;
- }
-}
-
-message ActionResponse {
- oneof ActionType {
- GetResponse get_response = 1;
- PutResponse put_response = 2;
- }
-}
-
-message MultiActionResponse {
- repeated ActionResponse action_response = 1;
-}
-
-message CreateRMapRequest {
- RMapInfo rmap_info = 1;
-}
-
-message CreateRMapResponse {
- RMapInfo rmap_info = 1;
-}
-
-message DeleteRMapRequest {
- int64 rmap_id = 1;
-}
-
-message DeleteRMapResponse {
-}
-
-message ListRMapInfosRequest {
- oneof ListRMapInfosType {
- // if set, we only care about a particular RMapInfo
- int64 rmap_id = 1;
-
- // only return infos whose names match this pattern
- string name_pattern = 2;
- }
-}
-
-message ListRMapInfosResponse {
- repeated RMapInfo rmap_info = 1;
-}
-
-message GetRequest {
- bytes key = 1;
-}
-
-message GetResponse {
- bool found = 1;
- bytes key = 2;
- bytes value = 3;
-}
-
-message PutRequest {
- bytes key = 1;
- bytes value = 2;
-}
-
-message PutResponse {
-}
-
-message Scan {
- bytes start_Key = 1;
- bytes end_key = 2;
- bool start_key_inclusive = 3;
- bool end_key_inclusive = 4;
- bool keys_only = 5;
- int32 limit = 6;
-}
-
-message ScanRequest {
- int64 rmap_id = 1;
- Scan scan = 2;
-}
-
-message ScanResponse {
- repeated Entry entry = 1;
-}
-
-message ExceptionResponse {
- // Class name of the exception thrown from the server
- string exception_class_name = 1;
- // Exception stack trace from the server side
- string stack_trace = 2;
- // Optional hostname. Filled in for some exceptions such as region moved
- // where exception gives clue on where the region may have moved.
- string hostname = 3;
- int32 port = 4;
- // Set if we are NOT to retry on receipt of this exception
- bool do_not_retry = 5;
-}
-
-message Id {
- int64 id = 1;
-}
-
-message WALEntry {
- int64 rmap_id = 1; // these are shared by all WALEntry types
- repeated Entry entry = 2;
- oneof WALEntryType {
- // Multi is not here, because we do not want to create one more object unnecessarily
- CreateRMapWALEntry create_rmap_entry = 3;
- DeleteRMapWALEntry delete_rmap_entry = 4;
- }
-}
-
-message CreateRMapWALEntry {
- RMapInfo rmap_info = 1;
- Id id = 2;
-}
-
-message DeleteRMapWALEntry {
- int64 id = 1;
-}
diff --git a/ratis-proto/src/main/proto/Raft.proto b/ratis-proto/src/main/proto/Raft.proto
deleted file mode 100644
index 17e7002..0000000
--- a/ratis-proto/src/main/proto/Raft.proto
+++ /dev/null
@@ -1,510 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto3";
-option java_package = "org.apache.ratis.proto";
-option java_outer_classname = "RaftProtos";
-option java_generate_equals_and_hash = true;
-package ratis.common;
-
-message RaftPeerProto {
- bytes id = 1; // id of the peer
- string address = 2; // e.g. address of the RPC server
- uint32 priority = 3; // priority of the peer
- string dataStreamAddress = 4; // address of the data stream server
- string clientAddress = 5; // address of the client RPC server
- string adminAddress = 6; // address of the admin RPC server
-}
-
-message RaftPeerIdProto {
- bytes id = 1; // id of the peer
-}
-
-message RaftGroupIdProto {
- bytes id = 1;
-}
-
-message RaftGroupProto {
- RaftGroupIdProto groupId = 1;
- repeated RaftPeerProto peers = 2;
-}
-
-message RaftGroupMemberIdProto {
- bytes peerId = 1;
- RaftGroupIdProto groupId = 2;
-}
-
-message RaftConfigurationProto {
- repeated RaftPeerProto peers = 1; // the peers in the current or new conf
- repeated RaftPeerProto oldPeers = 2; // the peers in the old conf
-}
-
-message StateMachineEntryProto {
- /**
- * StateMachine specific data which is not written to log.
- * Unlike logEntryData, stateMachineData is managed and stored by the StateMachine but not the RaftLog.
- */
- bytes stateMachineData = 1;
- /**
- * When stateMachineData is missing, it is the size of the serialized LogEntryProto along with stateMachineData.
- * When stateMachineData is not missing, it must be set to zero.
- */
- uint32 logEntryProtoSerializedSize = 2;
-}
-
-message StateMachineLogEntryProto {
- // TODO: This is not super efficient if the SM itself uses PB to serialize its own data for a
- /** RaftLog entry data */
- bytes logData = 1;
- /**
- * StateMachine entry.
- * StateMachine implementation may use this field to separate StateMachine specific data from the RaftLog data.
- */
- StateMachineEntryProto stateMachineEntry = 2;
-
- enum Type {
- WRITE = 0;
- DATASTREAM = 1;
- }
-
- Type type = 13;
- // clientId and callId are used to rebuild the retry cache.
- bytes clientId = 14;
- uint64 callId = 15;
-}
-
-message MetadataProto {
- uint64 commitIndex = 1;
-}
-
-message LogEntryProto {
- uint64 term = 1;
- uint64 index = 2;
-
- oneof LogEntryBody {
- StateMachineLogEntryProto stateMachineLogEntry = 3;
- RaftConfigurationProto configurationEntry = 4;
- MetadataProto metadataEntry = 5;
- }
-}
-
-message TermIndexProto {
- uint64 term = 1;
- uint64 index = 2;
-}
-
-message RaftRpcRequestProto {
- bytes requestorId = 1;
- bytes replyId = 2;
- RaftGroupIdProto raftGroupId = 3;
- uint64 callId = 4;
- bool toLeader = 5;
-
- uint64 timeoutMs = 13;
- RoutingTableProto routingTable = 14;
- SlidingWindowEntry slidingWindowEntry = 15;
-}
-
-message SlidingWindowEntry {
- uint64 seqNum = 1; // 0 for non-sliding-window requests; >= 1 for sliding-window requests
- bool isFirst = 2; // Is this the first request of the sliding window?
-}
-
-message RaftRpcReplyProto {
- bytes requestorId = 1;
- bytes replyId = 2;
- RaftGroupIdProto raftGroupId = 3;
- uint64 callId = 4;
-
- bool success = 15;
-}
-
-message FileChunkProto {
- string filename = 1; // relative to root
- uint64 totalSize = 2;
- bytes fileDigest = 3;
- uint32 chunkIndex = 4;
- uint64 offset = 5;
- bytes data = 6;
- bool done = 7;
-}
-
-enum InstallSnapshotResult {
- SUCCESS = 0;
- NOT_LEADER = 1;
- IN_PROGRESS = 2;
- ALREADY_INSTALLED = 3;
- CONF_MISMATCH = 4;
- SNAPSHOT_INSTALLED = 5;
- SNAPSHOT_UNAVAILABLE = 6;
-}
-
-message RequestVoteRequestProto {
- RaftRpcRequestProto serverRequest = 1;
- uint64 candidateTerm = 2;
- TermIndexProto candidateLastEntry = 3;
- bool preVote = 4;
-}
-
-message RequestVoteReplyProto {
- RaftRpcReplyProto serverReply = 1;
- uint64 term = 2;
- bool shouldShutdown = 3;
-}
-
-message CommitInfoProto {
- RaftPeerProto server = 1;
- uint64 commitIndex = 2;
-}
-
-message AppendEntriesRequestProto {
- RaftRpcRequestProto serverRequest = 1;
- uint64 leaderTerm = 2;
- TermIndexProto previousLog = 3;
- repeated LogEntryProto entries = 4;
- uint64 leaderCommit = 5;
- bool initializing = 6;
-
- repeated CommitInfoProto commitInfos = 15;
-}
-
-message AppendEntriesReplyProto {
- enum AppendResult {
- SUCCESS = 0;
- NOT_LEADER = 1; // the requester's term is not large enough
- INCONSISTENCY = 2; // gap between the local log and the entries or snapshot installation in progress or
- // overlap between local snapshot and the entries
- }
-
- RaftRpcReplyProto serverReply = 1;
- uint64 term = 2;
- uint64 nextIndex = 3;
- AppendResult result = 4;
- uint64 followerCommit = 5;
- uint64 matchIndex = 6;
- bool isHearbeat = 7;
-}
-
-message InstallSnapshotRequestProto {
- message SnapshotChunkProto {
- string requestId = 1; // an identifier for chunked-requests.
- uint32 requestIndex = 2; // the index for this request chunk. Starts from 0.
- RaftConfigurationProto raftConfiguration = 3;
- TermIndexProto termIndex = 4;
- repeated FileChunkProto fileChunks = 5;
- uint64 totalSize = 6;
- bool done = 7; // whether this is the final chunk for the same req.
- }
-
- message NotificationProto {
- TermIndexProto firstAvailableTermIndex = 1; // first available log index to notify Follower to install snapshot.
- }
-
- RaftRpcRequestProto serverRequest = 1;
- uint64 leaderTerm = 2;
-
- oneof InstallSnapshotRequestBody {
- SnapshotChunkProto snapshotChunk = 3;
- NotificationProto notification = 4;
- }
-
- LogEntryProto lastRaftConfigurationLogEntryProto = 5;
-}
-
-message InstallSnapshotReplyProto {
- RaftRpcReplyProto serverReply = 1;
- uint64 term = 2;
- InstallSnapshotResult result = 3;
-
- oneof InstallSnapshotReplyBody {
- uint32 requestIndex = 4; // index of the snapshot chunk request.
- uint64 snapshotIndex = 5; // index of snapshot installed after notification.
- }
-}
-
-message ClientMessageEntryProto {
- bytes content = 1;
-}
-
-enum ReplicationLevel {
- /** Committed at the leader and replicated to the majority of peers. */
- MAJORITY = 0;
- /** Committed at the leader and replicated to all peers.
- Note that ReplicationLevel.ALL implies ReplicationLevel.MAJORITY. */
- ALL = 1;
-
- /** Committed at majority peers.
- Note that ReplicationLevel.MAJORITY_COMMITTED implies ReplicationLevel.MAJORITY. */
- MAJORITY_COMMITTED = 2;
-
- /** Committed at all peers.
- Note that ReplicationLevel.ALL_COMMITTED implies ReplicationLevel.ALL
- and ReplicationLevel.MAJORITY_COMMITTED */
- ALL_COMMITTED = 3;
-}
-
-
-/** Role of raft peer */
-enum RaftPeerRole {
- LEADER = 0;
- CANDIDATE = 1;
- FOLLOWER = 2;
-}
-
-message WriteRequestTypeProto {
-}
-
-message MessageStreamRequestTypeProto {
- uint64 streamId = 1; // the id of this stream
- uint64 messageId = 2; // the message id within a particular stream.
- bool endOfRequest = 3;// Is this the end-of-request?
-}
-
-message DataStreamRequestTypeProto {
-}
-
-message ForwardRequestTypeProto {
-}
-
-message ReadRequestTypeProto {
-}
-
-message StaleReadRequestTypeProto {
- uint64 minIndex = 1;
-}
-
-message WatchRequestTypeProto {
- uint64 index = 1;
- ReplicationLevel replication = 2;
-}
-
-message RouteProto {
- RaftPeerIdProto peerId = 1;
- repeated RaftPeerIdProto successors = 2;
-}
-
-message RoutingTableProto {
- repeated RouteProto routes = 1;
-}
-
-// normal client request
-message RaftClientRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
- ClientMessageEntryProto message = 2;
-
- oneof Type {
- WriteRequestTypeProto write = 3;
- ReadRequestTypeProto read = 4;
- StaleReadRequestTypeProto staleRead = 5;
- WatchRequestTypeProto watch = 6;
- MessageStreamRequestTypeProto messageStream = 7;
- DataStreamRequestTypeProto dataStream = 8;
- ForwardRequestTypeProto forward = 9;
- }
-}
-
-message DataStreamPacketHeaderProto {
- enum Type {
- STREAM_HEADER = 0;
- STREAM_DATA = 1;
- }
-
- enum Option {
- SYNC = 0;
- CLOSE = 1;
- }
-
- bytes clientId = 1;
- Type type = 2;
- uint64 streamId = 3;
- uint64 streamOffset = 4;
- uint64 dataLength = 5;
- repeated Option options = 6;
-}
-
-message DataStreamRequestHeaderProto {
- DataStreamPacketHeaderProto packetHeader = 1;
-}
-
-message DataStreamReplyHeaderProto {
- DataStreamPacketHeaderProto packetHeader = 1;
- uint64 bytesWritten = 2;
- bool success = 3;
-
- repeated CommitInfoProto commitInfos = 15;
-}
-
-message NotLeaderExceptionProto {
- RaftPeerProto suggestedLeader = 1;
- repeated RaftPeerProto peersInConf = 2;
-}
-
-message LeaderNotReadyExceptionProto {
- RaftGroupMemberIdProto serverId = 1; // id of the leader
-}
-
-message NotReplicatedExceptionProto {
- uint64 callId = 1;
- ReplicationLevel replication = 2;
- uint64 logIndex = 3;
-}
-
-message StateMachineExceptionProto {
- string exceptionClassName = 1;
- string errorMsg = 2;
- bytes stacktrace = 3;
-}
-
-message AlreadyClosedExceptionProto {
- string exceptionClassName = 1;
- string errorMsg = 2;
- bytes stacktrace = 3;
-}
-
-message ThrowableProto {
- string className = 1;
- string errorMessage = 2;
- bytes stackTrace = 3;
- bytes cause = 4;
-}
-
-message RaftClientReplyProto {
- RaftRpcReplyProto rpcReply = 1;
- ClientMessageEntryProto message = 2;
-
- oneof ExceptionDetails {
- NotLeaderExceptionProto notLeaderException = 3;
- NotReplicatedExceptionProto notReplicatedException = 4;
- StateMachineExceptionProto stateMachineException = 5;
- LeaderNotReadyExceptionProto leaderNotReadyException = 6;
- AlreadyClosedExceptionProto alreadyClosedException = 7;
- ThrowableProto dataStreamException = 8;
- ThrowableProto leaderSteppingDownException = 9;
- ThrowableProto transferLeadershipException = 10;
- }
-
- uint64 logIndex = 14; // When the request is a write request and the reply is success, the log index of the transaction
- repeated CommitInfoProto commitInfos = 15;
-}
-
-// setConfiguration request
-message SetConfigurationRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
- repeated RaftPeerProto peers = 2;
-}
-
-// transfer leadership request
-message TransferLeadershipRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
- RaftPeerProto newLeader = 2;
-}
-
-// snapshot request
-message SnapshotManagementRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
-
- oneof Op {
- SnapshotCreateRequestProto create = 2;
- }
-}
-
-message SnapshotCreateRequestProto {
-
-}
-
-message StartLeaderElectionRequestProto {
- RaftRpcRequestProto serverRequest = 1;
- TermIndexProto leaderLastEntry = 2;
-}
-
-message StartLeaderElectionReplyProto {
- RaftRpcReplyProto serverReply = 1;
-}
-
-// A request to add a new group
-message GroupAddRequestProto {
- RaftGroupProto group = 1; // the group to be added.
-}
-
-message GroupRemoveRequestProto {
- RaftGroupIdProto groupId = 1; // the group to be removed.
- bool deleteDirectory = 2; // delete the directory for that group?
- bool renameDirectory = 3; // rename the directory if not deleted.
-}
-
-message GroupManagementRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
-
- oneof Op {
- GroupAddRequestProto groupAdd = 2;
- GroupRemoveRequestProto groupRemove = 3;
- }
-}
-
-// server info requests
-message GroupListRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
-}
-
-message GroupInfoRequestProto {
- RaftRpcRequestProto rpcRequest = 1;
- RaftGroupIdProto groupId = 2;
-}
-
-message ServerRpcProto {
- RaftPeerProto id = 1;
- uint64 lastRpcElapsedTimeMs = 2;
-}
-
-message LeaderInfoProto {
- repeated ServerRpcProto followerInfo = 1;
- uint64 term = 2;
-}
-
-message FollowerInfoProto {
- ServerRpcProto leaderInfo = 1;
- uint32 outstandingOp = 2;
-}
-
-message CandidateInfoProto {
- uint64 lastLeaderElapsedTimeMs = 1;
-}
-
-message RoleInfoProto {
- RaftPeerProto self = 1;
- RaftPeerRole role = 2;
- uint64 roleElapsedTimeMs = 3;
-
- oneof PeerInfo {
- LeaderInfoProto leaderInfo = 4;
- FollowerInfoProto followerInfo = 5;
- CandidateInfoProto candidateInfo = 6;
- }
-}
-
-message GroupListReplyProto {
- RaftRpcReplyProto rpcReply = 1;
- repeated RaftGroupIdProto groupId = 2;
-}
-
-message GroupInfoReplyProto {
- RaftRpcReplyProto rpcReply = 1;
- RaftGroupProto group = 2;
- RoleInfoProto role = 3;
- bool isRaftStorageHealthy = 4;
- repeated CommitInfoProto commitInfos = 5;
-}