khighdb

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT

README ΒΆ

khighdb-logo

Coverage Status Go Report Go Reference



KhighDB

KhighDB is a high-performance, embedded and disaster tolerant KV storage engine.

🌌 Core Features

  • Low latency, both for read and write.
  • High throughput, especially when writing an incoming stream of random items.
  • Powerful storage ability, handle datasets much larger than RAM w/o degradation.
  • Crash friendliness, both in terms of fast recovery and not losing data.
  • API supports most protocols of redis.

πŸ’  Engine Architecture

KhighDB implementations Bitcask which is a log-structured hash table for fast key/value data.

Additionally, KhighDB uses adaptive-radix-tree to store the mete data of log entries.

khighdb-architecture

⚑ Support Command

Common
  • Ping
  • Info
  • Select
  • Exit
  • Auth
String
  • Set
  • Get
  • MSet
  • MGet
  • Del
  • GetRange
  • GetDel
  • SetEX
  • SetNX
  • MSetNX
  • Append
  • Incr
  • IncrBy
  • Decr
  • DecrBy
  • Expire
  • TTL
  • Persist
  • StrLen
  • StrLen
  • Count
  • Scan
  • GetStrKeys
List
  • LPush
  • LPushX
  • RPush
  • RPushX
  • LPop
  • RPop
  • LMove
  • LLen
  • LIndex
  • LSet
  • LRange
  • LRem
Hash
  • HSet
  • HSetNX
  • HGet
  • HMGet
  • HDel
  • RExists
  • HLen
  • HKeys
  • HVals
  • HGetAll
  • HStrLen
  • HScan
  • HIncrBy
  • HRandField
Set
  • SAdd
  • SPop
  • SRem
  • SIsMember
  • SMIsMember
  • SMembers
  • SCard
  • SDiff
  • SDiffStore
  • SUnion
  • SUnionStore
  • SInter
  • SInterStore
ZSet
  • ZAdd
  • ZRem
  • ZScore
  • ZCard
  • ZRange
  • ZRevRange
  • ZRank
  • ZRevRank

πŸ›« Embedded Usage

Make sure there is go 1.16 or newer in environment and then install KhighDB.

go get -u github.com/Khighness/khighdb

Create or open a database:

opts := khighdb.DefaultOptions(path)
khighDB, err := khighdb.Open(opts)
...
defer khighDB.Close()
...

Write or read the key-value pair:

err := khighDB.Set([]byte("me"), []byte("Khighness"))
...
val, err := khighDB.Get([]byte("me"))
...

πŸš€ Quick Start

Firstly, startup a Khigh server:

$ go run ./cmd/server/main.go -dbpath='/tmp' -host='127.0.0.1' -port=3333 -databases=16

Secondly, startup a Khigh client:

$ go run ./cmd/client/main.go -h=127.0.0.1 -p=3333
127.0.0.1:3333>set this KhighDB
$2
OK
127.0.0.1:3333>get this
$7
KhighDB

πŸ““ MIT License

Khighness's khighdb is open-sourced system licensed under the MIT license.

Directories ΒΆ

Path Synopsis
cmd
data
art
set

Jump to

Keyboard shortcuts

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