Vortex is a super simple key-value store written in Go. It provides a RESTful API to create, read, update, and delete key-value pairs.
The application uses an in-memory map to store the key-value pairs. For restoring the state after a restart, the application writes the map to a file on disk. When the application starts, it reads the file and restores the map.
- Go 1.16 or higher
- curl (for testing)
The application uses the following environment variables for configuration:
TRANSACTION_LOG_FILE
: The filepath to write the transaction log to. Default is./transactions.log
.
To run the app, navigate to the project directory and use the go run
command:
go run .
You can interact with the application using curl. The following commands are available:
curl -X PUT -H "Content-Type: application/json" -d '{"value":"your_value"}' http://localhost:8080/v1/kv/your_key
Replace "your_key" and "your_value" with the actual key and value you want to put.
curl -X GET http://localhost:8080/v1/kv/your_key
Replace "your_key" with the actual key you want to get.
curl -X GET http://localhost:8080/v1/kv
curl -X DELETE http://localhost:8080/v1/kv/your_key
Replace "your_key" with the actual key you want to delete.
To run the tests, navigate to the project directory and use the go test
command:
go test ./... -race
To run the tests with coverage, navigate to the project directory and use the go test
command with the -coverprofile
flag:
go test ./... -race -coverprofile=coverage.out
go tool cover -html=coverage.out