MCPcopy
hub / github.com/rclone/rclone / addPendingUpload

Method addPendingUpload

backend/cache/storage_persistent.go:767–791  ·  view source on GitHub ↗

addPendingUpload adds a new file to the pending queue of uploads

(destPath string, started bool)

Source from the content-addressed store, hash-verified

765
766// addPendingUpload adds a new file to the pending queue of uploads
767func (b *Persistent) addPendingUpload(destPath string, started bool) error {
768 return b.db.Update(func(tx *bolt.Tx) error {
769 bucket, err := tx.CreateBucketIfNotExists([]byte(tempBucket))
770 if err != nil {
771 return fmt.Errorf("couldn't bucket for %v", tempBucket)
772 }
773 tempObj := &tempUploadInfo{
774 DestPath: destPath,
775 AddedOn: time.Now(),
776 Started: started,
777 }
778
779 // cache Object Info
780 encoded, err := json.Marshal(tempObj)
781 if err != nil {
782 return fmt.Errorf("couldn't marshal object (%v) info: %v", destPath, err)
783 }
784 err = bucket.Put([]byte(destPath), encoded)
785 if err != nil {
786 return fmt.Errorf("couldn't cache object (%v) info: %v", destPath, err)
787 }
788
789 return nil
790 })
791}
792
793// getPendingUpload returns the next file from the pending queue of uploads
794func (b *Persistent) getPendingUpload(inRoot string, waitTime time.Duration) (destPath string, err error) {

Callers 1

putMethod · 0.80

Calls 3

UpdateMethod · 0.65
PutMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected