kvetch

module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT

README

Kvetch

Kvetch is a small gRPC wrapper around the Badger key-value datastore

Quickstart

Run the Kvetch container in Docker:

docker run --rm -v $PWD/data:/data -e DATASTORE=/data -p 7777:7777  syncromatics/kvetch:v0.5.1

Interact with Kvetch using kvetchctl:

GO111MODULE=on go get github.com/syncromatics/kvetch/cmd/kvetchctl@v0.5.1
export KVETCHCTL_ENDPOINT=localhost:7777 # host:port of Kvetch instance
kvetchctl set example/1 "first value"
kvetchctl set example/2 "second value"
kvetchctl set example/3 "third value"
kvetchctl get --prefix example/

It is also possible to run both kvetch and kvetchctl in the same docker container:

docker run -it --rm syncromatics/kvetch:v0.5.1 bash
DATASTORE=/data ./kvetch &
export KVETCHCTL_ENDPOINT=localhost:7777
./kvetchctl set example/1 "first value"
./kvetchctl set example/2 "second value"
./kvetchctl set example/3 "third value"
./kvetchctl get --prefix example/

More kvetchctl documentation is available in docs/kvetchctl

Configuration

Configuration is done via environmental variables. Refer to the tables below.

General Settings

Name Type Description Required Default
DATASTORE string Directory where badger key data will be stored in. Yes nil
GARBAGE_COLLECTION_INTERVAL duration Defines how often kvetch will attempt garbage collection. No 5m
PORT int Port on which kvetch grpc service will run. No 7777
PROMETHEUS_PORT int Port for use by Prometheus for metric gathering. No 80

Optional BadgerDB Specific Settings (More Detail @ https://github.com/dgraph-io/badger/blob/master/options.go)

Default values here are set to BadgerDB defaults and subject to change if package is updated. Refer to above link for more info.

Name Type Description Default
ENABLE_TRUNCATE bool Truncate indicates whether value log files should be truncated to delete corrupt data, if any. False
GARBAGE_COLLECTION_DISCARD_RATIO float Percentage of value log file that has to be expired or ready for garbage collection for that file to be eligible for garbage collection. 0.5
IN_MEMORY bool Sets InMemory mode to true. Everything is stored in memory. No value/sst files on disk are created. In case of a crash all data will be lost. False
LEVEL_ONE_SIZE int The maximum total size in bytes for Level 1 in the LSM. 20MB
LEVEL_SIZE_MULTIPLIER int Sets the ratio between the maximum sizes of contiguous levels in the LSM. Once a level grows to be larger than this ratio allowed, the compaction process will be triggered. 10
MAX_TABLE_SIZE int Sets the maximum size in bytes for each LSM table or file. 64MB
NUMBER_OF_LEVEL_ZERO_TABLES int Maximum number of Level 0 tables before compaction starts. 5
NUMBER_OF_ZERO_LEVEL_TABLES_UNTIL_FORCE_COMPACTION int Sets the number of Level 0 tables that once reached causes the DB to stall until compaction succeeds. 10

Building

build Docker Build Status

Building Kvetch requires the following:

To build and test the Kvetch Docker image alone:

make test

To build and package kvetchctl:

make package

To update generated code and documentation:

make generate

Code of Conduct

We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.

Contributing

We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.

License and Authors

GMV Syncromatics Engineering logo GMV Syncromatics Engineering

license GitHub contributors

This software is made available by GMV Syncromatics Engineering under the MIT license.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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