github.com/artpar/rclone@v1.67.3/backend/cache/utils_test.go (about)

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