https://github.com/yahoojapan/k2hash_go
K2HASH Go library - NoSQL Key Value Store(KVS) library
https://github.com/yahoojapan/k2hash_go
antpickax database fullock golang in-memory k2hash kvs
Last synced: 6 months ago
JSON representation
K2HASH Go library - NoSQL Key Value Store(KVS) library
- Host: GitHub
- URL: https://github.com/yahoojapan/k2hash_go
- Owner: yahoojapan
- License: mit
- Created: 2020-09-18T00:24:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-24T07:22:07.000Z (about 5 years ago)
- Last Synced: 2025-04-12T22:07:41.267Z (6 months ago)
- Topics: antpickax, database, fullock, golang, in-memory, k2hash, kvs
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# k2hash_go
### Overview
**k2hash_go** implements a [k2hash](https://k2hash.antpick.ax/) client in golang.
### Install
Firstly you must install the [k2hash](https://k2hash.antpick.ax/) shared library.
```
$ curl -o- https://raw.github.com/yahoojapan/k2hash_go/master/utils/libk2hash.sh | bash
```
You can install **k2hash** library step by step from [source code](https://github.com/yahoojapan/k2hash). See [Build](https://k2hash.antpick.ax/build.html) for details.After you make sure you set the [GOPATH](https://github.com/golang/go/wiki/SettingGOPATH) environment, download the **k2hash_go** package.
```
$ go get -u github.com/yahoojapan/k2hash_go
```### Usage
Here is a simple example of **k2hash_go** which save a key and get it.
```golang
package mainimport (
"fmt"
"os""github.com/yahoojapan/k2hash_go/k2hash"
)func SetAndGet() {
// 1. Instantiate K2hash class
file, _ := k2hash.NewK2hash("/tmp/test.k2h")
defer file.Close()
ok, err := file.Set("hello", "world")
if ok != true {
fmt.Fprintf(os.Stderr, "file.Set(hello, world) returned false, err %v\n", err)
}
// 2. Get
// 2.1. no args
val, err := file.Get("hello")
if val == nil || err != nil {
fmt.Fprintf(os.Stderr, "file.Get(hello) returned val %v err %v\n", val, err)
return
}
fmt.Printf("val = %v, err = %v\n", val.String(), err)
}func main() {
SetAndGet()
}
```### Development
Here is the step to start developing **k2hash_go**.
- Debian / Ubuntu
```bash
#!/bin/shsudo apt-get update -y && sudo apt-get install curl git -y && curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
sudo apt-get install libfullock-dev k2hash-dev -y
go get github.com/yahoojapan/k2hash_go/k2hashexit 0
```- CentOS / Fedora
```bash
#!/bin/shsudo dnf makecache && sudo yum install curl git -y && curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
sudo dnf install libfullock-devel k2hash-devel -y
go get github.com/yahoojapan/k2hash_go/k2hashexit 0
```### Documents
- [About K2HASH](https://k2hash.antpick.ax/)
- [About AntPickax](https://antpick.ax/)### License
MIT License. See the LICENSE file.
## AntPickax
[AntPickax](https://antpick.ax/) is
- an open source team in [Yahoo Japan Corporation](https://about.yahoo.co.jp/info/en/company/).
- a product family of open source software developed by [AntPickax](https://antpick.ax/).