storage/boltPieceCompletion.go | 10 +++++----- storage/bolt_piece.go | 8 ++++---- storage/boltdb.go | 8 ++++---- diff --git a/storage/boltPieceCompletion.go b/storage/boltPieceCompletion.go index 2ad0b4b86ce1148c4e67d19176dc7bf4f5823fc1..36fc6c1fa1405ab6776c5897ba63b1e73759d7ec 100644 --- a/storage/boltPieceCompletion.go +++ b/storage/boltPieceCompletion.go @@ -6,7 +6,7 @@ "os" "path/filepath" "time" - bolt "go.etcd.io/bbolt" + "go.etcd.io/bbolt" "github.com/anacrolix/torrent/metainfo" ) @@ -21,7 +21,7 @@ completionBucketKey = []byte("completion") ) type boltPieceCompletion struct { - db *bolt.DB + db *bbolt.DB } var _ PieceCompletion = (*boltPieceCompletion)(nil) @@ -29,7 +29,7 @@ func NewBoltPieceCompletion(dir string) (ret PieceCompletion, err error) { os.MkdirAll(dir, 0770) p := filepath.Join(dir, ".torrent.bolt.db") - db, err := bolt.Open(p, 0660, &bolt.Options{ + db, err := bbolt.Open(p, 0660, &bbolt.Options{ Timeout: time.Second, }) if err != nil { @@ -41,7 +41,7 @@ return } func (me boltPieceCompletion) Get(pk metainfo.PieceKey) (cn Completion, err error) { - err = me.db.View(func(tx *bolt.Tx) error { + err = me.db.View(func(tx *bbolt.Tx) error { cb := tx.Bucket(completionBucketKey) if cb == nil { return nil @@ -67,7 +67,7 @@ return } func (me boltPieceCompletion) Set(pk metainfo.PieceKey, b bool) error { - return me.db.Update(func(tx *bolt.Tx) error { + return me.db.Update(func(tx *bbolt.Tx) error { c, err := tx.CreateBucketIfNotExists(completionBucketKey) if err != nil { return err diff --git a/storage/bolt_piece.go b/storage/bolt_piece.go index 6fa5271dcc42bf1c9cabfec98f1a16e09835d0f3..a932bea4cec05686bdffe5cac26ef9d108bbc5ae 100644 --- a/storage/bolt_piece.go +++ b/storage/bolt_piece.go @@ -5,13 +5,13 @@ "encoding/binary" "io" "github.com/anacrolix/missinggo/x" - bolt "go.etcd.io/bbolt" + "go.etcd.io/bbolt" "github.com/anacrolix/torrent/metainfo" ) type boltDBPiece struct { - db *bolt.DB + db *bbolt.DB p metainfo.Piece ih metainfo.Hash key [24]byte @@ -44,7 +44,7 @@ func (me *boltDBPiece) MarkNotComplete() error { return me.pc().Set(me.pk(), false) } func (me *boltDBPiece) ReadAt(b []byte, off int64) (n int, err error) { - err = me.db.View(func(tx *bolt.Tx) error { + err = me.db.View(func(tx *bbolt.Tx) error { db := tx.Bucket(dataBucketKey) if db == nil { return io.EOF @@ -76,7 +76,7 @@ return } func (me *boltDBPiece) WriteAt(b []byte, off int64) (n int, err error) { - err = me.db.Update(func(tx *bolt.Tx) error { + err = me.db.Update(func(tx *bbolt.Tx) error { db, err := tx.CreateBucketIfNotExists(dataBucketKey) if err != nil { return err diff --git a/storage/boltdb.go b/storage/boltdb.go index 015e3d90392f55de36a2c902cc4a4a4e31f7f3e4..f95d2a607f8ccddb63e708984563d6b15a1e1ea1 100644 --- a/storage/boltdb.go +++ b/storage/boltdb.go @@ -6,19 +6,19 @@ "path/filepath" "time" "github.com/anacrolix/missinggo/expect" - bolt "go.etcd.io/bbolt" + "go.etcd.io/bbolt" "github.com/anacrolix/torrent/metainfo" ) const ( // Chosen to match the usual chunk size in a torrent client. This way, - // most chunk writes are to exactly one full item in bolt DB. + // most chunk writes are to exactly one full item in bbolt DB. chunkSize = 1 << 14 ) type boltDBClient struct { - db *bolt.DB + db *bbolt.DB } type boltDBTorrent struct { @@ -27,7 +27,7 @@ ih metainfo.Hash } func NewBoltDB(filePath string) ClientImplCloser { - db, err := bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bolt.Options{ + db, err := bbolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bbolt.Options{ Timeout: time.Second, }) expect.Nil(err)