Go implementation of the server-client solution for storing key-value data (task link).
- make
- docker
Note: in order to run docker commands in the makefile targets without sudo you have to follow the next guide.
If you have go
tool installed:
- get source files:
go get github.com/siarhiejkresik/go-kvdb
cd $GOPATH/src/github.com/siarhiejkresik/go-kvdb
Or get source files by cloning repository directly:
- get source files:
git clone https://github.com/siarhiejkresik/go-kvdb.git
cd go-kvdb
Run make
. This builds the go-kvdb
docker container with the server and client binaries.
Run server in a docker container:
make run [ARGS="<args>"]
ordocker run --rm -p 9090:9090 go-kvdb:latest [ARG...]
Run client in a docker container:
make run-client [ARGS="<args>"]
ordocker run --rm -it --entrypoint /app/client go-kvdb:latest [ARG...]
make check
—runs code linting and verificationmake test
—runs tests for the project filesmake coverage
—measures test coverage, saves result to thecoverage.out
file
Starting options:
-m
,--mode
The possible storage option (disk—stores database to disk, memory—database runs only in memory)-p
,--port
The port for listening on (default—9090)-v
,--verbose
Verbose mode, full log of the client requests
Starting options:
-p
,--port
The port to connect to the server (default—9090)-h
,--host
The host to connect to the server (default—127.0.0.1)
- SET - updates a key at a time with the given value
- GET - returns the value of a key
- DEL - removes a key
- KEYS - returns all keys matching pattern; pattern could include '*' symbol which matches zero or more characters
- DUMP - (optional) - returns database data in the json format