Skip to content

Commit de7710a

Browse files
Release V1.0.0-rc2 (#20)
- Finshes disk restore feature - Improved and expanded test suite - Performance patches - Improved error handling - Patches security alerts - Reduces data need for lazy disk deleter
1 parent a2428e6 commit de7710a

15 files changed

+926
-626
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
GPQ is an extremely fast and flexible priority queue, capable of millions transactions a second. GPQ supports a complex "Double Priority Queue" which allows for priorities to be distributed across N buckets, with each bucket holding a second priority queue which allows for internal escalation and timeouts of items based on parameters the user can specify during submission combined with how frequently you ask GPQ to prioritize the queue.
77
</h4>
88

9+
## Notice
10+
While GPQ is largely stable, bugs are more than likely present at this early stage, and you should carefully consider if your application can tolerate any down time or lost messages that may result from adopting this project into a production workflow. If you run into any bugs please submit an issue or better a PR! Check out the guide to contributing below.
11+
912

1013
## Table of Contents
14+
- [Notice](#notice)
1115
- [Table of Contents](#table-of-contents)
1216
- [Background](#background)
1317
- [Should I Use GPQ?](#should-i-use-gpq)
@@ -44,7 +48,7 @@ GPQ is a concurrency safe, embeddable priority queue that can be used in a varie
4448

4549

4650
## Benchmarks
47-
Due to the fact that most operations are done in constant time `O(1)` or logarithmic time `O(log n)`, with the exception of the prioritize function which happens in linear time `O(n)`, all GPQ operations are extremely fast. A single GPQ can handle a few million transactions a second and can be tuned depending on your work load. I have included some basic benchmarks using C++, Rust, Zig, and Go to measure GPQ's performance against the standard implementations of other languages that can be found here at: [pq-bench](https://github.com/JustinTimperio/pq-bench)
51+
Due to the fact that most operations are done in constant time `O(1)` or logarithmic time `O(log n)`, with the exception of the prioritize function which happens in linear time `O(n)`, all GPQ operations are extremely fast. A single GPQ can handle a few million transactions a second and can be tuned depending on your work load. I have included some basic benchmarks using C++, Rust, Zig, Python, and Go to measure GPQ's performance against the standard implementations of other languages that can be found here at: [pq-bench](https://github.com/JustinTimperio/pq-bench)
4852

4953
| | |
5054
|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
@@ -68,8 +72,8 @@ For this you will need Go >= `1.22` and gpq itself uses [hashmap](https://github
6872
- `ActiveBuckets() uint` - Returns the number of active buckets.
6973
- `Enqueue(item schema.Item[d]) error` - Enqueues an item into the queue.
7074
- `EnqueueBatch(items []schema.Item[d]) error` - Enqueues a batch of items into the queue.
71-
- `Dequeue() (schema.Item[d], error)` - Dequeues an item from the queue.
72-
- `DequeueBatch(batchSize uint) ([]schema.Item[d], error)` - Dequeues a batch of items from the queue.
75+
- `Dequeue() (*schema.Item[d], error)` - Dequeues an item from the queue.
76+
- `DequeueBatch(batchSize uint) ([]*schema.Item[d], error)` - Dequeues a batch of items from the queue.
7377
- `Prioritize() error` - Prioritizes the queue based on the values in each item.
7478
- `Close()` - Closes the queue and saves the queue to disk.
7579

@@ -86,7 +90,7 @@ import (
8690
)
8791

8892
func main() {
89-
defaultMessageOptions := schema.EnQueueOptions{
93+
defaultMessageOptions := schema.EnqueueOptions{
9094
ShouldEscalate: true,
9195
EscalationRate: time.Duration(time.Second),
9296
CanTimeout: true,

disk/disk.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (d *Disk[T]) ProcessBatch(batch []*schema.Item[T]) error {
8686
return nil
8787
}
8888

89-
func (d *Disk[T]) DeleteBatch(batch []*schema.Item[T]) error {
89+
func (d *Disk[T]) DeleteBatch(batch []*schema.DeleteMessage) error {
9090
txn := d.diskCache.NewTransaction(true)
9191
defer txn.Discard()
9292

go.mod

+12-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
module github.com/JustinTimperio/gpq
22

3-
go 1.22.0
3+
go 1.22
44

55
require (
66
github.com/cornelk/hashmap v1.0.8
7-
github.com/dgraph-io/badger/v4 v4.2.0
7+
github.com/dgraph-io/badger/v4 v4.5.0
88
github.com/google/uuid v1.6.0
99
github.com/tidwall/btree v1.7.0
1010
)
1111

1212
require (
13-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
14-
github.com/dgraph-io/ristretto v0.1.1 // indirect
13+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
14+
github.com/dgraph-io/ristretto/v2 v2.0.1 // indirect
1515
github.com/dustin/go-humanize v1.0.1 // indirect
16-
github.com/gogo/protobuf v1.3.2 // indirect
17-
github.com/golang/glog v1.0.0 // indirect
18-
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
19-
github.com/golang/protobuf v1.5.3 // indirect
20-
github.com/golang/snappy v0.0.4 // indirect
21-
github.com/google/flatbuffers v23.5.26+incompatible // indirect
22-
github.com/google/go-cmp v0.5.9 // indirect
23-
github.com/klauspost/compress v1.16.7 // indirect
16+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
17+
github.com/google/flatbuffers v24.3.25+incompatible // indirect
18+
github.com/google/go-cmp v0.6.0 // indirect
19+
github.com/klauspost/compress v1.17.11 // indirect
2420
github.com/pkg/errors v0.9.1 // indirect
25-
github.com/stretchr/testify v1.9.0 // indirect
26-
go.opencensus.io v0.22.5 // indirect
27-
golang.org/x/net v0.22.0 // indirect
28-
golang.org/x/sys v0.18.0 // indirect
29-
google.golang.org/protobuf v1.31.0 // indirect
21+
go.opencensus.io v0.24.0 // indirect
22+
golang.org/x/net v0.33.0 // indirect
23+
golang.org/x/sys v0.28.0 // indirect
24+
google.golang.org/protobuf v1.36.0 // indirect
3025
)

0 commit comments

Comments
 (0)