Documentation ¶
Overview ¶
Package dirfs provides a webdav.FileSystem that looks like a read-only directory 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 ¶
type Child ¶
type Child struct { // Name is the name of the child Name string // 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.
type FS ¶
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. Clock tstime.Clock // StaticRoot, if given, will insert the given name as a static root into // every path. StaticRoot string }
FS is a read-only webdav.FileSystem that is composed of multiple child folders.
When listing the contents of this FileSystem's root directory, children will be ordered in the order they're given to the FS.
Children in an FS cannot be added, removed or renamed via operations on the webdav.FileSystem interface like filesystem.Mkdir or filesystem.OpenFile.
Any attempts to perform operations on paths inside of children will result in a panic, as these are not expected to be performed on this FS.
An FS an optionally have a StaticRoot, which will insert a folder with that StaticRoot into the tree, like this:
-- <StaticRoot> ----- <Child> ----- <Child>
func (*FS) Mkdir ¶
Mkdir implements webdav.FileSystem. All attempts to Mkdir a directory that already exists will succeed. All other attempts will fail with os.ErrPermission.
func (*FS) OpenFile ¶
func (dfs *FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
OpenFile implements interface webdav.Filesystem.
func (*FS) RemoveAll ¶
RemoveAll implements webdav.File. No removal is supported and this always returns os.ErrPermission.