Skip to content
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

Open
pablosmedina opened this issue Feb 12, 2014 · 3 comments
Open

Getting started in Java #4

pablosmedina opened this issue Feb 12, 2014 · 3 comments

Comments

@pablosmedina
Copy link
Owner

Write simple Getting started instructions for Java including:

  1. repo location (sonatype for now, will be maven central)
  2. artifact coordinates for Maven
  3. start a simple cluster
@ejemba
Copy link

ejemba commented Feb 6, 2015

+1
I'm interested in using your raft implementation from java.
can you help me with this ?

Thanks.

@pablosmedina
Copy link
Owner Author

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!

@ejemba
Copy link

ejemba commented Feb 6, 2015

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 ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants