Skip to content

Commit 547378b

Browse files
authored
feat: new valkeyrie core (#74)
1 parent 23abd42 commit 547378b

37 files changed

+438
-6225
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Bug Report
2+
description: "Create a report to help us improve."
3+
body:
4+
- type: checkboxes
5+
id: terms
6+
attributes:
7+
label: Welcome
8+
options:
9+
- label: Yes, I've searched similar issues on GitHub and didn't find any.
10+
required: true
11+
- label: Yes, I've included all information below (version, config, etc).
12+
required: true
13+
14+
- type: textarea
15+
id: problem
16+
attributes:
17+
label: Description of the problem
18+
placeholder: Your problem description
19+
validations:
20+
required: true
21+
22+
- type: input
23+
id: version
24+
attributes:
25+
label: Version of Valkeyrie
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
id: go-env
31+
attributes:
32+
label: Go environment
33+
value: |-
34+
<details>
35+
36+
```console
37+
$ go version && go env
38+
# paste output here
39+
```
40+
41+
</details>
42+
validations:
43+
required: true
44+
45+
- type: textarea
46+
id: code-example
47+
attributes:
48+
label: Code example or link to a public repository
49+
value: |-
50+
<details>
51+
52+
```go
53+
// add your code here
54+
```
55+
56+
</details>
57+
validations:
58+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Questions
4+
url: https://github.com/kvtools/valkeyrie/discussions
5+
about: If you have a question, or are looking for advice, please post on our Discussions forum!
6+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Feature request
2+
description: "Suggest an idea for this project."
3+
body:
4+
5+
- type: textarea
6+
id: problem
7+
attributes:
8+
label: Your feature request related to a problem? Please describe.
9+
placeholder: "A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]"
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
id: solution
15+
attributes:
16+
label: Describe the solution you'd like.
17+
placeholder: "A clear and concise description of what you want to happen."
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
id: alternatives
23+
attributes:
24+
label: Describe alternatives you've considered.
25+
placeholder: "A clear and concise description of any alternative solutions or features you've considered."
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
id: additional
31+
attributes:
32+
label: Additional context.
33+
placeholder: "Add any other context or screenshots about the feature request here."
34+
validations:
35+
required: false
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Add a new type of store
2+
description: "Proposal"
3+
body:
4+
5+
- type: input
6+
id: store-name
7+
attributes:
8+
label: The name of the store.
9+
validations:
10+
required: true
11+
12+
- type: input
13+
id: repo-url
14+
attributes:
15+
label: The URL of your repository.
16+
validations:
17+
required: true
18+
19+
- type: textarea
20+
id: description
21+
attributes:
22+
label: Provide information about the store.
23+
placeholder: "A clear and concise description."
24+
validations:
25+
required: false

.golangci.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ linters-settings:
88
enable-all: true
99
disable:
1010
- fieldalignment
11-
- shadow # FIXME the issues reported must be reviewed.
1211
gocyclo:
1312
min-complexity: 15
14-
maligned:
15-
suggest-new: true
1613
goconst:
1714
min-len: 5
1815
min-occurrences: 3
1916
misspell:
2017
locale: US
2118
funlen:
2219
lines: -1
23-
statements: 40
20+
statements: 45
2421
godox:
2522
keywords:
2623
- FIXME
@@ -47,14 +44,13 @@ linters-settings:
4744
hugeParam:
4845
sizeThreshold: 100
4946
stylecheck:
50-
go: "1.16"
5147
checks:
5248
- "all"
53-
- "-ST1005" # FIXME MUST be fixed (error strings should not be capitalized)
5449

5550
linters:
5651
disable-all: true
5752
enable:
53+
- asasalint
5854
- asciicheck
5955
- bidichk
6056
- bodyclose
@@ -64,7 +60,7 @@ linters:
6460
- durationcheck
6561
- errcheck
6662
- errname
67-
# - errorlint # TODO can be used in future.
63+
- errorlint
6864
- exportloopref
6965
- forbidigo
7066
- forcetypeassert
@@ -91,7 +87,7 @@ linters:
9187
- govet
9288
- importas
9389
- ineffassign
94-
# - makezero # TODO can be used in future. Required to check the current reported issues.
90+
- makezero
9591
- misspell
9692
- nakedret
9793
- nestif
@@ -110,6 +106,7 @@ linters:
110106
- unconvert
111107
- unparam
112108
- unused
109+
- usestdlibvars
113110
- wastedassign
114111
- whitespace
115112

@@ -123,13 +120,7 @@ issues:
123120
linters:
124121
- goconst
125122
- funlen
126-
- path: "testutils/utils.go"
127-
linters: [ "funlen" ]
128123
- path: "valkeyrie.go"
129124
linters:
130125
- gochecknoglobals
131-
- path: "store/mock/mock.go"
132-
linters:
133-
- forcetypeassert
134-
- path: store/redis/redis.go
135-
text: 'Function `NewClient->newConnPool->NewConnPool->reaper->checkMinIdleConns` should pass the context parameter'
126+

CONTRIBUTING.md

Lines changed: 13 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ this document carefully.
1515

1616
- Git
1717
- Golang
18-
- One or all of the supported datastores (Zookeeper / Consul / Etcd / Redis / BoltDB)
18+
- One or all of the supported datastore (Zookeeper / Consul / Etcd / Redis / BoltDB)
1919

2020
### Installing Golang
2121

@@ -25,144 +25,17 @@ following these [Guidelines](https://golang.org/doc/install).
2525
An easy way to get started on mac OS is to use [homebrew](https://brew.sh) and type
2626
`brew install go` in a shell.
2727

28-
In addition to the language runtime, make sure you install these tools locally using
29-
`go get`:
30-
31-
- **fmt** (to format source code)
32-
- **goimports** (to automatically include and triage imports)
33-
34-
Once you have a working Go installation, follow the next steps:
35-
36-
- Get the repository:
37-
38-
go get -u github.com/kvtools/valkeyrie
39-
40-
- Checkout on a new branch from the master branch to start working on a patch
41-
42-
git checkout -b mybranch
43-
4428
### Local testing of key/value stores
4529

46-
In addition to installing golang, you will need to install some or all of the key
47-
value stores for testing.
30+
In addition to installing golang, you will need to install some or all of the key value stores for testing.
4831

4932
Refer to each of these stores documentation in order to proceed with installation.
50-
Generally, the tests are using the **default configuration** with the **default port**
51-
to connect to a store and run the test suite.
52-
53-
To test a change, you can proceed in two ways:
54-
55-
- You installed a **single key/value** store of your choice:
56-
57-
- In this case, navigate to the store folder, for example `valkeyrie/store/etcd/v3` and run:
58-
59-
go test .
60-
61-
- Finally, test for race conditions using the following command:
62-
63-
go test -v -race .
64-
65-
- You installed **all key/value** stores and want to run the whole test suite:
66-
67-
- At the base of the project directory, run:
68-
69-
go test ./...
70-
71-
- To test for race conditions, run:
72-
73-
go test -v -race ./...
74-
75-
### Flush Key/Value pairs and Specific configurations
76-
77-
Once in a while, you may need to flush key/value pairs from your local store installations:
78-
for example if you stop the tests purposefully with keys still being locked. This section
79-
describes how to easily start distributed backend storage locally and flush the key/value
80-
pairs when needed.
81-
82-
#### Consul
83-
84-
To start consul, use the following command:
85-
86-
consul agent -server -bootstrap -advertise=127.0.0.1 -data-dir /tmp/consul -config-file=/path/to/config.json
87-
88-
This is pointing to a `config.json` file having the following configuration:
89-
90-
{"session_ttl_min": "1s"}
91-
92-
Finally, to flush the key/value pairs:
93-
94-
rm -rf /tmp/consul
95-
96-
#### Etcd
97-
98-
To start etcd, use the following command:
33+
Generally, the tests are using the **default configuration** with the **default port** to connect to a store and run the test suite.
9934

100-
etcd --data-dir=/tmp/default.etcd --listen-client-urls 'http://0.0.0.0:4001' --advertise-client-urls 'http://localhost:4001'
101-
102-
To flush key/value pairs:
103-
104-
rm -rf /tmp/default.etcd
105-
106-
#### Zookeeper
107-
108-
To start zookeeper, use:
109-
110-
zkServer.sh start
111-
112-
Make sure you modify the `zoo.cfg` file to change the default zookeeper directory for testing. For
113-
example, to have the zookeeper director in the `/tmp` folder, modify the following line:
114-
115-
dataDir=/tmp/zookeeper
116-
117-
To flush the key/value pairs:
118-
119-
rm -rf /tmp/zookeeper
120-
121-
#### Redis
122-
123-
To start redis:
124-
125-
redis-server
126-
127-
For redis, flushing the key/value pairs is as simple as:
128-
129-
redis-cli flushall
130-
131-
#### Convenient scripts
132-
133-
You can group startup/stop/clean operations for every store with simple scripts:
134-
135-
- **Start**:
136-
137-
```
138-
#!/bin/bash
139-
140-
nohup etcd --data-dir=/tmp/default.etcd --listen-client-urls 'http://0.0.0.0:4001' --advertise-client-urls 'http://localhost:4001' &>/dev/null &
141-
nohup consul agent -server -bootstrap -advertise=127.0.0.1 -data-dir /tmp/consul -config-file=/path/to/config.json &>/dev/null &
142-
zkServer start &>/dev/null &
143-
nohup redis-server &>/dev/null &
144-
```
145-
146-
- **Clean**:
147-
148-
```
149-
#!/bin/bash
150-
151-
rm -rf /tmp/default.etcd
152-
rm -rf /tmp/consul
153-
rm -rf /tmp/zookeeper
154-
redis-cli flushall
155-
```
156-
157-
- **Stop**:
158-
159-
```
160-
#!/bin/bash
35+
To test a change, you can run the test suite with the following command:
16136

162-
pkill consul
163-
pkill etcd
164-
pkill -f zookeeper
165-
pkill redis
37+
```bash
38+
make test
16639
```
16740

16841
## Before submitting a change
@@ -174,7 +47,7 @@ the change as soon as possible):
17447
- **Open an issue** to clearly state the problem. This will be helpful to keep track
17548
of what needs to be fixed. This also helps triaging and prioritising issues.
17649

177-
- **Run the following command**: `go fmt ./...`, to ensure that your code is properly
50+
- **Run the following command**: `make validate`, to ensure that your code is properly
17851
formatted.
17952

18053
- **For non-trivial changes, write a test**: this is to ensure that we don't encounter
@@ -184,16 +57,18 @@ any regression in the future.
18457
committing a change unless it is a trivial one).
18558

18659
- **Sign-off your commits** using the `-s` flag (you can configure an alias to
187-
`git commit` adding `-s` for convenience).
60+
`git commit` adding `-s` for convenience).
18861

18962
- **Squash your commits** if the pull requests includes many commits that are related.
19063
This is to maintain a clean history of the change and better identify faulty commits
19164
if reverting a change is ever needed. We will tell you if squashing your commits is
19265
necessary.
19366

194-
- **If the change is solving one or more issues listed on the repository**: you can reference
195-
the issue in your comment with `closes #XXX` or `fixes #XXX`. This will automatically close
196-
related issues on merging the change.
67+
- **If the change is solving one or more issues listed on the repository**: you
68+
can reference the issue in your comment with `closes #XXX` or `fixes #XXX`.
69+
This will automatically close related issues on merging the change. See
70+
[Github documentation](https://help.github.com/articles/closing-issues-using-keywords/)
71+
for more details.
19772

19873
Finally, submit your *Pull Request*.
19974

0 commit comments

Comments
 (0)