https://github.com/keyan/simpledb
Simple persistent key-value database from scratch
https://github.com/keyan/simpledb
Last synced: about 1 year ago
JSON representation
Simple persistent key-value database from scratch
- Host: GitHub
- URL: https://github.com/keyan/simpledb
- Owner: keyan
- License: mit
- Created: 2020-12-11T23:22:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-13T02:50:34.000Z (over 5 years ago)
- Last Synced: 2023-02-27T03:02:43.922Z (over 3 years ago)
- Language: Go
- Homepage:
- Size: 3.84 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simpleDB
A persistent key-value store implementation from the paper ["A simple and efficient implementation of a small database"][paper].
Data is stored in a builtin `map` and a write-ahead-log is used to ensure atomic updates. Restarts/crashes will use any available logs and checkpoints stored in `./data` to reload state during startup. The structure of this directory closely matches the implementation guidelines in the end of Section 3 of the paper.
The client/server communicatation uses [`gob`][gob] over HTTP.
## Usage
Start the DB server with:
```
$ make server
```
Commands can be issued using the client CLI:
```
$ make client
-- SimpleDB CLI --
Available commands:
help
exit or CTRL+C
get
set
delete
simpleDB >
```
## Automated Run
You can also run an automated simulation which forks and runs a separate server process and issues random client load. A very simple form of process supervision of the server allows for random crashing. The intention of this is to test fault-tolerance and also ensure race conditions are not possible with many concurrent operations. This runs indefinitely and needs to be killed to exit. Start with:
```
make sim
```
[paper]: https://dl.acm.org/doi/10.1145/41457.37517
[gob]: https://golang.org/pkg/encoding/gob