Skip to content

Commit

Permalink
First Pass Replace
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Christoff committed Mar 26, 2021
1 parent 4207f1b commit 22de16c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions bolt_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package raftboltdb
import (
"errors"

"github.com/boltdb/bolt"
"go.etcd.io/bbolt"
"github.com/hashicorp/raft"
)

Expand All @@ -27,7 +27,7 @@ var (
// a LogStore and StableStore.
type BoltStore struct {
// conn is the underlying handle to the db.
conn *bolt.DB
conn *bbolt.DB

// The path to the Bolt database file
path string
Expand All @@ -40,7 +40,7 @@ type Options struct {

// BoltOptions contains any specific BoltDB options you might
// want to specify [e.g. open timeout]
BoltOptions *bolt.Options
BoltOptions *bbolt.Options

// NoSync causes the database to skip fsync calls after each
// write to the log. This is unsafe, so it should be used
Expand All @@ -63,7 +63,7 @@ func NewBoltStore(path string) (*BoltStore, error) {
// New uses the supplied options to open the BoltDB and prepare it for use as a raft backend.
func New(options Options) (*BoltStore, error) {
// Try to connect
handle, err := bolt.Open(options.Path, dbFileMode, options.BoltOptions)
handle, err := bbolt.Open(options.Path, dbFileMode, options.BoltOptions)
if err != nil {
return nil, err
}
Expand Down
16 changes: 8 additions & 8 deletions bolt_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/boltdb/bolt"
"go.etcd.io/bbolt"
"github.com/hashicorp/raft"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func TestBoltOptionsTimeout(t *testing.T) {
defer os.Remove(fh.Name())
options := Options{
Path: fh.Name(),
BoltOptions: &bolt.Options{
BoltOptions: &bbolt.Options{
Timeout: time.Second / 10,
},
}
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestBoltOptionsReadOnly(t *testing.T) {
store.Close()
options := Options{
Path: fh.Name(),
BoltOptions: &bolt.Options{
BoltOptions: &bbolt.Options{
Timeout: time.Second / 10,
ReadOnly: true,
},
Expand All @@ -123,8 +123,8 @@ func TestBoltOptionsReadOnly(t *testing.T) {
}
// Attempt to store the log, should fail on a read-only store
err = roStore.StoreLog(log)
if err != bolt.ErrDatabaseReadOnly {
t.Errorf("expecting error %v, but got %v", bolt.ErrDatabaseReadOnly, err)
if err != bbolt.ErrDatabaseReadOnly {
t.Errorf("expecting error %v, but got %v", bbolt.ErrDatabaseReadOnly, err)
}
}

Expand Down Expand Up @@ -156,18 +156,18 @@ func TestNewBoltStore(t *testing.T) {
}

// Ensure our tables were created
db, err := bolt.Open(fh.Name(), dbFileMode, nil)
db, err := bbolt.Open(fh.Name(), dbFileMode, nil)
if err != nil {
t.Fatalf("err: %s", err)
}
tx, err := db.Begin(true)
if err != nil {
t.Fatalf("err: %s", err)
}
if _, err := tx.CreateBucket([]byte(dbLogs)); err != bolt.ErrBucketExists {
if _, err := tx.CreateBucket([]byte(dbLogs)); err != bbolt.ErrBucketExists {
t.Fatalf("bad: %v", err)
}
if _, err := tx.CreateBucket([]byte(dbConf)); err != bolt.ErrBucketExists {
if _, err := tx.CreateBucket([]byte(dbConf)); err != bbolt.ErrBucketExists {
t.Fatalf("bad: %v", err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/hashicorp/raft-boltdb
go 1.12

require (
github.com/boltdb/bolt v1.3.1
// github.com/boltdb/bolt v1.3.1
github.com/hashicorp/go-msgpack v0.5.5
github.com/hashicorp/raft v1.1.0
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed // indirect
go.etcd.io/bbolt v1.3.5
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed h1:uPxWBzB3+mlnjy9W58qY1j/cjyFjutgw/Vhan2zLy/A=
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

0 comments on commit 22de16c

Please sign in to comment.