LokiKV is intended to be a simple to use in memory Key-Value Store that can also persist data on disk. This project is specifically for learning purposes only.
To try out loki-kv you can follow these steps:
git clone /~https://github.com/destrex271/LokiKV
cargo run --bin server-db # in a separate terminal
# runs on localhost:8765 by default
# in a separate terminal to start CLI
cargo run --bin client -- localhost 8765
- Blob:
"[BLOB_BEGINS]data of blob[BLOB_ENDS]"
- Integer
- Boolean
- Float
- String
- Set key values
- Get value for key
- Print all values in collection as a string
- Create multiple types of collections
(\c_bcol, \c_hcol, \c_bcust)
- Select Collections
- List all available collections
LokiQL is a custom query language for interacting with the LokiKV database. This document describes the supported commands and their syntax.
- Create multiple Collections(similar to tables)
- Collections are of the following types:
- Hashmap
- BTreeMap
- Custom BTree
- List collections
- Select one collection at a time
- Spaces, newlines, carriage returns, and tabs are ignored where applicable.
- Integer (
INT
): Signed or unsigned integer numbers. - Float (
FLOAT
): Signed or unsigned floating point numbers. - Boolean (
BOOL
):true
orfalse
. - String (
STRING
): Enclosed in single quotes ('example'
). - Blob (
BLOB
): Enclosed in[BLOB_BEGINS]
and[BLOB_ENDS]
.
- ID: Any string without whitespace.
LokiQL supports three types of commands:
Command | Syntax |
---|---|
SET |
`SET <STRING |
SET mykey 'hello'
SET count 42
SET enabled true
SET temperature 98.6
SET file [BLOB_BEGINS]aGVsbG8=[BLOB_ENDS]
Command | Syntax |
---|---|
GET |
GET <ID> |
INCR |
INCR <ID> |
DECR |
DECR <ID> |
/c_hcol |
/c_hcol <ID> |
/c_bcol |
/c_bcol <ID> |
/c_bcust |
/c_bcust <ID> |
/selectcol |
/selectcol <ID> |
GET mykey
INCR count
DECR count
/selectcol users
Command | Syntax |
---|---|
DISPLAY |
DISPLAY |
/getcur_colname |
/getcur_colname |
/listcolnames |
/listcolnames |
DISPLAY
/getcur_colname
/listcolnames
A LokiQL command file follows this structure:
COMMAND
COMMAND
COMMAND
COMMAND; COMMAND; COMMAND;
SET mykey 'hello'
GET mykey
DISPLAY
Multiple command in a single line must be separated by ;
.
Single commands don't need to follow a ;
- Add support for distributed setup via Paxos Algorithm
- Need to add persistence feature