chore: aria2 related function
This commit is contained in:
@ -347,6 +347,13 @@ func (m *MapOf[K, V]) Values() []V {
|
||||
return values
|
||||
}
|
||||
|
||||
func (m *MapOf[K, V]) Clear() {
|
||||
m.Range(func(key K, value V) bool {
|
||||
m.Delete(key)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (m *MapOf[K, V]) missLocked() {
|
||||
m.misses++
|
||||
if m.misses < len(m.dirty) {
|
||||
|
@ -75,6 +75,12 @@ func (tm *Manager) Remove(tid uint64) {
|
||||
tm.tasks.Delete(tid)
|
||||
}
|
||||
|
||||
// RemoveAll removes all tasks from the manager, this maybe shouldn't be used
|
||||
// because the task maybe still running.
|
||||
func (tm *Manager) RemoveAll() {
|
||||
tm.tasks.Clear()
|
||||
}
|
||||
|
||||
func (tm *Manager) RemoveFinished() {
|
||||
tasks := tm.GetAll()
|
||||
for _, task := range tasks {
|
||||
|
Reference in New Issue
Block a user