Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: recommend --vfs-cache-modes writes on backends which can't stream

Nick Craig-Wood47d08ac1f12f
diff --git a/vfs/vfs.go b/vfs/vfs.go
index 58d725648..dd54bdb9a 100644
--- a/vfs/vfs.go
+++ b/vfs/vfs.go
@@ -216,7 +216,8 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
vfs.root = newDir(vfs, f, nil, fsDir)
// Start polling function
- if do := vfs.f.Features().ChangeNotify; do != nil {
+ features := vfs.f.Features()
+ if do := features.ChangeNotify; do != nil {
vfs.pollChan = make(chan time.Duration)
do(context.TODO(), vfs.root.changeNotify, vfs.pollChan)
vfs.pollChan <- vfs.Opt.PollInterval
@@ -224,6 +225,11 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
fs.Infof(f, "poll-interval is not supported by this remote")
}
+ // Warn if can't stream
+ if !vfs.Opt.ReadOnly && vfs.Opt.CacheMode < vfscommon.CacheModeWrites && features.PutStream == nil {
+ fs.Logf(f, "--vfs-cache-mode writes or full is recommended for this remote as it can't stream")
+ }
+
vfs.SetCacheMode(vfs.Opt.CacheMode)
// Pin the Fs into the cache so that when we use cache.NewFs