Skip to content

Commit

Permalink
replace dque with pdque
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuskimmina committed Nov 15, 2023
1 parent 0056fb2 commit 35815bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module go.mondoo.com/cnspec/v9

go 1.21
go 1.21.1

// replace go.mondoo.com/cnquery/v9 => ../cnquery
replace go.mondoo.com/pdque => ../pdque

toolchain go1.21.3

require go.mondoo.com/cnquery/v9 v9.5.0
require (
go.mondoo.com/cnquery/v9 v9.5.0
go.mondoo.com/pdque v0.0.0-00010101000000-000000000000
)

require (
github.com/Masterminds/semver v1.5.0
Expand All @@ -17,7 +21,6 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/go-version v1.6.0
github.com/joncrlsn/dque v0.0.0-20211108142734-c2ef48c5192a
github.com/jstemmer/go-junit-report/v2 v2.1.0
github.com/mattn/go-isatty v0.0.20
github.com/mitchellh/mapstructure v1.5.0
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
Expand Down Expand Up @@ -548,8 +547,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joncrlsn/dque v0.0.0-20211108142734-c2ef48c5192a h1:sfe532Ipn7GX0V6mHdynBk393rDmqgI0QmjLK7ct7TU=
github.com/joncrlsn/dque v0.0.0-20211108142734-c2ef48c5192a/go.mod h1:dNKs71rs2VJGBAmttu7fouEsRQlRjxy0p1Sx+T5wbpY=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down Expand Up @@ -589,7 +586,6 @@ github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down
12 changes: 4 additions & 8 deletions policy/scan/disk_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"sync"
"time"

"github.com/joncrlsn/dque"
"github.com/rs/zerolog/log"
"go.mondoo.com/pdque"

Check failure on line 13 in policy/scan/disk_queue.go

View workflow job for this annotation

GitHub Actions / go-test

go.mondoo.com/[email protected]: replacement directory ../pdque does not exist

Check failure on line 13 in policy/scan/disk_queue.go

View workflow job for this annotation

GitHub Actions / go-test

go.mondoo.com/[email protected]: replacement directory ../pdque does not exist

Check failure on line 13 in policy/scan/disk_queue.go

View workflow job for this annotation

GitHub Actions / go-test

go.mondoo.com/[email protected]: replacement directory ../pdque does not exist
"google.golang.org/protobuf/proto"
)

Expand Down Expand Up @@ -40,7 +40,7 @@ type queuePayload struct {
}

type diskQueueClient struct {
queue *dque.DQue
queue *pdque.Queue
once sync.Once
wg sync.WaitGroup
entries chan Job
Expand Down Expand Up @@ -68,15 +68,11 @@ func newDqueClient(config diskQueueConfig, handler func(job *Job)) (*diskQueueCl
return nil, fmt.Errorf("cannot create queue directory: %s", err)
}

q.queue, err = dque.NewOrOpen(config.filename, config.dir, config.segmentSize, diskQueueEntryBuilder)
q.queue, err = pdque.NewOrOpen(config.filename, config.dir, config.segmentSize, diskQueueEntryBuilder)
if err != nil {
return nil, err
}

if !config.sync {
_ = q.queue.TurboOn()
}

q.entries = make(chan Job)

q.wg.Add(2)
Expand Down Expand Up @@ -127,7 +123,7 @@ func (c *diskQueueClient) popper() {
entry, err := c.queue.DequeueBlock()
if err != nil {
switch err {
case dque.ErrQueueClosed:
case pdque.ErrQueueClosed:
return
default:
log.Error().Err(err).Msg("could not pop job from disk queue")
Expand Down

0 comments on commit 35815bd

Please sign in to comment.