mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
fs: create Overlay feature flag to indicate backend wraps others
Set this automatically for any backend which implements UnWrap and manually for combine and union which can't implement UnWrap but do overlay other backends.
This commit is contained in:
parent
43fa256d56
commit
09a408664d
|
@ -299,6 +299,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (outFs fs
|
|||
}
|
||||
}
|
||||
|
||||
// show that we wrap other backends
|
||||
features.Overlay = true
|
||||
|
||||
f.features = features
|
||||
|
||||
// Get common intersection of hashes
|
||||
|
|
|
@ -914,6 +914,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
|||
}
|
||||
}
|
||||
|
||||
// show that we wrap other backends
|
||||
features.Overlay = true
|
||||
|
||||
f.features = features
|
||||
|
||||
// Get common intersection of hashes
|
||||
|
|
|
@ -32,6 +32,7 @@ type Features struct {
|
|||
FilterAware bool // can make use of filters if provided for listing
|
||||
PartialUploads bool // uploaded file can appear incomplete on the fs while it's being uploaded
|
||||
NoMultiThreading bool // set if can't have multiplethreads on one download open
|
||||
Overlay bool // this wraps one or more backends to add functionality
|
||||
|
||||
// Purge all files in the directory specified
|
||||
//
|
||||
|
@ -271,6 +272,7 @@ func (ft *Features) Fill(ctx context.Context, f Fs) *Features {
|
|||
if do, ok := f.(Wrapper); ok {
|
||||
ft.WrapFs = do.WrapFs
|
||||
ft.SetWrapper = do.SetWrapper
|
||||
ft.Overlay = true // if implement UnWrap then must be an Overlay
|
||||
}
|
||||
if do, ok := f.(DirCacheFlusher); ok {
|
||||
ft.DirCacheFlush = do.DirCacheFlush
|
||||
|
@ -339,6 +341,9 @@ func (ft *Features) Mask(ctx context.Context, f Fs) *Features {
|
|||
ft.SlowModTime = ft.SlowModTime && mask.SlowModTime
|
||||
ft.SlowHash = ft.SlowHash && mask.SlowHash
|
||||
ft.FilterAware = ft.FilterAware && mask.FilterAware
|
||||
ft.PartialUploads = ft.PartialUploads && mask.PartialUploads
|
||||
ft.NoMultiThreading = ft.NoMultiThreading && mask.NoMultiThreading
|
||||
// ft.Overlay = ft.Overlay && mask.Overlay don't propagate Overlay
|
||||
|
||||
if mask.Purge == nil {
|
||||
ft.Purge = nil
|
||||
|
|
|
@ -460,7 +460,7 @@ func Run(t *testing.T, opt *Opt) {
|
|||
t.Skip("Skipping FsCheckWrap on this Fs")
|
||||
}
|
||||
ft := new(fs.Features).Fill(ctx, f)
|
||||
if ft.UnWrap == nil {
|
||||
if ft.UnWrap == nil && !f.Features().Overlay {
|
||||
t.Skip("Not a wrapping Fs")
|
||||
}
|
||||
v := reflect.ValueOf(ft).Elem()
|
||||
|
|
Loading…
Reference in New Issue
Block a user