Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/poorlydefinedbehaviour/ocaml-raft
Distributed key value store built on top of a Raft implementation with eio from scratch.
https://github.com/poorlydefinedbehaviour/ocaml-raft
Last synced: 14 days ago
JSON representation
Distributed key value store built on top of a Raft implementation with eio from scratch.
- Host: GitHub
- URL: https://github.com/poorlydefinedbehaviour/ocaml-raft
- Owner: PoorlyDefinedBehaviour
- Created: 2023-12-09T04:10:54.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-02T01:12:01.000Z (6 months ago)
- Last Synced: 2024-06-02T03:31:28.537Z (6 months ago)
- Language: OCaml
- Homepage:
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About
Distributed key value store built on top of a Raft implementation with [eio](https://github.com/ocaml-multicore/eio) from scratch. I started working on this to practice OCaml. I'll stop working on it as soon as I lose interest.
Not every module uses eio because I started without it.
## Running locally
Start the replicas.
```
# Terminal 1
ID=0 dune exec server# Terminal 2
ID=1 dune exec server# Terminal 3
ID=2 dune exec server
```Sends requests
```
# Replica 1
curl -XPOST http://localhost:8100 -d '{"key": "a", "value": "1"}'
curl http://localhost:8100/key# Replica 2
curl -XPOST http://localhost:8101 -d '{"key": "a", "value": "1"}'
curl http://localhost:8101/key# Replica 3
curl -XPOST http://localhost:8102 -d '{"key": "a", "value": "1"}'
curl http://localhost:8102/key
```## TODO
- After an user request is received and replicated to a quorum, a response must be sent to the client.
- Check that the replica append one entry to its log when it becomes a leader
- Use eio in the network and storage layer
- Check that data is correctly stored in the state file (look at the file contents and ensure there's nothing weird stored in there)
- Heartbeat timeout handling. Reset timeout
- Persist last applied index to avoid reapplying the whole log
- Handle exceptions
- Stop using lists
- Remove completed todos
- Clean up inflight requests, add request queue