New release of dque: a fast, embedded, persistent queue


(Jon Carlson) #1

Dque has now reached version 2.

The v2 functionality includes a turbo mode that, instead of fsync-ing every enqueue and dequeue to disk, allows the operating system to decide when to fsync. This speeds up the performance by about 10x on my local SSD drive. Turbo mode is off by default.

I would appreciate code reviews and feedback from people who try it out. Is it easy to use and understand? Is the documentation clear? Did I use any anti-patterns? (I don’t think so, but I sometimes miss something). I could also use some advice on versioning it to support the new Go Modules in Go 1.11. I haven’t completely grokked that yet.


(Johan Dahl) #2

Hi

Took just one quick peek. I noticed two things. In most written text you refer to the package as Dque instead of the name dque for example then you talk about switching turbo mode on an off.

Why are you putting the tests in its own package? It is not needed and on https://golang.org/pkg/testing/ it says:

To write a new test suite, create a file whose name ends _test.go that contains the TestXxx functions as described here. Put the file in the same package as the one being tested. The file will be excluded from regular package builds but will be included when the “go test” command is run. For more detail, run “go help test” and “go help testflag”.


(Jon Carlson) #3

Hello Johan, Thank you for reviewing my code. I normally do whitebox testing (inside the same package), but for one of the tests I wanted to test just the API. So I changed the package to add _test to the end of it. It was an example I had seen before.

I’m glad you questioned it because there may be some more testing I could do with access to the internals.

When I use DQue, it is referring to the public object that has the TurboOn() and TurboOff() methods. When I use dque, it means the package. Thank you for your time to look at my code.

  • Jon