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
- Host: GitHub
- URL: https://github.com/murtaza-u/keye
- Owner: murtaza-u
- License: apache-2.0
- Created: 2023-12-07T06:43:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-19T12:43:14.000Z (about 2 years ago)
- Last Synced: 2025-04-08T23:39:42.986Z (about 1 year ago)
- Topics: boltdb, golang, key-value-database, watcher
- Language: Go
- Homepage:
- Size: 678 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Keye (pronounce "kai") is a key-value
database with the ability to watch over keys
---
## 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
```