]> Sergey Matveev's repositories - btrtrc.git/blobdiff - piece.go
Drop support for go 1.20
[btrtrc.git] / piece.go
index 680675bab3d0f8b1d94c9d1183f211b3e0ae0c28..e08b2609690e385663c4df716d22d05ab3c7808b 100644 (file)
--- a/piece.go
+++ b/piece.go
@@ -6,6 +6,7 @@ import (
 
        "github.com/anacrolix/chansync"
        "github.com/anacrolix/missinggo/v2/bitmap"
+
        "github.com/anacrolix/torrent/metainfo"
        pp "github.com/anacrolix/torrent/peer_protocol"
        "github.com/anacrolix/torrent/storage"
@@ -54,6 +55,12 @@ func (p *Piece) Storage() storage.Piece {
        return p.t.storage.Piece(p.Info())
 }
 
+func (p *Piece) Flush() {
+       if p.t.storage.Flush != nil {
+               _ = p.t.storage.Flush()
+       }
+}
+
 func (p *Piece) pendingChunkIndex(chunkIndex chunkIndexType) bool {
        return !p.chunkIndexDirty(chunkIndex)
 }