-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting started in Java #4
Comments
+1 Thanks. |
Hi ejemba, The getting started is pretty much the same as in Scala with some minor changes: If you are using Maven, you have to get the library dependency from Maven central: <dependency>
<groupId>io.ckite</groupId>
<artifactId>ckite</artifactId>
<version>0.1.6</version>
</dependency> Then you have to instantiate a builder and configure it following the instructions in the README. Example: Raft raft = new RaftBuilder().stateMachine(new MyStateMachine())
.listenAddress("someListenAddress").dataDir("someDataDir").build(); You'll have to create your StateMachine class implementing the StateMachine interface: public class MyStateMachine implements StateMachine {
@Override
public void deserialize(ByteBuffer byteBuffer) {
}
@Override
public ByteBuffer serialize() {
//TODO
}
@Override
public Object applyWrite(long index, WriteCommand<?> write) {
//TODO
}
@Override
public Object applyRead(ReadCommand<?> read) {
//TODO
}
@Override
public long lastAppliedIndex() {
//TODO
}
} Follow the instructions in README to know the semantics of each configuration in the builder and the methods to be implemented in your state machine. Just curious. I would like to know about how are you planning to use CKite, what kind of application are you working on so I can help you. Btw, I'm working on a new version of CKite with a modularized architecture so different log storages and rpc mechanisms can be plugged into CKite. I'm planning to implement a Chronicle based log storage. Hope this helps. Let me know you have more questions. Thanks! |
Hi @pablosmedina thank you for the sample. I'll try this asap . In fact, I'm planning to implement a demo of my java lib nuun.io an IOC microlib (https://github.com/nuun-io/kernel ) by implementing a simple framework around raft consensus algo, so I had to choose a viable java/jvm raft implementation. Nuun is quite new in the place so I have to find usable use cases to demonstrate its "awesomeness" (this is the difficult part) . So make raft algo even more easy to access can be the use case ^^ |
Write simple Getting started instructions for Java including:
The text was updated successfully, but these errors were encountered: