]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/bolt.go
Add cove to downstream projects
[btrtrc.git] / storage / bolt.go
index af75061aea8a37a1b770cac79f7f7ba8df9a9cc9..945b24995db936df6b401f3eb546c36c2d2d14d2 100644 (file)
@@ -1,3 +1,6 @@
+//go:build !noboltdb && !wasm
+// +build !noboltdb,!wasm
+
 package storage
 
 import (
@@ -27,7 +30,7 @@ type boltTorrent struct {
 }
 
 func NewBoltDB(filePath string) ClientImplCloser {
-       db, err := bbolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bbolt.Options{
+       db, err := bbolt.Open(filepath.Join(filePath, "bolt.db"), 0o600, &bbolt.Options{
                Timeout: time.Second,
        })
        expect.Nil(err)
@@ -39,8 +42,12 @@ func (me *boltClient) Close() error {
        return me.db.Close()
 }
 
-func (me *boltClient) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (TorrentImpl, error) {
-       return &boltTorrent{me, infoHash}, nil
+func (me *boltClient) OpenTorrent(_ *metainfo.Info, infoHash metainfo.Hash) (TorrentImpl, error) {
+       t := &boltTorrent{me, infoHash}
+       return TorrentImpl{
+               Piece: t.Piece,
+               Close: t.Close,
+       }, nil
 }
 
 func (me *boltTorrent) Piece(p metainfo.Piece) PieceImpl {