-
Database server under 1000 lines of code
-
Key/Value support
-
Distributed DB server using uwsgi
-
Initial build in Python - future build in Go to improve performance
-
Server will respond to following commands
- GET
- SET
- DELETE
- FLUSH
- MGET ...
- MSET ...
-
Supported data types
- Strings and Binary Data
- Numbers
- NULL
- Arrays (which may be nested)
- Dictionaries (which may be nested)
- Error messages
-
Initially stored in memory - future in the file system
- Master volume will keep track of the stored keys
- Child volumes will store the actual data
Data-Type | Prefix | Structure | Example |
---|---|---|---|
Simple String | + | +{string data}\r\n | +this is a simple string\r\n |
Error | - | -{error message}\r\n | -ERR unknown command "FLUHS"\r\n |
Integer | : | :{the number}\r\n | :1337\r\n |
Binary | $ | ${number of bytes}\r\n{data}\r\n | $6\r\n foobar\r\n |
Array | * | *{number of elements}\r\n{0 or more of above}\r\n | *3\r\n +a simple string element\r\n :12345\r\n $7\r\n testing\r\n |
Dictionary | % | %{number of keys}\r\n{0 or more of above}\r\n | %3\r\n +key1\r\n +value1\r\n +key2\r\n *2\r\n 1 +value2-0\r\n +value2-1\r\n :3\r\n $7\r\n testing\r\n |
NULL | $ | $-1\r\n (string of length -1) | $-1\r\n |