Skip to content

Commit 72ed10e

Browse files
committed
first commit
0 parents  commit 72ed10e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+6050
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/pull_request_template.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#### Relevant Issue (if applicable)
2+
(If there are Issues related to this PullRequest, please list it.)
3+
4+
#### Details
5+
(Please describe the details of PullRequest.)
6+

.github/workflows/main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
release:
13+
types:
14+
- published
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
22+
runs-on: ubuntu-latest
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-go@v2
29+
with:
30+
go-version: '^1.14'
31+
- name: Run a one-line script
32+
run: echo Hello, world!
33+
- name: Run a multi-line script
34+
run: |
35+
echo Add other actions to build,
36+
echo test, and deploy your project.
37+
- name: Check golang version
38+
run: go version
39+
- name: Check env
40+
run: env
41+
- name: Init
42+
run: make init
43+
- name: Test
44+
run: make test

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, build with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# emacs backup files
15+
*.go~

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Hirotaka Wakabayashi <hiwakaba@yahoo-corp.jp>
2+
Takeshi Nakatani <ggtakec@gmail.com>

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
k2hash_go (1.0.0) stable; urgency=low
2+
3+
* Initial commit
4+
5+
-- Hirotaka Wakabayashi <hiwakaba@yahoo-corp.jp> Fri, 17 Apr 2020 07:40:05 +0000

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Yahoo Japan Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# k2hash_go
3+
#
4+
# Copyright 2018 Yahoo Japan Corporation.
5+
#
6+
# Go driver for k2hash that is a NoSQL Key Value Store(KVS) library.
7+
# For k2hash, see https://github.com/yahoojapan/k2hash for the details.
8+
#
9+
# For the full copyright and license information, please view
10+
# the license file that was distributed with this source code.
11+
#
12+
# AUTHOR: Hirotaka Wakabayashi
13+
# CREATE: Fri, 14 Sep 2018
14+
# REVISION:
15+
#
16+
17+
build:
18+
# use _build as the GOPATH-base
19+
@/bin/echo "Running k2hash_go build"
20+
GOPATH=$(PWD)/_build go install -v github.com/yahoojapan/k2hash_go/...
21+
@echo "OK - built the following binaries:"
22+
ls -l _build/bin
23+
24+
init:
25+
# 0. remove the build directory
26+
rm -fr _build
27+
# 1. get source.
28+
@echo "Running k2hash_go init (fetching source code)"
29+
git clone https://github.com/yahoojapan/k2hash_go.git _build/src/github.com/yahoojapan/k2hash_go
30+
# 2. syntax check.
31+
BAD_GOFMT_FILES=$(find ./_build -name '*.go' | xargs gofmt -l)
32+
@echo ".go files that are not gofmt-compliant (empty if all are fine): [$(BAD_GOFMT_FILES)]"
33+
# 3. install libk2hash
34+
sh utils/libk2hash.sh
35+
36+
test:
37+
@echo "Running k2hash_go test"
38+
GOPATH=$(PWD)/_build go test -v github.com/yahoojapan/k2hash_go/tests
39+
GOPATH=$(PWD)/_build go test -v github.com/yahoojapan/k2hash_go/tests -coverprofile=c.out
40+
GOPATH=$(PWD)/_build go tool cover -html=c.out
41+
42+
publish:
43+
@echo "Running k2hash_go publish"
44+
# TODO: add scp of binaries to Artifactory (or RPM package creation and uploading)
45+
46+
# Local Variables:
47+
# c-basic-offset: 4
48+
# tab-width: 4
49+
# indent-tabs-mode: t
50+
# End:
51+
# vim600: noexpandtab sw=4 ts=4 fdm=marker
52+
# vim<600: noexpandtab sw=4 ts=4
53+

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# k2hash_go
2+
3+
### Overview
4+
5+
**k2hash_go** implements a [k2hash](https://k2hash.antpick.ax/) client in golang.
6+
7+
### Install
8+
9+
Firstly you must install the [k2hash](https://k2hash.antpick.ax/) shared library.
10+
```
11+
$ curl -o- https://raw.github.com/yahoojapan/k2hash_go/master/utils/libk2hash.sh | bash
12+
```
13+
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.
14+
15+
After you make sure you set the [GOPATH](https://github.com/golang/go/wiki/SettingGOPATH) environment, download the **k2hash_go** package.
16+
```
17+
$ go get -u github.com/yahoojapan/k2hash_go
18+
```
19+
20+
### Usage
21+
22+
Here is a simple example of **k2hash_go** which save a key and get it.
23+
24+
```golang
25+
package main
26+
27+
import (
28+
"fmt"
29+
"os"
30+
31+
"github.com/yahoojapan/k2hash_go/k2hash"
32+
)
33+
34+
func SetAndGet() {
35+
// 1. Instantiate K2hash class
36+
file, _ := k2hash.NewK2hash("/tmp/test.k2h")
37+
defer file.Close()
38+
ok, err := file.Set("hello", "world")
39+
if ok != true {
40+
fmt.Fprintf(os.Stderr, "file.Set(hello, world) returned false, err %v\n", err)
41+
}
42+
// 2. Get
43+
// 2.1. no args
44+
val, err := file.Get("hello")
45+
if val == nil || err != nil {
46+
fmt.Fprintf(os.Stderr, "file.Get(hello) returned val %v err %v\n", val, err)
47+
return
48+
}
49+
fmt.Printf("val = %v, err = %v\n", val.String(), err)
50+
}
51+
52+
func main() {
53+
SetAndGet()
54+
}
55+
```
56+
57+
### Development
58+
59+
Here is the step to start developing **k2hash_go**.
60+
61+
- Debian / Ubuntu
62+
63+
```bash
64+
#!/bin/sh
65+
66+
sudo 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
67+
sudo apt-get install libfullock-dev k2hash-dev -y
68+
go get github.com/yahoojapan/k2hash_go/k2hash
69+
70+
exit 0
71+
```
72+
73+
- CentOS / Fedora
74+
75+
```bash
76+
#!/bin/sh
77+
78+
sudo dnf makecache && sudo yum install curl git -y && curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
79+
sudo dnf install libfullock-devel k2hash-devel -y
80+
go get github.com/yahoojapan/k2hash_go/k2hash
81+
82+
exit 0
83+
```
84+
85+
### Documents
86+
- [About K2HASH](https://k2hash.antpick.ax/)
87+
- [About AntPickax](https://antpick.ax/)
88+
89+
### License
90+
91+
MIT License. See the LICENSE file.
92+
93+
## AntPickax
94+
95+
[AntPickax](https://antpick.ax/) is
96+
- an open source team in [Yahoo Japan Corporation](https://about.yahoo.co.jp/info/en/company/).
97+
- a product family of open source software developed by [AntPickax](https://antpick.ax/).
98+

0 commit comments

Comments
 (0)