Skip to content

Commit

Permalink
chore: restructure pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-karan committed Dec 18, 2022
1 parent 129cf02 commit e0d49b4
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 8 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: goreleaser

on:
push:
tags:
- "*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ config.toml
bin/
data/
coverage.txt
dist/
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
env:
- GO111MODULE=on
- CGO_ENABLED=0

before:
hooks:
- go mod tidy

builds:
- binary: barreldb
id: barreldb
goos:
- linux
goarch:
- amd64
ldflags:
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./cmd/server/

- skip: true
id: barrel_lib

archives:
- format: tar.gz
files:
- README.md
- LICENSE
- cmd/server/config.sample.toml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ test:

.PHONY: bench
bench:
go test -bench=. -benchmem ./pkg/barrel/...
go test -bench=. -benchmem ./...
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can refer to [Writing a disk-based key-value store in Golang](https://mrkara

```go
import (
"github.com/mr-karan/barreldb/pkg/barrel"
"github.com/mr-karan/barreldb"
)

barrel, _ := barrel.Init(barrel.WithDir("data/"))
Expand Down Expand Up @@ -82,17 +82,17 @@ ERR: invalid key: key is already expired
Using `make bench`:

```
go test -bench=. -benchmem ./pkg/barrel/...
go test -bench=. -benchmem ./...
HELLO
goos: linux
goarch: amd64
pkg: github.com/mr-karan/barreldb/pkg/barrel
pkg: github.com/mr-karan/barreldb
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
BenchmarkPut/DisableSync-8 385432 3712 ns/op 1103.48 MB/s 88 B/op 4 allocs/op
BenchmarkPut/AlwaysSync-8 222 5510563 ns/op 0.74 MB/s 115 B/op 4 allocs/op
BenchmarkGet-8 840627 1304 ns/op 3142.20 MB/s 4976 B/op 5 allocs/op
PASS
ok github.com/mr-karan/barreldb/pkg/barrel 10.751s
ok github.com/mr-karan/barreldb 10.751s
```

Using `redis-benchmark`:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/barrel/benchmark_test.go → benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/mr-karan/barreldb/pkg/barrel"
barrel "github.com/mr-karan/barreldb"
)

func BenchmarkPut(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os/signal"
"syscall"

"github.com/mr-karan/barreldb/pkg/barrel"
barrel "github.com/mr-karan/barreldb"
"github.com/tidwall/redcon"
"github.com/zerodha/logf"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

"github.com/mr-karan/barreldb/pkg/barrel"
barrel "github.com/mr-karan/barreldb"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e0d49b4

Please sign in to comment.