diff --git a/backend/combine/combine.go b/backend/combine/combine.go index 2e1ad2a7b..2457bc4f1 100644 --- a/backend/combine/combine.go +++ b/backend/combine/combine.go @@ -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 diff --git a/backend/union/union.go b/backend/union/union.go index 1b3c0f4db..78a713896 100644 --- a/backend/union/union.go +++ b/backend/union/union.go @@ -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 diff --git a/fs/features.go b/fs/features.go index 2ba54abe2..4c3612285 100644 --- a/fs/features.go +++ b/fs/features.go @@ -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 diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go index 46a6ff4b5..ddd20c97a 100644 --- a/fstest/fstests/fstests.go +++ b/fstest/fstests/fstests.go @@ -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()