forked from hazelcast/hazelcast
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,006 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
<!-- | ||
~ Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved. | ||
~ | ||
~ 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. | ||
--> | ||
|
||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<name>hazelcast raft</name> | ||
<artifactId>hazelcast-raft</artifactId> | ||
<description>Hazelcast Raft Module</description> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>com.hazelcast</groupId> | ||
<artifactId>hazelcast-root</artifactId> | ||
<version>3.10-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<!-- needed for checkstyle/findbugs --> | ||
<main.basedir>${project.parent.basedir}</main.basedir> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>pl.project13.maven</groupId> | ||
<artifactId>git-commit-id-plugin</artifactId> | ||
<version>${maven.git.commit.id.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>revision</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<useNativeGit>false</useNativeGit> | ||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory> | ||
<failOnNoGitDirectory>false</failOnNoGitDirectory> | ||
<abbrevLength>7</abbrevLength> | ||
<gitDescribe> | ||
<skip>true</skip> | ||
</gitDescribe> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-maven-plugin</artifactId> | ||
<version>${maven.animal.sniffer.plugin.version}</version> | ||
<configuration> | ||
<signature> | ||
<groupId>org.codehaus.mojo.signature</groupId> | ||
<artifactId>java16</artifactId> | ||
<version>1.0</version> | ||
</signature> | ||
<ignores> | ||
<ignore>sun.misc.Unsafe</ignore> | ||
</ignores> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>source-java6-check</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven.source.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<version>${maven.bundle.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>bundle-manifest</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>manifest</goal> | ||
</goals> | ||
<configuration> | ||
<instructions> | ||
<Bundle-Activator>com.hazelcast.osgi.impl.Activator</Bundle-Activator> | ||
<Export-Package> | ||
com.hazelcast.* | ||
</Export-Package> | ||
<Import-Package> | ||
!org.junit, | ||
!com.hazelcast.*, | ||
!com.eclipsesource.json, | ||
sun.misc;resolution:=optional, | ||
javax.cache;resolution:=optional, | ||
javax.cache.*;resolution:=optional, | ||
org.apache.log4j;resolution:=optional, | ||
org.apache.log4j.spi;resolution:=optional, | ||
org.apache.logging.log4j;resolution:=optional, | ||
org.apache.logging.log4j.spi;resolution:=optional, | ||
org.slf4j;resolution:=optional, | ||
org.codehaus.groovy.jsr223;resolution:=optional, | ||
org.jruby.embed.jsr223;resolution:=optional, | ||
* | ||
</Import-Package> | ||
</instructions> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>${maven.jar.plugin.version}</version> | ||
<configuration> | ||
<archive> | ||
<index>true</index> | ||
<compress>true</compress> | ||
<manifest> | ||
<mainClass>com.hazelcast.core.server.StartServer</mainClass> | ||
<!--<addClasspath>true</addClasspath>--> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> | ||
</manifest> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
<excludes> | ||
<exclude>**/*.html</exclude> | ||
<exclude>**/*.sh</exclude> | ||
<exclude>**/*.bat</exclude> | ||
<exclude>META-INF/services/javax.annotation.processing.Processor</exclude> | ||
</excludes> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
<!--Need to add sources for this test jar to Maven central. partic TestHazelcastInstanceFactory. Brian request. --> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<phase>clean</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/Generated*</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.hazelcast</groupId> | ||
<artifactId>hazelcast</artifactId> | ||
<version>${project.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
hazelcast-raft/src/main/java/com/hazelcast/raft/RaftConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.hazelcast.raft; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* TODO: Javadoc Pending... | ||
* | ||
* @author mdogan 30.10.2017 | ||
*/ | ||
public class RaftConfig { | ||
|
||
private Collection<String> addresses; | ||
|
||
public Collection<String> getAddresses() { | ||
return addresses; | ||
} | ||
|
||
public void setAddresses(Collection<String> addresses) { | ||
this.addresses = addresses; | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
hazelcast-raft/src/main/java/com/hazelcast/raft/RaftContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.hazelcast.raft; | ||
|
||
import com.hazelcast.nio.Address; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* TODO: Javadoc Pending... | ||
* | ||
*/ | ||
public class RaftContext { | ||
|
||
final String name; | ||
final Collection<Address> members; | ||
|
||
private RaftRole role = RaftRole.FOLLOWER; | ||
private int term; | ||
private Address leader; | ||
|
||
private Address votedFor; | ||
private int lastVoteTerm; | ||
|
||
public RaftContext(String name, Collection<Address> members) { | ||
this.name = name; | ||
this.members = members; | ||
} | ||
|
||
public String name() { | ||
return name; | ||
} | ||
|
||
public void role(RaftRole role) { | ||
this.role = role; | ||
} | ||
|
||
public Collection<Address> members() { | ||
return members; | ||
} | ||
|
||
public RaftRole role() { | ||
return role; | ||
} | ||
|
||
public int term() { | ||
return term; | ||
} | ||
|
||
public int incTerm() { | ||
return ++term; | ||
} | ||
|
||
public Address leader() { | ||
return leader; | ||
} | ||
|
||
public void persistVote(int term, Address address) { | ||
this.lastVoteTerm = term; | ||
this.votedFor = address; | ||
} | ||
|
||
public void term(int term) { | ||
this.term = term; | ||
} | ||
|
||
public int lastVoteTerm() { | ||
return lastVoteTerm; | ||
} | ||
|
||
public Address votedFor() { | ||
return votedFor; | ||
} | ||
|
||
public int lastLogTerm() { | ||
return 0; | ||
} | ||
|
||
public int lastLogIndex() { | ||
return 0; | ||
} | ||
|
||
public void leader(Address address) { | ||
leader = address; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.hazelcast.raft; | ||
|
||
/** | ||
* TODO: Javadoc Pending... | ||
* | ||
* @author mdogan 30.10.2017 | ||
*/ | ||
public class RaftLog { | ||
} |
Oops, something went wrong.