"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
* rc/jobs: Add SetInitialJobID function that allows for setting the jobID
Michal Matczuk5d6593de4ffc
diff --git a/fs/rc/jobs/job.go b/fs/rc/jobs/job.goindex b2c18da5b..186127d0f 100644--- a/fs/rc/jobs/job.go+++ b/fs/rc/jobs/job.go@@ -10,12 +10,10 @@ import ("sync/atomic""time"- "github.com/rclone/rclone/fs/rc"-- "github.com/rclone/rclone/fs/accounting"-"github.com/pkg/errors""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/accounting"+ "github.com/rclone/rclone/fs/rc")// Job describes a asynchronous task started via the rc package@@ -59,6 +57,13 @@ func SetOpt(opt *rc.Options) {running.opt = opt}+// SetInitialJobID allows for setting jobID before starting any jobs.+func SetInitialJobID(id int64) {+ if !atomic.CompareAndSwapInt64(&jobID, 0, id) {+ panic("Setting jobID is only possible before starting any jobs")+ }+}+// kickExpire makes sure Expire is runningfunc (jobs *Jobs) kickExpire() {jobs.mu.Lock()