Skip to content

Commit ba3ca29

Browse files
committed
bump to v2.2.2
- [resp for #7] `NewOverlappedRingBuffer` returns `RichOverlappedRingBuffer[T]` now, which gives some new alternatives apis of `Enqueue` so that you can collect `overwrites` and `size` from the returning data. > The legacy codes keep its stable with the original `Enqueue`. > For a normal ringbuf, non-overlapped, nothing's changed since the current capacity (size) is not a very important value for measuring. > If not, issue me.
1 parent 88206e2 commit ba3ca29

File tree

4 files changed

+30
-95
lines changed

4 files changed

+30
-95
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: |
4040
for GOOS in $(go tool dist list|awk -F'/' '{print $1}'|sort -u); do
4141
echo -e "\n\nTESTING FOR $GOOS ...\n"
42-
go test -v -race ./...
42+
go test -v -race -test.short ./...
4343
done
4444
4545
coverage:
@@ -70,75 +70,6 @@ jobs:
7070
path-to-profile: profile.cov
7171
parallel: true
7272

73-
# build:
74-
# #env:
75-
# # GOPATH: ${{ github.workspace }}
76-
# # GO111MODULE: off
77-
# runs-on: ubuntu-latest
78-
# steps:
79-
# - name: Install Go
80-
# uses: actions/setup-go@v2
81-
# with:
82-
# go-version: 1.18.x
83-
# - name: Checkout code
84-
# uses: actions/checkout@v2
85-
# #with:
86-
# # path: ./src/github.com/${{ github.repository }}
87-
# - uses: actions/cache@v2
88-
# with:
89-
# path: ~/go/pkg/mod
90-
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
91-
# restore-keys: |
92-
# ${{ runner.os }}-go-
93-
# - name: Build
94-
# run: |
95-
# for dir in cmdr std; do
96-
# for GOOS in windows linux darwin; do
97-
# for GOARCH in amd64; do
98-
# suf=; if [[ $GOOS == "windows" ]]; then suf=".exe"; fi
99-
# go build -v -o bin/tcp-tool-$dir-$GOOS-$GOARCH$suf ./examples/$dir
100-
# gzip bin/tcp-tool-$dir-$GOOS-$GOARCH$suf
101-
# done
102-
# done
103-
# done
104-
# - name: upload artifacts
105-
# uses: actions/upload-artifact@master
106-
# if: startsWith(github.ref, 'refs/tags/v')
107-
# with:
108-
# name: binaries
109-
# path: bin/
110-
#
111-
# - name: Upload binaries to release
112-
# uses: svenstaro/upload-release-action@v2
113-
# if: startsWith(github.ref, 'refs/tags/v')
114-
# with:
115-
# repo_token: ${{ secrets.GITHUB_TOKEN }}
116-
# file: bin/*
117-
# tag: ${{ github.ref }}
118-
# overwrite: true
119-
# file_glob: true
120-
# #body:
121-
## - name: Create Release
122-
## id: create_release
123-
## uses: actions/create-release@v1
124-
## env:
125-
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126-
## with:
127-
## tag_name: ${{ github.ref }}
128-
## release_name: Release ${{ github.ref }}
129-
## draft: false
130-
## prerelease: false
131-
## - name: Upload Release Asset
132-
## id: upload-release-asset
133-
## uses: actions/upload-release-asset@v1
134-
## env:
135-
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136-
## with:
137-
## upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
138-
## asset_path: bin/*
139-
## asset_name: my-artifact.zip
140-
## asset_content_type: application/zip
141-
14273
# notifies coveralls that all test jobs are finished
14374
finish-coverage:
14475
name: Finish Coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tools/bgo/go.work
66
go.work
77
.local/
88
lint.txt
9+
logs/
910

1011
*.code-workspace
1112

README.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ MPMC (multiple producers and multiple consumers) enabled.
1818

1919
## History
2020

21+
### v2.2.2
22+
23+
- [resp for #7] `NewOverlappedRingBuffer` returns `RichOverlappedRingBuffer[T]` now, which gives some new alternatives apis of `Enqueue` so that you can collect `overwrites` and `size` from the returning data.
24+
> The legacy codes keep its stable with the original `Enqueue`.
25+
> For a normal ringbuf, non-overlapped, nothing's changed since the current capacity (size) is not a very important value for measuring.
26+
> If not, issue me.
27+
2128
### v2.2.1
2229

2330
- security updates
@@ -124,22 +131,22 @@ The following codes is for v1, needed for rewriting
124131
```go
125132
func newRes() *Res{...}
126133

127-
var rb fast.RingBuffer
134+
var rb mpmc.RingBuffer
128135

129136
func initFunc() (err error) {
130137
const maxSize = 16
131138

132-
if rb = fast.New(uint32(maxSize)); rb == nil {
133-
err = errors.New("cannot create fast.RingBuffer")
134-
return
135-
}
139+
if rb = mpmc.New(uint32(maxSize)); rb == nil {
140+
err = errors.New("cannot create mpmc.RingBuffer")
141+
return
142+
}
136143

137-
// CapReal() will be available since v0.8.8, or replace it with Cap() - 1
138-
for i := uint32(0); i < rb.CapReal(); i++ {
139-
if err = rb.Enqueue(newRes()); err != nil {
140-
return
144+
// CapReal() will be available since v0.8.8, or replace it with Cap() - 1
145+
for i := uint32(0); i < rb.CapReal(); i++ {
146+
if err = rb.Enqueue(newRes()); err != nil {
147+
return
148+
}
141149
}
142-
}
143150
}
144151

145152
func loopFor() {
@@ -162,15 +169,15 @@ allows us to overwrite the head element if putting new element into a **full** r
162169

163170
```go
164171
func testStringRB() {
165-
var err error
166-
var rb = ringbuf.NewOverlappedRingBuffer[string](80)
167-
err = rb.Enqueue("abcde")
168-
errChk(err)
169-
170-
var item string
171-
item, err = rb.Dequeue()
172-
errChk(err)
173-
fmt.Printf("dequeue ok: %v\n", item)
172+
var err error
173+
var rb = ringbuf.NewOverlappedRingBuffer[string](80)
174+
err = rb.Enqueue("abcde")
175+
errChk(err)
176+
177+
var item string
178+
item, err = rb.Dequeue()
179+
errChk(err)
180+
fmt.Printf("dequeue ok: %v\n", item)
174181
}
175182
```
176183

@@ -181,7 +188,3 @@ Welcome
181188
## LICENSE
182189

183190
Apache 2.0
184-
185-
<!--
186-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhedzr%2Fgo-ringbuf.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhedzr%2Fgo-ringbuf?ref=badge_large)
187-
-->

doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const (
99
// AppName const
1010
AppName = "ringbuf"
1111
// Version const
12-
Version = "2.2.1"
12+
Version = "2.2.2"
1313
// VersionInt const
14-
VersionInt = 0x020201
14+
VersionInt = 0x020202
1515
)

0 commit comments

Comments
 (0)