Implementation of key-value storage described in Cloud Native Go by Matthew A. Titmus
-
Concurrency-safe persisting storage implemented with built-in
map
andsync.RWMutex
-
File Logger and SQLite Logger
-
REST API implemented with chi
1. Install Git
3. Install Go
Put value for provided key
(don't forget to pass data)
Get value for provided key
Delete value for provided key
Examples with curl:
curl -X PUT -d "1" http://localhost:8090/v1/key/a
- put value 1
for a
key
curl -X GET http://localhost:8090/v1/key/a
- get value for a
key
curl -X DELETE http://localhost:8090/v1/key/a
- delete value for a
key
- Empty keys/values are not supported
- Make sure nothing is running on
localhost:8090
- Set maximum sizes for keys and values
- Create config file to store:
- REST API port
- log file name
- log table name
- names for columns of log table
- events and errors channels capacity
- Implement Transport Layer Security
- Containerize the application
- Come up with a better solution to process
DELETE
lines in log - Close log file
- Close connection with database
- Service could shut down while there are still events in the events channel
- If keys or values contain multiple lines/spaces, bad things might happen (events are parsed with
\t
)
- SQL queries are not prepared