Skip to content

murtaza-u/keye

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keye (pronounce "kai") is a key-value database with the ability to watch over keys


Database server

docker run -it -d \
    --name keye \
    -p 23023:23023 \
    -v "$HOME/.local/share/keye:/data" \
    -e "KEYE_DB_FILE_PATH=/data/data.db" \
    -e "KEYE_PORT=23023" \
    -e "KEYE_WATCHER_PING_INTERVAL=10s" \
    -e "KEYE_EVENT_QUEUE_SIZE=10" \
    -e "KEYE_ENABLE_REFLECTION=0" \
    -e "KEYE_USE_JSON_LOGGER=0" \
    -e "KEYE_DEBUG=0" \
    murtazau/keye:23.12
Environment variable Go type Description Default
KEYE_DB_FILE_PATH string path to the database file ./data.db
KEYE_PORT uint16 port for the database server 23023
KEYE_WATCHER_PING_INTERVAL time.Duration duration b/w two keepalive ping for the watcher 10s
KEYE_EVENT_QUEUE_SIZE uint size of the event queue 10
KEYE_ENABLE_REFLECTION bool enable gRPC reflection false
KEYE_USE_JSON_LOGGER bool use JSON logger false
KEYE_DEBUG bool enable debug logs false

Client library

go get -u github.com/murtaza-u/keye
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/murtaza-u/keye/client"
)

func main() {
	c, err := client.New(client.Config{
		Addr:    ":23023",
		Timeout: time.Second * 5,
	})
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	key := "foo"
	val := "bar"

	keys, err := c.Put(key, []byte(val))
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("modified keys:")
	for _, k := range keys {
		fmt.Println(k)
	}
}

Full API reference: GoDoc

CLI tool

keyectl is a command-line tool for interacting with the Keye database server.

go install github.com/murtaza-u/keye/cmd/keyectl@latest

Usage

keyectl help