Add Piece.UpdateCompletion() method
This should be all that is needed to handle pieces that are evicted or removed from storage if you are using a storage implementation such as an LRU cache.
This commit is contained in:
parent
c435d713c4
commit
6920298770
6
piece.go
6
piece.go
|
@ -239,6 +239,12 @@ func (p *Piece) uncachedPriority() (ret piecePriority) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *Piece) UpdateCompletion() {
|
||||
p.t.cl.lock()
|
||||
defer p.t.cl.unlock()
|
||||
p.t.updatePieceCompletion(p.index)
|
||||
}
|
||||
|
||||
func (p *Piece) completion() (ret storage.Completion) {
|
||||
ret.Complete = p.t.pieceComplete(p.index)
|
||||
ret.Ok = p.storageCompletionOk
|
||||
|
|
Loading…
Reference in New Issue