WARNING: When I wrote this, only God and I understood what I was doing. Now, God only knows. It's a working implementation of Wiskey paper but it doesn't support a great concurrency control. also I didn't find an explanation on how Wiskey deletes unused keys from sstables so I made my custom ugly implementation(ask how it works if you are interested) Code is test covered , however, as it was my first big GoLang project I didn't really know how to organize it so right now code is unmaintainable
Golang implementation of a Wiskey paper
Dead simple lsm implementation which stores values in the vlog which decreases write amplification of lsm tree during merging
- SSTable
- Create sstable
- Read from sstable
- Memtable(in memory redblack tree that stores the data and flushes it once
memory is full)
- Put
- Delete
- Get
- Lsm tree
- Put
- Get
- Delete
- Http interface
- Http Get
- Http Put
- Http Delete
- Crash recovery
- Store the last head position in the separate file
- Store al values from head to tail into the memtable during recovery
- Merge sstable files
- Cli interface
- specify sstable path
- specify vlog path
- specify checkpoint path
- specify memtable size
- Reclaim space
- Merge sstables
- Garbage collect vlog
In order to install the binary run go get github.com/strogiyotec/go-wiskey
,
it will be installed in $HOME/go/bin/wiskey
In order to start the app run
wiskey -s ../go-wiskey/sstable -v vlog -c checkpoint -m 20
where :
-s
- directory with sstables-v
- path to vlog file(vlog doesn't have to exist)-c
- path to checkpoint (checkpoint doesn't have to exist)-m
- memtable size in bytes(the size of in memory red black tree that keeps keys , when full will flush this tree to sstable)
It will start an http server
In order to GET/UPDATE/DELETE you can use http endpoints
- Save key value
curl -X POST -H "Content-Type: application/json" -d '{"value":"Developer"}' http://localhost:8080/anita
it will save valueDeveloper
with a keyanita
- Get by key -
curl -i localhost:8080/fetch/anita
- Delete by key -
curl -X DELETE localhost:8080/anita