dirfs
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package dirfs provides a webdav.FileSystem that looks like a read-onlydirectory containing only subdirectories.
Index¶
- type Child
- type FS
- func (dfs *FS) Mkdir(ctx context.Context, name string, perm os.FileMode) error
- func (dfs *FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
- func (dfs *FS) RemoveAll(ctx context.Context, name string) error
- func (dfs *FS) Rename(ctx context.Context, oldName, newName string) error
- func (dfs *FS) Stat(ctx context.Context, name string) (fs.FileInfo, error)
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeChild¶
type Child struct {// Name is the name of the childNamestring// Available is a function indicating whether or not the child is currently// available. Unavailable children are excluded from the FS's directory// listing. Available must be safe for concurrent use.Available func()bool}Child is subdirectory of an FS.
typeFS¶
type FS struct {// Children configures the full set of children of this FS.Children []*Child// Clock, if given, will cause this FS to use Clock.now() as the current// time.Clocktstime.Clock// StaticRoot, if given, will insert the given name as a static root into// every path.StaticRootstring}FS is a read-only webdav.FileSystem that is composed of multiple childfolders.
When listing the contents of this FileSystem's root directory, children willbe ordered in the order they're given to the FS.
Children in an FS cannot be added, removed or renamed via operations on thewebdav.FileSystem interface like filesystem.Mkdir or filesystem.OpenFile.
Any attempts to perform operations on paths inside of children will resultin a panic, as these are not expected to be performed on this FS.
An FS can optionally have a StaticRoot, which will insert a folder with thatStaticRoot into the tree, like this:
-- <StaticRoot>----- <Child>----- <Child>
func (*FS)Mkdir¶
Mkdir implements webdav.FileSystem. All attempts to Mkdir a directory thatalready exists will succeed. All other attempts will fail withos.ErrPermission.
func (*FS)OpenFile¶
func (dfs *FS) OpenFile(ctxcontext.Context, namestring, flagint, permos.FileMode) (webdav.File,error)
OpenFile implements interface webdav.Filesystem.
func (*FS)RemoveAll¶
RemoveAll implements webdav.File. No removal is supported and this alwaysreturns os.ErrPermission.