lib/fs: Consider options in case-fs caching (fixes #7371) (#7381)

This commit is contained in:
Simon Frei
2021-02-22 18:27:40 +01:00
committed by Jakob Borg
parent b0cce98648
commit 9be6f1a70e
4 changed files with 37 additions and 15 deletions
+10 -7
View File
@@ -27,12 +27,15 @@ var (
)
func WithJunctionsAsDirs() Option {
return func(fs Filesystem) {
if basic, ok := fs.(*BasicFilesystem); !ok {
l.Warnln("WithJunctionsAsDirs must only be used with FilesystemTypeBasic")
} else {
basic.junctionsAsDirs = true
}
return Option{
apply: func(fs Filesystem) {
if basic, ok := fs.(*BasicFilesystem); !ok {
l.Warnln("WithJunctionsAsDirs must only be used with FilesystemTypeBasic")
} else {
basic.junctionsAsDirs = true
}
},
id: "junctionsAsDirs",
}
}
@@ -82,7 +85,7 @@ func newBasicFilesystem(root string, opts ...Option) *BasicFilesystem {
root: root,
}
for _, opt := range opts {
opt(fs)
opt.apply(fs)
}
return fs
}