"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
smb: implement multi-threaded writes for copies to smb
Edwin Mackenzie-Owenc3989d190609
diff --git a/backend/smb/smb.go b/backend/smb/smb.goindex 6f1640cf4..b9ad5353b 100644--- a/backend/smb/smb.go+++ b/backend/smb/smb.go@@ -475,6 +475,45 @@ func (f *Fs) About(ctx context.Context) (_ *fs.Usage, err error) {return usage, nil}+// OpenWriterAt opens with a handle for random access writes+//+// Pass in the remote desired and the size if known.+//+// It truncates any existing object+func (f *Fs) OpenWriterAt(ctx context.Context, remote string, size int64) (fs.WriterAtCloser, error) {+ var err error+ o := &Object{+ fs: f,+ remote: remote,+ }+ share, filename := o.split()+ if share == "" || filename == "" {+ return nil, fs.ErrorIsDir+ }++ err = o.fs.ensureDirectory(ctx, share, filename)+ if err != nil {+ return nil, fmt.Errorf("failed to make parent directories: %w", err)+ }++ filename = o.fs.toSambaPath(filename)++ o.fs.addSession() // Show session in use+ defer o.fs.removeSession()++ cn, err := o.fs.getConnection(ctx, share)+ if err != nil {+ return nil, err+ }++ fl, err := cn.smbShare.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)+ if err != nil {+ return nil, fmt.Errorf("failed to open: %w", err)+ }++ return fl, nil+}+// Shutdown the backend, closing any background tasks and any// cached connections.func (f *Fs) Shutdown(ctx context.Context) error {