http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-logservice/src/main/java/org/apache/ratis/logservice/api/LogStateMachine.java ---------------------------------------------------------------------- diff --git a/ratis-logservice/src/main/java/org/apache/ratis/logservice/api/LogStateMachine.java b/ratis-logservice/src/main/java/org/apache/ratis/logservice/api/LogStateMachine.java index 3444dd5..cdc17f3 100644 --- a/ratis-logservice/src/main/java/org/apache/ratis/logservice/api/LogStateMachine.java +++ b/ratis-logservice/src/main/java/org/apache/ratis/logservice/api/LogStateMachine.java @@ -23,8 +23,8 @@ import org.apache.ratis.server.RaftServer; import org.apache.ratis.server.impl.RaftServerConstants; import org.apache.ratis.server.protocol.TermIndex; import org.apache.ratis.server.storage.RaftStorage; -import org.apache.ratis.shaded.proto.RaftProtos; -import org.apache.ratis.shaded.proto.RaftProtos.LogEntryProto; +import org.apache.ratis.proto.RaftProtos; +import org.apache.ratis.proto.RaftProtos.LogEntryProto; import org.apache.ratis.statemachine.StateMachineStorage; import org.apache.ratis.statemachine.TransactionContext; import org.apache.ratis.statemachine.impl.BaseStateMachine; @@ -32,7 +32,7 @@ import org.apache.ratis.statemachine.impl.SimpleStateMachineStorage; import org.apache.ratis.statemachine.impl.SingleFileSnapshotInfo; import org.apache.ratis.util.AutoCloseableLock; -import org.apache.ratis.shaded.com.google.protobuf.InvalidProtocolBufferException; +import org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException; import java.io.*; import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-logservice/src/test/java/org/apache/ratis/logservice/api/TestLogMessage.java ---------------------------------------------------------------------- diff --git a/ratis-logservice/src/test/java/org/apache/ratis/logservice/api/TestLogMessage.java b/ratis-logservice/src/test/java/org/apache/ratis/logservice/api/TestLogMessage.java index fb74d64..d58bdda 100644 --- a/ratis-logservice/src/test/java/org/apache/ratis/logservice/api/TestLogMessage.java +++ b/ratis-logservice/src/test/java/org/apache/ratis/logservice/api/TestLogMessage.java @@ -22,8 +22,8 @@ import static org.junit.Assert.assertEquals; import org.apache.ratis.logservice.api.LogMessage.Type; import org.junit.Test; -import org.apache.ratis.shaded.com.google.protobuf.ByteString; -import org.apache.ratis.shaded.com.google.protobuf.InvalidProtocolBufferException; +import org.apache.ratis.thirdparty.com.google.protobuf.ByteString; +import org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException; public class TestLogMessage { http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-netty/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-netty/pom.xml b/ratis-netty/pom.xml index 2423b32..b573420 100644 --- a/ratis-netty/pom.xml +++ b/ratis-netty/pom.xml @@ -25,9 +25,12 @@ <dependencies> <dependency> - <artifactId>ratis-proto-shaded</artifactId> <groupId>org.apache.ratis</groupId> - <scope>provided</scope> + <artifactId>ratis-thirdparty</artifactId> + </dependency> + <dependency> + <artifactId>ratis-proto</artifactId> + <groupId>org.apache.ratis</groupId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java index ce5021a..373011e 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java @@ -17,15 +17,15 @@ */ package org.apache.ratis.netty; -import org.apache.ratis.shaded.io.netty.bootstrap.Bootstrap; -import org.apache.ratis.shaded.io.netty.channel.Channel; -import org.apache.ratis.shaded.io.netty.channel.ChannelFuture; -import org.apache.ratis.shaded.io.netty.channel.ChannelInitializer; -import org.apache.ratis.shaded.io.netty.channel.EventLoopGroup; -import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; -import org.apache.ratis.shaded.io.netty.channel.socket.nio.NioSocketChannel; -import org.apache.ratis.shaded.io.netty.handler.logging.LogLevel; -import org.apache.ratis.shaded.io.netty.handler.logging.LoggingHandler; +import org.apache.ratis.thirdparty.io.netty.bootstrap.Bootstrap; +import org.apache.ratis.thirdparty.io.netty.channel.Channel; +import org.apache.ratis.thirdparty.io.netty.channel.ChannelFuture; +import org.apache.ratis.thirdparty.io.netty.channel.ChannelInitializer; +import org.apache.ratis.thirdparty.io.netty.channel.EventLoopGroup; +import org.apache.ratis.thirdparty.io.netty.channel.socket.SocketChannel; +import org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.ratis.thirdparty.io.netty.handler.logging.LogLevel; +import org.apache.ratis.thirdparty.io.netty.handler.logging.LoggingHandler; import org.apache.ratis.util.LifeCycle; import org.apache.ratis.util.NetUtils; http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java index 20521b6..1c83629 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java @@ -18,16 +18,16 @@ package org.apache.ratis.netty; import org.apache.ratis.protocol.RaftPeer; -import org.apache.ratis.shaded.io.netty.channel.*; -import org.apache.ratis.shaded.io.netty.channel.nio.NioEventLoopGroup; -import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufDecoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufEncoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; -import org.apache.ratis.shaded.proto.RaftProtos.RaftRpcRequestProto; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerRequestProto; +import org.apache.ratis.thirdparty.io.netty.channel.*; +import org.apache.ratis.thirdparty.io.netty.channel.nio.NioEventLoopGroup; +import org.apache.ratis.thirdparty.io.netty.channel.socket.SocketChannel; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufDecoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufEncoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.apache.ratis.proto.RaftProtos.RaftRpcRequestProto; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerRequestProto; import org.apache.ratis.util.IOUtils; import org.apache.ratis.util.PeerProxyMap; import org.apache.ratis.util.ProtoUtils; @@ -39,7 +39,7 @@ import java.util.Queue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto.RaftNettyServerReplyCase.EXCEPTIONREPLY; +import static org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto.RaftNettyServerReplyCase.EXCEPTIONREPLY; public class NettyRpcProxy implements Closeable { public static class PeerMap extends PeerProxyMap<NettyRpcProxy> { http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java b/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java index 3bc2608..b763d58 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java @@ -21,12 +21,12 @@ import org.apache.ratis.client.impl.ClientProtoUtils; import org.apache.ratis.client.impl.RaftClientRpcWithProxy; import org.apache.ratis.netty.NettyRpcProxy; import org.apache.ratis.protocol.*; -import org.apache.ratis.shaded.proto.RaftProtos; -import org.apache.ratis.shaded.proto.RaftProtos.RaftClientRequestProto; -import org.apache.ratis.shaded.proto.RaftProtos.RaftRpcRequestProto; -import org.apache.ratis.shaded.proto.RaftProtos.GroupManagementRequestProto; -import org.apache.ratis.shaded.proto.RaftProtos.SetConfigurationRequestProto; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerRequestProto; +import org.apache.ratis.proto.RaftProtos; +import org.apache.ratis.proto.RaftProtos.RaftClientRequestProto; +import org.apache.ratis.proto.RaftProtos.RaftRpcRequestProto; +import org.apache.ratis.proto.RaftProtos.GroupManagementRequestProto; +import org.apache.ratis.proto.RaftProtos.SetConfigurationRequestProto; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerRequestProto; import java.io.IOException; http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java index f6fcbc6..adcd786 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java @@ -27,21 +27,21 @@ import org.apache.ratis.rpc.SupportedRpcType; import org.apache.ratis.server.RaftServer; import org.apache.ratis.server.RaftServerRpc; import org.apache.ratis.server.impl.RaftServerRpcWithProxy; -import org.apache.ratis.shaded.io.netty.bootstrap.ServerBootstrap; -import org.apache.ratis.shaded.io.netty.channel.*; -import org.apache.ratis.shaded.io.netty.channel.nio.NioEventLoopGroup; -import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; -import org.apache.ratis.shaded.io.netty.channel.socket.nio.NioServerSocketChannel; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufDecoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufEncoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; -import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; -import org.apache.ratis.shaded.io.netty.handler.logging.LogLevel; -import org.apache.ratis.shaded.io.netty.handler.logging.LoggingHandler; -import org.apache.ratis.shaded.proto.RaftProtos.*; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyExceptionReplyProto; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto; -import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerRequestProto; +import org.apache.ratis.thirdparty.io.netty.bootstrap.ServerBootstrap; +import org.apache.ratis.thirdparty.io.netty.channel.*; +import org.apache.ratis.thirdparty.io.netty.channel.nio.NioEventLoopGroup; +import org.apache.ratis.thirdparty.io.netty.channel.socket.SocketChannel; +import org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioServerSocketChannel; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufDecoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufEncoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import org.apache.ratis.thirdparty.io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.apache.ratis.thirdparty.io.netty.handler.logging.LogLevel; +import org.apache.ratis.thirdparty.io.netty.handler.logging.LoggingHandler; +import org.apache.ratis.proto.RaftProtos.*; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyExceptionReplyProto; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto; +import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerRequestProto; import org.apache.ratis.util.CodeInjectionForTesting; import org.apache.ratis.util.ProtoUtils; http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/pom.xml b/ratis-proto-shaded/pom.xml deleted file mode 100644 index 87e3766..0000000 --- a/ratis-proto-shaded/pom.xml +++ /dev/null @@ -1,482 +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>0.3.0-SNAPSHOT</version> - </parent> - - <artifactId>ratis-proto-shaded</artifactId> - <name>Apache Ratis Proto Shaded</name> - - <properties> - <maven.javadoc.skip>true</maven.javadoc.skip> - <!--The Default target dir--> - <classes.dir>${project.build.directory}/classes</classes.dir> - - <!--Version of grpc to be shaded --> - <shaded.grpc.version>1.14.0</shaded.grpc.version> - <!--Version of Netty to be shaded --> - <shaded.netty.version>4.1.27.Final</shaded.netty.version> - <netty-tcnative.version>2.0.8.Final</netty-tcnative.version> - </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> - <!--I want to override these in profile so define them - with variables up here--> - <sourceDirectory>${shaded.sources.dir}</sourceDirectory> - <outputDirectory>${classes.dir}</outputDirectory> - <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> - <excludes>org/apache/ratis/shaded/**/*</excludes> - </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> - </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>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <versionRange>[3.1.1,)</versionRange> - <goals> - <goal>shade</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore/> - </action> - </pluginExecution> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <versionRange>[1.7,)</versionRange> - <goals> - <goal>run</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore/> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - - <dependencies> - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>${shaded.protobuf.version}</version> - </dependency> - <dependency> - <groupId>com.google.protobuf.nano</groupId> - <artifactId>protobuf-javanano</artifactId> - <version>${shaded.protobuf-javanano.version}</version> - </dependency> - - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-netty</artifactId> - <version>${shaded.grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-protobuf</artifactId> - <version>${shaded.grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-stub</artifactId> - <version>${shaded.grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-context</artifactId> - <version>${shaded.grpc.version}</version> - </dependency> - - <dependency> - <groupId>com.google.auto</groupId> - <artifactId>auto-common</artifactId> - <version>0.8</version> - </dependency> - <dependency> - <groupId>com.google.auto.service</groupId> - <artifactId>auto-service</artifactId> - <version>1.0-rc4</version> - </dependency> - <dependency> - <groupId>com.google.auto.value</groupId> - <artifactId>auto-value-annotations</artifactId> - <version>1.6</version> - </dependency> - <dependency> - <groupId>com.google.auto.value</groupId> - <artifactId>auto-value</artifactId> - <version>1.6</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>24.1-jre</version> - </dependency> - - <dependency> - <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> - <version>3.0.2</version> - </dependency> - <dependency> - <groupId>com.google.errorprone</groupId> - <artifactId>error_prone_annotations</artifactId> - <version>2.2.0</version> - </dependency> - <dependency> - <groupId>com.google.j2objc</groupId> - <artifactId>j2objc-annotations</artifactId> - <version>1.3</version> - </dependency> - - <dependency> - <groupId>com.squareup</groupId> - <artifactId>javapoet</artifactId> - <version>1.10.0</version> - </dependency> - - <dependency> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-annotations</artifactId> - <version>1.16</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - <version>${shaded.netty.version}</version> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-tcnative</artifactId> - <version>${netty-tcnative.version}</version> - <classifier>${os.detected.classifier}</classifier> - </dependency> - - <dependency> - <groupId>org.jboss.marshalling</groupId> - <artifactId>jboss-marshalling</artifactId> - <version>1.4.11.Final</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>2.11.0</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.17</version> - </dependency> - - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jzlib</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>com.ning</groupId> - <artifactId>compress-lzf</artifactId> - <version>1.0.3</version> - </dependency> - <dependency> - <groupId>net.jpountz.lz4</groupId> - <artifactId>lz4</artifactId> - <version>1.3.0</version> - </dependency> - <dependency> - <groupId>org.bouncycastle</groupId> - <artifactId>bcpkix-jdk15on</artifactId> - <version>1.54</version> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.8.2</version> - </dependency> - - <dependency> - <groupId>org.eclipse.jetty.npn</groupId> - <artifactId>npn-api</artifactId> - <version>1.1.1.v20141010</version> - <scope>provided</scope> <!-- Provided by npn-boot --> - </dependency> - <dependency> - <groupId>org.eclipse.jetty.alpn</groupId> - <artifactId>alpn-api</artifactId> - <version>1.1.2.v20150522</version> - <scope>provided</scope> <!-- Provided by alpn-boot --> - </dependency> - - <dependency> - <groupId>org.jctools</groupId> - <artifactId>jctools-core</artifactId> - <version>2.1.2</version> - </dependency> - - <dependency> - <groupId>com.fasterxml</groupId> - <artifactId>aalto-xml</artifactId> - <version>1.0.0</version> - </dependency> - - <dependency> - <groupId>io.opencensus</groupId> - <artifactId>opencensus-api</artifactId> - <version>${io.opencensus.version}</version> - </dependency> - <dependency> - <groupId>io.opencensus</groupId> - <artifactId>opencensus-contrib-grpc-metrics</artifactId> - <version>${io.opencensus.version}</version> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>compile-protobuf</id> - <!-- - Shade and drop the generated java files under target/shaded-sources. - Run this profile/step everytime you change proto - files or update the protobuf version. - --> - <activation> - <property> - <name>!skipShade</name> - </property> - </activation> - <properties> - </properties> - <build> - <plugins> - <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>1</id> - <phase>generate-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - <execution> - <id>2</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> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>process-classes</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <shadeSourcesContent>true</shadeSourcesContent> - <createSourcesJar>true</createSourcesJar> - <!-- Replace the original artifact which is no good on its own --> - <shadedArtifactAttached>false</shadedArtifactAttached> - <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> - <relocations> - <relocation> - <pattern>com.google.api</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.api</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.cloud.audit</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.cloud.audit</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.common</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.common</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.logging.type</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.logging.type</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.longrunning</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.longrunning</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.protobuf</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.protobuf</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.rpc</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.rpc</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.thirdparty.publicsuffix</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.thirdparty.publicsuffix</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.type</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.type</shadedPattern> - </relocation> - - <relocation> - <pattern>io.grpc</pattern> - <shadedPattern>org.apache.ratis.shaded.io.grpc</shadedPattern> - </relocation> - <relocation> - <pattern>io.netty</pattern> - <shadedPattern>org.apache.ratis.shaded.io.netty</shadedPattern> - </relocation> - - <relocation> - <pattern>io.opencensus</pattern> - <shadedPattern>org.apache.ratis.shaded.io.opencensus</shadedPattern> - </relocation> - <relocation> - <pattern>com.google.gson</pattern> - <shadedPattern>org.apache.ratis.shaded.com.google.gson</shadedPattern> - </relocation> - </relocations> - - <artifactSet> - <includes> - <include>com.google.api.grpc:proto-google-common-protos</include> - <include>com.google.code.gson:gson</include> - <include>com.google.guava:guava</include> - <include>com.google.protobuf.nano:protobuf-javanano</include> - <include>com.google.protobuf:protobuf-java-util</include> - <include>com.google.protobuf:protobuf-java</include> - <include>io.grpc:grpc-context</include> - <include>io.grpc:grpc-core</include> - <include>io.grpc:grpc-netty</include> - <include>io.grpc:grpc-protobuf-lite</include> - <include>io.grpc:grpc-protobuf</include> - <include>io.grpc:grpc-stub</include> - <include>io.netty:netty-all</include> - <include>io.opencensus:opencensus-api</include> - <include>io.opencensus:opencensus-contrib-grpc-metrics</include> - </includes> - </artifactSet> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Examples.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Examples.proto b/ratis-proto-shaded/src/main/proto/Examples.proto deleted file mode 100644 index 6efef5b..0000000 --- a/ratis-proto-shaded/src/main/proto/Examples.proto +++ /dev/null @@ -1,67 +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.shaded.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; - } -} - -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; -} - -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; -} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Grpc.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Grpc.proto b/ratis-proto-shaded/src/main/proto/Grpc.proto deleted file mode 100644 index 5c4bbad..0000000 --- a/ratis-proto-shaded/src/main/proto/Grpc.proto +++ /dev/null @@ -1,54 +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.shaded.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 RPC to set new raft configuration - rpc setConfiguration(ratis.common.SetConfigurationRequestProto) - returns(ratis.common.RaftClientReplyProto) {} - - // A client-to-server stream RPC to append data - rpc append(stream ratis.common.RaftClientRequestProto) - returns (stream ratis.common.RaftClientReplyProto) {} -} - -service RaftServerProtocolService { - rpc requestVote(ratis.common.RequestVoteRequestProto) - returns(ratis.common.RequestVoteReplyProto) {} - - 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 add a new group - rpc groupManagement(ratis.common.GroupManagementRequestProto) - returns(ratis.common.RaftClientReplyProto) {} - - rpc serverInformation(ratis.common.ServerInformationRequestProto) - returns(ratis.common.ServerInformationReplyProto) {} -} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Hadoop.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Hadoop.proto b/ratis-proto-shaded/src/main/proto/Hadoop.proto deleted file mode 100644 index 0d6107e..0000000 --- a/ratis-proto-shaded/src/main/proto/Hadoop.proto +++ /dev/null @@ -1,51 +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.shaded.proto.hadoop"; -option java_outer_classname = "HadoopProtos"; -option java_generic_services = true; -option java_generate_equals_and_hash = true; -package ratis.hadoop; - -import "Raft.proto"; - -service CombinedClientProtocolService { - rpc submitClientRequest(ratis.common.RaftClientRequestProto) - returns(ratis.common.RaftClientReplyProto); - - rpc setConfiguration(ratis.common.SetConfigurationRequestProto) - returns(ratis.common.RaftClientReplyProto); - - rpc groupManagement(ratis.common.GroupManagementRequestProto) - returns(ratis.common.RaftClientReplyProto); - - rpc serverInformation(ratis.common.ServerInformationRequestProto) - returns(ratis.common.ServerInformationReplyProto); -} - -service RaftServerProtocolService { - rpc requestVote(ratis.common.RequestVoteRequestProto) - returns(ratis.common.RequestVoteReplyProto); - - rpc appendEntries(ratis.common.AppendEntriesRequestProto) - returns(ratis.common.AppendEntriesReplyProto); - - rpc installSnapshot(ratis.common.InstallSnapshotRequestProto) - returns(ratis.common.InstallSnapshotReplyProto); -} - http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Logservice.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Logservice.proto b/ratis-proto-shaded/src/main/proto/Logservice.proto deleted file mode 100644 index fd586bf..0000000 --- a/ratis-proto-shaded/src/main/proto/Logservice.proto +++ /dev/null @@ -1,35 +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.shaded.proto.logservice"; -option java_outer_classname = "LogServiceProtos"; -option java_generate_equals_and_hash = true; -package ratis.logservice; - -enum MessageType { - READ_REQUEST = 0; - READ_REPLY = 1; - WRITE = 2; -} - -message LogMessage { - MessageType type = 1; - string log_name = 2; - uint64 length = 3; - bytes data = 4; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Netty.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Netty.proto b/ratis-proto-shaded/src/main/proto/Netty.proto deleted file mode 100644 index 40aa498..0000000 --- a/ratis-proto-shaded/src/main/proto/Netty.proto +++ /dev/null @@ -1,52 +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.shaded.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.ServerInformationRequestProto serverInformationRequest = 7; - } -} - -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.ServerInformationReplyProto serverInfoReply = 5; - RaftNettyExceptionReplyProto exceptionReply = 6; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/RMap.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/RMap.proto b/ratis-proto-shaded/src/main/proto/RMap.proto deleted file mode 100644 index 33ce4fb..0000000 --- a/ratis-proto-shaded/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.shaded.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; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/proto/Raft.proto ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/proto/Raft.proto b/ratis-proto-shaded/src/main/proto/Raft.proto deleted file mode 100644 index 0a93e95..0000000 --- a/ratis-proto-shaded/src/main/proto/Raft.proto +++ /dev/null @@ -1,307 +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.shaded.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. IP address, hostname etc. -} - -message RaftGroupIdProto { - bytes id = 1; -} - -message RaftGroupProto { - RaftGroupIdProto groupId = 1; - repeated RaftPeerProto peers = 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 SMLogEntryProto { - // TODO: This is not super efficient if the SM itself uses PB to serialize its own data for a - // log entry. Data will be copied twice. We should directly support having any Message from SM - bytes data = 1; - - bytes stateMachineData = 2; // State machine specific data which is not written to log. - bool stateMachineDataAttached = 3; // set this flag when state machine data is attached. - uint64 serializedProtobufSize = 4; // size of the serialized LogEntryProto along with stateMachineData -} - -message LeaderNoOp { - // empty -} - -message LogEntryProto { - uint64 term = 1; - uint64 index = 2; - - oneof LogEntryBody { - SMLogEntryProto smLogEntry = 3; - RaftConfigurationProto configurationEntry = 4; - LeaderNoOp noOp = 5; - } - - // clientId and callId are used to rebuild the retry cache. They're not - // necessary for configuration change since re-conf is idempotent. - bytes clientId = 6; - uint64 callId = 7; -} - -message TermIndexProto { - uint64 term = 1; - uint64 index = 2; -} - -message RaftRpcRequestProto { - bytes requestorId = 1; - bytes replyId = 2; - RaftGroupIdProto raftGroupId = 3; - uint64 callId = 4; - - uint64 seqNum = 15; -} - -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; -} - -message RequestVoteRequestProto { - RaftRpcRequestProto serverRequest = 1; - uint64 candidateTerm = 2; - TermIndexProto candidateLastEntry = 3; -} - -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 - } - - RaftRpcReplyProto serverReply = 1; - uint64 term = 2; - uint64 nextIndex = 3; - AppendResult result = 4; -} - -message InstallSnapshotRequestProto { - RaftRpcRequestProto serverRequest = 1; - string requestId = 2; // an identifier for chunked-requests. - uint32 requestIndex = 3; // the index for this request chunk. Starts from 0. - RaftConfigurationProto raftConfiguration = 4; - uint64 leaderTerm = 5; - TermIndexProto termIndex = 6; - repeated FileChunkProto fileChunks = 7; - uint64 totalSize = 8; - bool done = 9; // whether this is the final chunk for the same req. -} - -message InstallSnapshotReplyProto { - RaftRpcReplyProto serverReply = 1; - uint32 requestIndex = 2; - uint64 term = 3; - InstallSnapshotResult result = 4; -} - -message ClientMessageEntryProto { - bytes content = 1; -} - -enum ReplicationLevel { - MAJORITY = 0; - ALL = 1; -} - - -/** Role of raft peer */ -enum RaftPeerRole { - LEADER = 0; - CANDIDATE = 1; - FOLLOWER = 2; -} - -message WriteRequestTypeProto { - ReplicationLevel replication = 1; -} - -message ReadRequestTypeProto { -} - -message StaleReadRequestTypeProto { - uint64 minIndex = 1; -} - -// normal client request -message RaftClientRequestProto { - RaftRpcRequestProto rpcRequest = 1; - ClientMessageEntryProto message = 2; - - oneof Type { - WriteRequestTypeProto write = 3; - ReadRequestTypeProto read = 4; - StaleReadRequestTypeProto staleRead = 5; - } -} - -message NotLeaderExceptionProto { - RaftPeerProto suggestedLeader = 1; - repeated RaftPeerProto peersInConf = 2; -} - -message NotReplicatedExceptionProto { - uint64 callId = 1; - ReplicationLevel replication = 2; - uint64 logIndex = 3; -} - -message StateMachineExceptionProto { - string exceptionClassName = 1; - string errorMsg = 2; - bytes stacktrace = 3; -} - -message RaftClientReplyProto { - RaftRpcReplyProto rpcReply = 1; - ClientMessageEntryProto message = 2; - - oneof ExceptionDetails { - NotLeaderExceptionProto notLeaderException = 3; - NotReplicatedExceptionProto notReplicatedException = 4; - StateMachineExceptionProto stateMachineException = 5; - } - - repeated CommitInfoProto commitInfos = 15; -} - -// setConfiguration request -message SetConfigurationRequestProto { - RaftRpcRequestProto rpcRequest = 1; - repeated RaftPeerProto peers = 2; -} - -// 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? -} - -message GroupManagementRequestProto { - RaftRpcRequestProto rpcRequest = 1; - - oneof Op { - GroupAddRequestProto groupAdd = 2; - GroupRemoveRequestProto groupRemove = 3; - } -} - -// server info request -message ServerInformationRequestProto { - RaftRpcRequestProto rpcRequest = 1; -} - -message ServerRpcProto { - RaftPeerProto id = 1; - uint64 lastRpcElapsedTimeMs = 2; -} - -message LeaderInfoProto { - repeated ServerRpcProto followerInfo = 1; -} - -message FollowerInfoProto { - ServerRpcProto leaderInfo = 1; - bool inLogSync = 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 ServerInformationReplyProto { - RaftRpcReplyProto rpcReply = 1; - RaftGroupProto group = 2; - RoleInfoProto role = 3; - bool isRaftStorageHealthy = 4; - repeated CommitInfoProto commitInfos = 5; -} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ManagedChannelProvider ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ManagedChannelProvider b/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ManagedChannelProvider deleted file mode 100644 index dbf2d84..0000000 --- a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ManagedChannelProvider +++ /dev/null @@ -1,16 +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. - -org.apache.ratis.shaded.io.grpc.netty.NettyChannelProvider http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.NameResolverProvider ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.NameResolverProvider b/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.NameResolverProvider deleted file mode 100644 index 439b1d8..0000000 --- a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.NameResolverProvider +++ /dev/null @@ -1,16 +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. - -org.apache.ratis.shaded.io.grpc.internal.DnsNameResolverProvider http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ServerProvider ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ServerProvider b/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ServerProvider deleted file mode 100644 index f251467..0000000 --- a/ratis-proto-shaded/src/main/resources/META-INF/services/org.apache.ratis.shaded.io.grpc.ServerProvider +++ /dev/null @@ -1,16 +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. - -org.apache.ratis.shaded.io.grpc.netty.NettyServerProvider http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-proto/pom.xml b/ratis-proto/pom.xml new file mode 100644 index 0000000..ffbfe70 --- /dev/null +++ b/ratis-proto/pom.xml @@ -0,0 +1,191 @@ +<?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>0.3.0-SNAPSHOT</version> + </parent> + + <artifactId>ratis-proto</artifactId> + <name>Apache Ratis Protocols</name> + + <properties> + <maven.javadoc.skip>true</maven.javadoc.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</artifactId> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/Examples.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/Examples.proto b/ratis-proto/src/main/proto/Examples.proto new file mode 100644 index 0000000..c2e2500 --- /dev/null +++ b/ratis-proto/src/main/proto/Examples.proto @@ -0,0 +1,67 @@ +/** + * 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; + } +} + +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; +} + +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; +} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/Grpc.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/Grpc.proto b/ratis-proto/src/main/proto/Grpc.proto new file mode 100644 index 0000000..3126fdb --- /dev/null +++ b/ratis-proto/src/main/proto/Grpc.proto @@ -0,0 +1,54 @@ +/** + * 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 RPC to set new raft configuration + rpc setConfiguration(ratis.common.SetConfigurationRequestProto) + returns(ratis.common.RaftClientReplyProto) {} + + // A client-to-server stream RPC to append data + rpc append(stream ratis.common.RaftClientRequestProto) + returns (stream ratis.common.RaftClientReplyProto) {} +} + +service RaftServerProtocolService { + rpc requestVote(ratis.common.RequestVoteRequestProto) + returns(ratis.common.RequestVoteReplyProto) {} + + 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 add a new group + rpc groupManagement(ratis.common.GroupManagementRequestProto) + returns(ratis.common.RaftClientReplyProto) {} + + rpc serverInformation(ratis.common.ServerInformationRequestProto) + returns(ratis.common.ServerInformationReplyProto) {} +} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/Hadoop.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/Hadoop.proto b/ratis-proto/src/main/proto/Hadoop.proto new file mode 100644 index 0000000..dd220ef --- /dev/null +++ b/ratis-proto/src/main/proto/Hadoop.proto @@ -0,0 +1,51 @@ +/** + * 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.hadoop"; +option java_outer_classname = "HadoopProtos"; +option java_generic_services = true; +option java_generate_equals_and_hash = true; +package ratis.hadoop; + +import "Raft.proto"; + +service CombinedClientProtocolService { + rpc submitClientRequest(ratis.common.RaftClientRequestProto) + returns(ratis.common.RaftClientReplyProto); + + rpc setConfiguration(ratis.common.SetConfigurationRequestProto) + returns(ratis.common.RaftClientReplyProto); + + rpc groupManagement(ratis.common.GroupManagementRequestProto) + returns(ratis.common.RaftClientReplyProto); + + rpc serverInformation(ratis.common.ServerInformationRequestProto) + returns(ratis.common.ServerInformationReplyProto); +} + +service RaftServerProtocolService { + rpc requestVote(ratis.common.RequestVoteRequestProto) + returns(ratis.common.RequestVoteReplyProto); + + rpc appendEntries(ratis.common.AppendEntriesRequestProto) + returns(ratis.common.AppendEntriesReplyProto); + + rpc installSnapshot(ratis.common.InstallSnapshotRequestProto) + returns(ratis.common.InstallSnapshotReplyProto); +} + http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/Logservice.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/Logservice.proto b/ratis-proto/src/main/proto/Logservice.proto new file mode 100644 index 0000000..8ea32f2 --- /dev/null +++ b/ratis-proto/src/main/proto/Logservice.proto @@ -0,0 +1,35 @@ +/** + * 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.logservice"; +option java_outer_classname = "LogServiceProtos"; +option java_generate_equals_and_hash = true; +package ratis.logservice; + +enum MessageType { + READ_REQUEST = 0; + READ_REPLY = 1; + WRITE = 2; +} + +message LogMessage { + MessageType type = 1; + string log_name = 2; + uint64 length = 3; + bytes data = 4; +} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/Netty.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/Netty.proto b/ratis-proto/src/main/proto/Netty.proto new file mode 100644 index 0000000..b817e8b --- /dev/null +++ b/ratis-proto/src/main/proto/Netty.proto @@ -0,0 +1,52 @@ +/** + * 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.ServerInformationRequestProto serverInformationRequest = 7; + } +} + +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.ServerInformationReplyProto serverInfoReply = 5; + RaftNettyExceptionReplyProto exceptionReply = 6; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/3b9d50de/ratis-proto/src/main/proto/RMap.proto ---------------------------------------------------------------------- diff --git a/ratis-proto/src/main/proto/RMap.proto b/ratis-proto/src/main/proto/RMap.proto new file mode 100644 index 0000000..43c9377 --- /dev/null +++ b/ratis-proto/src/main/proto/RMap.proto @@ -0,0 +1,189 @@ +/** + * 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; +}
