NonRelDB is an in-memory database that persists on disk. The data model is key-value. Written on golang.
First of all you need to install git and docker Then you need to clone repository on your pc from github
git clone https://github.com/777777miSSU7777777/NonRelDB.git
In cloned repository you will find Makefile with following targets:
- build-server - builds server's executable binary file.
- build-client - builds client's executable binary file.
- build - builds docker container with server's & client's binaries. Also includes go vet, goimports and golint. Entrypoint is server with default configuration.
- check - runs subsequently go vet, goimports and golint on the project. Fails if any error occurs.
- test - runs unit & integration tests. Fail if any test don't pass.
- run - runs built docker container.
- -host -h - defines host ip (default is 127.0.0.1)
- -port -p - defines host port (default is 9090)
- -mode -m - defines storage location (default is "memory"). Possible options are "memory" and "disk".
- -location -l - defines storage location on disk (default is "storage.json").
-
-host -h - defines host ip (default is 127.0.0.1)
-
-port -p - defines host port (default is 9090)
-
--dump - requests full database dump in json format on stdout.
Usage example./client --dump > dump.json
-
--restore - restores database from stdin.
Usage example./client --restore < dump.json
Commands can be entered only in one register (GET and get but not Get).
List of supported commands
-
GET - returns the value if existing, otherwise message "Value with this key not found".
ExampleGET 123
-
SET - set the value if existing, otherwise creates new. Also returns message "Value has changed".
*Value must be in double quotes.
ExampleSET 123 "123"
-
DEL - deletes value from storage and returns it's value if existing, otherwise message "Value with this key not found".
ExampleDEL 123
-
KEYS - returns all keys matching to entered regexp pattern, otherwise message "Keys with this pattern not found" or "Pattern is incorrect".
*Regex pattern must be in double quotes.
ExampleKEYS "/*"
-
SUBSCRIBE - subscribes the client on specified channel.
ExampleSUBSCRIBE redis
-
UNSUBSCRIBE - unsubscribes the client from specified channel.
*Cannot use from client because after subscribe client turns into listening state.
ExampleUSUBSCRIBE redis
-
PUBLISH - sends the message to specified channel.
*Message must be in double quotes.
ExamplePUBLISH redis "Hello world"
- There no verbose mode and flag because logger any way logs full user's request.
- Not implemented TAB completion of the commands in cli.