github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/backend/cache/utils_test.go (about)

     1  package cache
     2  
     3  import bolt "go.etcd.io/bbolt"
     4  
     5  // PurgeTempUploads will remove all the pending uploads from the queue
     6  func (b *Persistent) PurgeTempUploads() {
     7  	b.tempQueueMux.Lock()
     8  	defer b.tempQueueMux.Unlock()
     9  
    10  	_ = b.db.Update(func(tx *bolt.Tx) error {
    11  		_ = tx.DeleteBucket([]byte(tempBucket))
    12  		_, _ = tx.CreateBucketIfNotExists([]byte(tempBucket))
    13  		return nil
    14  	})
    15  }
    16  
    17  // SetPendingUploadToStarted is a way to mark an entry as started (even if it's not already)
    18  func (b *Persistent) SetPendingUploadToStarted(remote string) error {
    19  	return b.updatePendingUpload(remote, func(item *tempUploadInfo) error {
    20  		item.Started = true
    21  		return nil
    22  	})
    23  }