This project provides a simple API to interact with TiKV, a distributed transactional key-value database. Using this API, users can store, retrieve, update, and delete blobs of data in TiKV. The API is built with Go and utilizes the TiKV client to interact directly with a TiKV cluster.
- Go 1.21 or later
- Docker and Docker Compose
- TiKV client (referenced in the
go.mod
file)
Make sure you have the necessary frameworks and tools required to run the project.
-
Clone the repository:
git clone https://github.com/codevalley/ti-kv-api.git
-
Navigate to the project directory, and execute docker build
cd ti-kv-api docker build -t tikvapi .
-
Use Docker Compose to build and start the services
docker-compose up
-
Your application can now be accessed at
http://localhost:8080
-
To stop all services and remove associated containers, you can run
docker-compose down
Add a new blob to the KV Store
curl -X POST "http://localhost:8080/?blob=HelloWorld"
curl -X POST "http://localhost:8080/?blob=ByeUniverse"
curl -X POST "http://localhost:8080/?blob=GreetingsEarth"
Delete a specific blob from the KV Store
curl -X DELETE "http://localhost:8080/?blob=ByeUniverse"
Update a specific blob from the KV Store
curl -X PUT "http://localhost:8080/?oldBlob=HelloWorld&newBlob=HelloMultiverse"
[Todo] Retrieve the number of blobs in the KV store.
curl "http://localhost:8080/blobs/count"
Retrieve a random entry from the KV store.
curl "http://localhost:8080/blobs/random"
[Todo] Retrieve all the blobs from the KV store.
curl "http://localhost:8080/blobs/all"
Narayan (@codevalley)
We welcome contributions to this project. Please open an issue or submit a pull request on GitHub!
This project is licensed under the MIT License. See the LICENSE file for details.