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

This commit is contained in:
Nick Craig-Wood 2020-08-18 17:31:39 +01:00
parent c4c6a1ee7d
commit 47d08ac1f1

View File

@ -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