An open API service indexing awesome lists of open source software.

https://github.com/murtaza-u/keye

Key-Value DB with the ability to watch over keys
https://github.com/murtaza-u/keye

boltdb golang key-value-database watcher

Last synced: 6 months ago
JSON representation

Key-Value DB with the ability to watch over keys

Awesome Lists containing this project

README

          


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



---



GoDoc


Last commit


License


Stars


Issues


Repo Size


Follow on Twitter

## Database server

```sh
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

```sh
go get -u github.com/murtaza-u/keye
```

```go
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](https://godoc.org/github.com/murtaza-u/keye)

## CLI tool

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

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

### Usage

```sh
keyectl help
```