Repository: incubator-ratis Updated Branches: refs/heads/master 48fbe431a -> 4010e7c47
RATIS-51. Add ratis-replicated-map module. Contributed by Enis Soztutar. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/4010e7c4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/4010e7c4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/4010e7c4 Branch: refs/heads/master Commit: 4010e7c47cc98bdbc95edd12c19bd34a3f877815 Parents: 48fbe43 Author: Jing Zhao <[email protected]> Authored: Thu Mar 30 13:41:37 2017 -0700 Committer: Jing Zhao <[email protected]> Committed: Thu Mar 30 13:41:37 2017 -0700 ---------------------------------------------------------------------- pom.xml | 14 +++ ratis-assembly/pom.xml | 10 ++ ratis-replicated-map/README.md | 22 ++++ ratis-replicated-map/pom.xml | 114 +++++++++++++++++++ .../src/test/resources/log4j.properties | 18 +++ 5 files changed, 178 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/4010e7c4/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index ea4f72b..a482632 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,7 @@ <module>ratis-hadoop-shaded</module> <module>ratis-netty</module> <module>ratis-proto-shaded</module> + <module>ratis-replicated-map</module> <module>ratis-server</module> </modules> @@ -271,6 +272,19 @@ </dependency> <dependency> + <artifactId>ratis-replicated-map</artifactId> + <groupId>org.apache.ratis</groupId> + <version>${project.version}</version> + </dependency> + <dependency> + <artifactId>ratis-replicated-map</artifactId> + <groupId>org.apache.ratis</groupId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> <artifactId>ratis-server</artifactId> <groupId>org.apache.ratis</groupId> <version>${project.version}</version> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/4010e7c4/ratis-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-assembly/pom.xml b/ratis-assembly/pom.xml index 638b091..bde5bc1 100644 --- a/ratis-assembly/pom.xml +++ b/ratis-assembly/pom.xml @@ -195,6 +195,16 @@ </dependency> <dependency> + <artifactId>ratis-replicated-map</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-replicated-map</artifactId> + <groupId>org.apache.ratis</groupId> + <type>test-jar</type> + </dependency> + + <dependency> <artifactId>ratis-server</artifactId> <groupId>org.apache.ratis</groupId> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/4010e7c4/ratis-replicated-map/README.md ---------------------------------------------------------------------- diff --git a/ratis-replicated-map/README.md b/ratis-replicated-map/README.md new file mode 100644 index 0000000..7c333de --- /dev/null +++ b/ratis-replicated-map/README.md @@ -0,0 +1,22 @@ +Overview +======== +Ratis replicated map is an implementation of a sorted map (think TreeMap) as +a replicated state machine. This is not under examples because it is intended +to be used in production where a simple in-memory map is sufficient to hold the +data. The data is fully cached in memory, but it is still durable since raft +log is used as a replicated log, and data is snapshotted periodically. + + +The replicated map (RMap) is not only the state machine implementation, but +all of the remaining code, including the client and querying capabilities which +is built on top of the other modules. In that sense, it is dog-fooding the ratis +library to implement an end-to-end solution for a replicated in-memory data store. + +Replicated maps are conceptually similar to ZooKeeper/Etcd/LogCabin where the data +is hosted in a known cluster configuration and is not sharded. All the servers +in the cluster participate in a single RAFT ring. + +The data model is that users can create independent RMap instances in the cluster +and read / write or scan the data as key value pairs in those replicated maps. A +replicated map named the meta map contains information about all of the other maps +in the cluster. http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/4010e7c4/ratis-replicated-map/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-replicated-map/pom.xml b/ratis-replicated-map/pom.xml new file mode 100644 index 0000000..cd22490 --- /dev/null +++ b/ratis-replicated-map/pom.xml @@ -0,0 +1,114 @@ +<?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.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <artifactId>ratis-replicated-map</artifactId> + <name>Ratis Replicated Map</name> + <version>0.1-SNAPSHOT</version> + + <dependencies> + <dependency> + <artifactId>ratis-proto-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-common</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-common</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <artifactId>ratis-client</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-client</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <artifactId>ratis-server</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-server</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <artifactId>ratis-hadoop</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> + <dependency> + <artifactId>ratis-hadoop</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <artifactId>ratis-grpc</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>provided</scope> + </dependency> + <dependency> + <artifactId>ratis-grpc</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <artifactId>ratis-netty</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>provided</scope> + </dependency> + <dependency> + <artifactId>ratis-netty</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/4010e7c4/ratis-replicated-map/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/ratis-replicated-map/src/test/resources/log4j.properties b/ratis-replicated-map/src/test/resources/log4j.properties new file mode 100644 index 0000000..ced0687 --- /dev/null +++ b/ratis-replicated-map/src/test/resources/log4j.properties @@ -0,0 +1,18 @@ +# 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. +# log4j configuration used during build and unit tests + +log4j.rootLogger=info,stdout +log4j.threshold=ALL +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
