lib/fs: Expose fs option on interface (fixes #7385, ref #7381) (#7389)

This commit is contained in:
Simon Frei
2021-03-11 15:23:56 +01:00
committed by GitHub
parent cdef503db6
commit 3938b61c3f
9 changed files with 74 additions and 36 deletions
+10 -3
View File
@@ -47,6 +47,7 @@ type Filesystem interface {
Usage(name string) (Usage, error)
Type() FilesystemType
URI() string
Options() []Option
SameFile(fi1, fi2 FileInfo) bool
}
@@ -178,9 +179,15 @@ var IsPermission = os.IsPermission
// IsPathSeparator is the equivalent of os.IsPathSeparator
var IsPathSeparator = os.IsPathSeparator
type Option struct {
apply func(Filesystem)
id string
// Option modifies a filesystem at creation. An option might be specific
// to a filesystem-type.
//
// String is used to detect options with the same effect, i.e. must be different
// for options with different effects. Meaning if an option has parameters, a
// representation of those must be part of the returned string.
type Option interface {
String() string
apply(Filesystem)
}
func NewFilesystem(fsType FilesystemType, uri string, opts ...Option) Filesystem {