Skip to content

Commit

Permalink
Initial code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnp committed Jan 31, 2017
2 parents d960d1e + d16c5c6 commit 813db4b
Show file tree
Hide file tree
Showing 231 changed files with 35,102 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.DS_Store
*.iml
*.ipr
*.iws
*.orig
*.rej
**/.keep
*.sdf
*.suo
*.vcxproj.user
.idea
.svn
.classpath
.project
.settings
target
build
11 changes: 11 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
We shade protobuf and other libraries such as Netty, gRPC and Hadoop
so that applications using Raft may use protobuf and other libraries with versions different
from the versions used here.

The library requires the shaded sources for compilation. To generate them,
run the following command under `raft-proto-shaded/`

- `mvn package -Dcompile-protobuf -DskipTests`

Then run your normal mvn commands to build the whole library.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ratis
Ratis is a java library that implements the RAFT protocol[1]. The Raft paper can be accessed at [this link] (https://raft.github.io/raft.pdf). The paper introduces Raft and states its motivations in following words:
> Raft is a consensus algorithm for managing a replicated log. It produces a result equivalent to (multi-)Paxos, and it is as efficient as Paxos, but its structure is different from Paxos; this makes Raft more understandable than Paxos and also provides a better foundation for building practical systems.
Ratis aims to make raft available as a java library that can be used by any system that needs to use a replicated log. It provides pluggability for state machine implementations to manage replicated states. It also provides pluggability for Raft log, and rpc implementations to make it easy for integration with other projects. Another important goal is to support high throughput data ingest so that it can be used for more general data replication use cases.


# Reference
[1] _Diego Ongaro and John Ousterhout. 2014. In search of an understandable consensus algorithm. In Proceedings of the 2014 USENIX conference on USENIX Annual Technical Conference (USENIX ATC'14), Garth Gibson and Nickolai Zeldovich (Eds.). USENIX Association, Berkeley, CA, USA, 305-320._

252 changes: 252 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<?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>

<artifactId>ratis-main</artifactId>
<groupId>org.apache.ratis</groupId>
<version>1.0-SNAPSHOT</version>
<name>Ratis Main</name>
<packaging>pom</packaging>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
<maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
<maven-bundle-plugin.version>2.5.3</maven-bundle-plugin.version>
<maven-checkstyle-plugin.version>2.15</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>2.5</maven-clean-plugin.version>
<maven-clover2-plugin.version>3.3.0</maven-clover2-plugin.version>
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
<maven-deploy-plugin.version>2.8.1</maven-deploy-plugin.version>
<maven-enforcer-plugin.version>1.3.1</maven-enforcer-plugin.version>
<maven-install-plugin.version>2.5.1</maven-install-plugin.version>
<maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>2.9.1</maven-javadoc-plugin.version>
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
<maven-site-plugin.version>3.5</maven-site-plugin.version>
<maven-source-plugin.version>2.3</maven-source-plugin.version>
<maven-stylus-skin.version>1.5</maven-stylus-skin.version>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
<maven-xolstice-plugin.version>0.5.0</maven-xolstice-plugin.version>

<apache-rat-plugin.version>0.10</apache-rat-plugin.version>
<wagon-ssh.version>1.0</wagon-ssh.version>

<shell-executable>bash</shell-executable>
<!-- define the Java language version used by the compiler -->
<javac.version>1.8</javac.version>
</properties>

<modules>
<module>ratis-proto-shaded</module>
<module>ratis-project</module>
</modules>

<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.2,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${javac.version}</source>
<target>${javac.version}</target>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<useIncrementalCompilation>false</useIncrementalCompilation>
<compilerArgument>-Xlint:-options</compilerArgument>
</configuration>
</plugin>
<!-- Make a jar and put the sources in the jar.
In the parent pom, so submodules will do the right thing. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>prepare-package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<failIfNoTests>false</failIfNoTests>
<reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<argLine>-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError</argLine>
<systemPropertyVariables>
<ratis.log.dir>${project.build.directory}/log</ratis.log.dir>
<ratis.tmp.dir>${project.build.directory}/tmp</ratis.tmp.dir>

<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
</systemPropertyVariables>
<includes>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/Test*$*.java</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>${apache-rat-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
<dependencies>
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${wagon-ssh.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>${maven-clover2-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
</plugin>

</plugins>


</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>clean</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>pre-clean</phase>
</execution>
<execution>
<id>default</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>.gitattributes</exclude>
<exclude>.gitignore</exclude>
<exclude>.git/**</exclude>
<exclude>**/*.swp</exclude>
<exclude>**/*.iml</exclude>
<exclude>.idea/**</exclude>
<exclude>**/target/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<inherited>true</inherited>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
54 changes: 54 additions & 0 deletions ratis-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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-project-dist</artifactId>
<groupId>org.apache.ratis</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../ratis-project-dist</relativePath>
</parent>

<artifactId>ratis-client</artifactId>
<name>Ratis Client</name>

<dependencies>
<dependency>
<artifactId>ratis-proto-shaded</artifactId>
<groupId>org.apache.ratis</groupId>
<scope>provided</scope>
</dependency>

<dependency>
<artifactId>ratis-common</artifactId>
<groupId>org.apache.ratis</groupId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit 813db4b

Please sign in to comment.