From c8205763292ae58032f8f276ed82716488b753cb Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 19 Jun 2020 10:28:34 +0100 Subject: [PATCH] fs: define SlowModTime and SlowHash features in the relevant backends --- backend/local/local.go | 1 + backend/qingstor/qingstor.go | 1 + backend/s3/s3.go | 1 + backend/sftp/sftp.go | 1 + backend/swift/swift.go | 1 + fs/fs.go | 6 ++++++ 6 files changed, 11 insertions(+) diff --git a/backend/local/local.go b/backend/local/local.go index 02367cfe1..af170e585 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -231,6 +231,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) { CaseInsensitive: f.caseInsensitive(), CanHaveEmptyDirectories: true, IsLocal: true, + SlowHash: true, }).Fill(f) if opt.FollowSymlinks { f.lstat = os.Stat diff --git a/backend/qingstor/qingstor.go b/backend/qingstor/qingstor.go index 9e56d4c23..34fa276ed 100644 --- a/backend/qingstor/qingstor.go +++ b/backend/qingstor/qingstor.go @@ -356,6 +356,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) { WriteMimeType: true, BucketBased: true, BucketBasedRootOK: true, + SlowModTime: true, }).Fill(f) if f.rootBucket != "" && f.rootDirectory != "" { diff --git a/backend/s3/s3.go b/backend/s3/s3.go index d8ec3fbc3..0b66088dc 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1334,6 +1334,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) { BucketBasedRootOK: true, SetTier: true, GetTier: true, + SlowModTime: true, }).Fill(f) if f.rootBucket != "" && f.rootDirectory != "" { // Check to see if the object exists diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 51d03de08..a3d2618e6 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -500,6 +500,7 @@ func NewFsWithConnection(ctx context.Context, name string, root string, m config } f.features = (&fs.Features{ CanHaveEmptyDirectories: true, + SlowHash: true, }).Fill(f) // Make a connection and pool it to return errors early c, err := f.getSftpConnection() diff --git a/backend/swift/swift.go b/backend/swift/swift.go index 394f40d1e..c94b79822 100644 --- a/backend/swift/swift.go +++ b/backend/swift/swift.go @@ -447,6 +447,7 @@ func NewFsWithConnection(opt *Options, name, root string, c *swift.Connection, n WriteMimeType: true, BucketBased: true, BucketBasedRootOK: true, + SlowModTime: true, }).Fill(f) if f.rootContainer != "" && f.rootDirectory != "" { // Check to see if the object exists - ignoring directory markers diff --git a/fs/fs.go b/fs/fs.go index 121898a97..0348f1296 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -515,6 +515,8 @@ type Features struct { GetTier bool // allows to retrieve storage tier of objects ServerSideAcrossConfigs bool // can server side copy between different remotes of the same type IsLocal bool // is the local backend + SlowModTime bool // if calling ModTime() generally takes an extra transaction + SlowHash bool // if calling Hash() generally takes an extra transaction // Purge all files in the root and the root directory // @@ -792,6 +794,10 @@ func (ft *Features) Mask(f Fs) *Features { ft.BucketBasedRootOK = ft.BucketBasedRootOK && mask.BucketBasedRootOK ft.SetTier = ft.SetTier && mask.SetTier ft.GetTier = ft.GetTier && mask.GetTier + ft.ServerSideAcrossConfigs = ft.ServerSideAcrossConfigs && mask.ServerSideAcrossConfigs + // ft.IsLocal = ft.IsLocal && mask.IsLocal Don't propagate IsLocal + ft.SlowModTime = ft.SlowModTime && mask.SlowModTime + ft.SlowHash = ft.SlowHash && mask.SlowHash if mask.Purge == nil { ft.Purge = nil