cadevue

カデュエ

Github Repository:
https://github.com/cadevue/draft

This program is a simple simulation of the Raft Consensus Protocol. The program is implemented in golang.

How to Run 🚀

Running the Server 🖥️

  • As first node (automatically become leader)

    go run server/server.go <ip server> <port server>
  • As follower node

    go run server/server.go <ip server> <port server> <ip leader server> <port leader server>

Running the Client 👨🏻‍💼

Method 1: Web Interface 🧩

go run web-client/web_client.go <ip server> <port server>

Method 2: The Terminal </>

go run client/client.go <ip server> <port server>

Notes: Make sure the leader server address is an active leader node, if not the terminal will prompt the correct leader address

Available Command

  1.  Ping
    Checking the server connection.

    ping

    The server will response with:

    Pong!

  1.  Get
    Get a value with a key.

    get <key>

    The server will response with:

    <value>


    If the key doesn’t exist, it will return empty string.


  1.  Set
    Set new value for specific key.

    set <key> <value>

    The server will response with:

    OK


    If the key doesn’t exist, new pair will be created. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.


  1.  Strln
    Get the length of a value with a key.

    strln <key>

    The server will response with:

    <value length>


    If the key doesn’t exist, it will return -1.


  1.  Del
    Delete value for specific key.

    del <key>

    The server will response with:

    <deleted value>


    If the key doesn’t exist, it will return empty string. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.


  1.  Append
    Append value for specific key.

    append <key> <value>

    The server will response with:

    OK


    If the key doesn’t exist, new pair will be created. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.


  1.  Switch
    Switch server port.

    switch <ip server> <port server>

    The server will response with:

    OK

  1.  Request Log
    Get server’s log.

    request_log

    The server will response with:

    <server log>

Contributors

Made by Team dRaft

  1.  Naufal Syifa Firdaus (nomsf)
  2.  Louis Caesa Kesuma (Ainzw0rth)
  3.  Husnia Munzayana (munzayanahusn)
  4.  Addin Munawwar Yusuf (cadevue)
  5.  Puti Nabilla Aidira (Putinabillaa)