Skip to content

Commit

Permalink
Use badger v2.0.0-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Jul 11, 2019
1 parent 82a8a64 commit 4b0d4d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 4 additions & 6 deletions dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ type JobOptions struct {

// NewStore creates a new Storage instance.
func NewStore(a *Agent, dir string) (*Store, error) {
opts := badger.DefaultOptions
opts.Dir = dir
opts.ValueDir = dir
opts := badger.DefaultOptions(dir)

db, err := badger.Open(opts)
if err != nil {
Expand Down Expand Up @@ -636,7 +634,7 @@ ConflictRetry:
return err
}

err = txn.Commit(nil)
err = txn.Commit()

// commit failed with conflict
if err == badger.ErrConflict {
Expand All @@ -652,7 +650,7 @@ ConflictRetry:
}

it.Close()
err := txn.Commit(nil)
err := txn.Commit()

// commit failed with conflict
if err == badger.ErrConflict {
Expand All @@ -679,7 +677,7 @@ func (s *Store) Snapshot(w io.WriteCloser) error {

// Restore load data created with backup in to Badger
func (s *Store) Restore(r io.ReadCloser) error {
return s.db.Load(r)
return s.db.Load(r, 0)
}

func (s *Store) unmarshalExecutions(items []*kv, stopWord string) ([]*Execution, error) {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ require (
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
github.com/boltdb/bolt v1.3.1 // indirect
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/dgraph-io/badger v1.5.4
github.com/dgraph-io/badger v2.0.0-rc2+incompatible
github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gin-contrib/expvar v0.0.0-20180827025536-251166f58ff2
github.com/gin-contrib/multitemplate v0.0.0-20170922032617-bbc6daf6024b
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/badger v1.5.4 h1:gVTrpUTbbr/T24uvoCaqY2KSHfNLVGm0w+hbee2HMeg=
github.com/dgraph-io/badger v1.5.4/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
github.com/dgraph-io/badger v2.0.0-rc2+incompatible h1:6fXfqViMStaKb73bxivvD9hgwYdWyiEKzwWNVkXhslE=
github.com/dgraph-io/badger v2.0.0-rc2+incompatible/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f h1:dDxpBYafY/GYpcl+LS4Bn3ziLPuEdGRkRjYAbSlWxSA=
github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down

0 comments on commit 4b0d4d0

Please sign in to comment.