go-kv

command module
v0.0.0-...-6f1e108 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: MIT Imports: 9 Imported by: 0

README

Go KV

A Simple and Efficient Key-Value Store

Table of Contents

Overview

Go KV is a lightweight key-value store written in Go, designed to be easy to use and highly performant. It offers a straightforward solution for storing and retrieving data, making it suitable for a wide range of applications.

Key features of Go KV include:

  • Dual modes of operation: Go KV can be run as a CLI tool for local development and testing, or as a standalone server for production deployments.
  • Flexible configuration: Go KV can be configured using environment variables or command-line flags, allowing you to customize its behavior to suit your needs.
  • Persistent storage: Data is stored in a JSON file, ensuring that your key-value pairs persist across restarts.
  • Logging: Go KV provides logging functionality to help you monitor and debug your application.
  • Scalability: You can specify the number of nodes to run, enabling you to scale your key-value store as your application grows.
  • Client package: Go KV includes a client package that makes it easy to interact with the server programmatically.

Whether you're a developer working on a small project or a team building a large-scale application, Go KV provides a reliable and efficient solution for your key-value storage needs. With its simple API and robust feature set, Go KV lets you focus on building your application logic without worrying about the underlying storage layer.

Status

Warning: This project is under active development and breaking changes may occur.
Current Version: 0.1.0

If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

Installation

clone the repository and navigate to the go-kv directory:

git clone https://github.com/ooyeku/monorepo-utils.git
cd monorepo-utils/go-kv

build the project:

go build -o go-kv

Configuration

The server can be configured using environment variables or command line flags. The available options are:

  • PORT: The port on which the server will listen. Default is :8080.
  • HOST: The host of the server. Default is http://localhost.
  • JSON_STORE: The path to the JSON file where the key-value store data will be saved. Default is go-kv-store.json.
  • LOG_FILE: The path to the log file. Default is go-kv-server.log.
  • RUN_CLI: Whether to run the CLI. Default is false.
  • NODES: The number of nodes to run. Default is 3.

These can also be set using command line flags of the same name, like so:

./go-kv --port=:8081 --host=http://localhost --jsonstore=my-store.json --logfile=my-log.log --runcli=true --nodes=6

Running the Server

using environment variables:

export GOKV_PORT=:8081
export GOKV_HOST=http://localhost
export GOKV_JSON_STORE=my-store.json
export GOKV_LOG_FILE=my-log.log
export GOKV_RUN_CLI=true
export GOKV_NODES=6

Or using the default values:

./go-kv

Using the client package

An example pkg/client.go is provided to demonstrate how to interact with the server using the client package.

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL