fs: define SlowModTime and SlowHash features in the relevant backends
This commit is contained in:
parent
af601575cb
commit
c820576329
6 changed files with 11 additions and 0 deletions
|
@ -231,6 +231,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||||
CaseInsensitive: f.caseInsensitive(),
|
CaseInsensitive: f.caseInsensitive(),
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
IsLocal: true,
|
IsLocal: true,
|
||||||
|
SlowHash: true,
|
||||||
}).Fill(f)
|
}).Fill(f)
|
||||||
if opt.FollowSymlinks {
|
if opt.FollowSymlinks {
|
||||||
f.lstat = os.Stat
|
f.lstat = os.Stat
|
||||||
|
|
|
@ -356,6 +356,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(f)
|
||||||
|
|
||||||
if f.rootBucket != "" && f.rootDirectory != "" {
|
if f.rootBucket != "" && f.rootDirectory != "" {
|
||||||
|
|
|
@ -1334,6 +1334,7 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
SetTier: true,
|
SetTier: true,
|
||||||
GetTier: true,
|
GetTier: true,
|
||||||
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(f)
|
||||||
if f.rootBucket != "" && f.rootDirectory != "" {
|
if f.rootBucket != "" && f.rootDirectory != "" {
|
||||||
// Check to see if the object exists
|
// Check to see if the object exists
|
||||||
|
|
|
@ -500,6 +500,7 @@ func NewFsWithConnection(ctx context.Context, name string, root string, m config
|
||||||
}
|
}
|
||||||
f.features = (&fs.Features{
|
f.features = (&fs.Features{
|
||||||
CanHaveEmptyDirectories: true,
|
CanHaveEmptyDirectories: true,
|
||||||
|
SlowHash: true,
|
||||||
}).Fill(f)
|
}).Fill(f)
|
||||||
// Make a connection and pool it to return errors early
|
// Make a connection and pool it to return errors early
|
||||||
c, err := f.getSftpConnection()
|
c, err := f.getSftpConnection()
|
||||||
|
|
|
@ -447,6 +447,7 @@ func NewFsWithConnection(opt *Options, name, root string, c *swift.Connection, n
|
||||||
WriteMimeType: true,
|
WriteMimeType: true,
|
||||||
BucketBased: true,
|
BucketBased: true,
|
||||||
BucketBasedRootOK: true,
|
BucketBasedRootOK: true,
|
||||||
|
SlowModTime: true,
|
||||||
}).Fill(f)
|
}).Fill(f)
|
||||||
if f.rootContainer != "" && f.rootDirectory != "" {
|
if f.rootContainer != "" && f.rootDirectory != "" {
|
||||||
// Check to see if the object exists - ignoring directory markers
|
// Check to see if the object exists - ignoring directory markers
|
||||||
|
|
6
fs/fs.go
6
fs/fs.go
|
@ -515,6 +515,8 @@ type Features struct {
|
||||||
GetTier bool // allows to retrieve storage tier of objects
|
GetTier bool // allows to retrieve storage tier of objects
|
||||||
ServerSideAcrossConfigs bool // can server side copy between different remotes of the same type
|
ServerSideAcrossConfigs bool // can server side copy between different remotes of the same type
|
||||||
IsLocal bool // is the local backend
|
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
|
// 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.BucketBasedRootOK = ft.BucketBasedRootOK && mask.BucketBasedRootOK
|
||||||
ft.SetTier = ft.SetTier && mask.SetTier
|
ft.SetTier = ft.SetTier && mask.SetTier
|
||||||
ft.GetTier = ft.GetTier && mask.GetTier
|
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 {
|
if mask.Purge == nil {
|
||||||
ft.Purge = nil
|
ft.Purge = nil
|
||||||
|
|
Loading…
Reference in a new issue