Documentation
¶
Overview ¶
Package fskeleton attempts to factor out the common code needed to implement fs.FS. It is optimised for small memory usage at rest.
Index ¶
- type FS
- func (fsys *FS) CreateError(name string, id int64, err error, size int64, mode fs.FileMode, ...) error
- func (fsys *FS) CreateReadCloser(name string, id int64, r func() (io.ReadCloser, error), size int64, ...) error
- func (fsys *FS) CreateReader(name string, id int64, r func() (io.Reader, error), size int64, ...) error
- func (fsys *FS) CreateReaderAt(name string, id int64, r io.ReaderAt, size int64, mode fs.FileMode, ...) error
- func (fsys *FS) Lstat(name string) (info fs.FileInfo, err error)
- func (fsys *FS) Mkdir(name string, id int64, mode fs.FileMode, mtime time.Time) error
- func (fsys *FS) NoMore()
- func (fsys *FS) Open(name string) (f fs.File, err error)
- func (fsys *FS) ReadLink(name string) (target string, err error)
- func (fsys *FS) Stat(name string) (info fs.FileInfo, err error)
- func (fsys *FS) Symlink(name string, id int64, target string, mode fs.FileMode, mtime time.Time) error
- func (fsys *FS) Walk(waitFull bool) iter.Seq2[fmt.Stringer, fs.FileMode]
- type FileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is safe for concurrent use from multiple goroutines. It should not be copied after creation.
func (*FS) CreateError ¶
func (fsys *FS) CreateError(name string, id int64, err error, size int64, mode fs.FileMode, mtime time.Time) error
CreateError creates a regular file at the specified path.
When opened, the file will always returns the specified error from fs.File.Read. fs.File.Close will have no effect.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
func (*FS) CreateReadCloser ¶
func (fsys *FS) CreateReadCloser(name string, id int64, r func() (io.ReadCloser, error), size int64, mode fs.FileMode, mtime time.Time) error
CreateReadCloser creates a regular file at the specified path.
When opened, the file will implement the bare minimum of fs.File.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
func (*FS) CreateReader ¶
func (fsys *FS) CreateReader(name string, id int64, r func() (io.Reader, error), size int64, mode fs.FileMode, mtime time.Time) error
CreateReader creates a regular file at the specified path.
When opened, the file will implement the bare minimum of fs.File. fs.File.Close will have no effect.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
func (*FS) CreateReaderAt ¶
func (fsys *FS) CreateReaderAt(name string, id int64, r io.ReaderAt, size int64, mode fs.FileMode, mtime time.Time) error
CreateReadCloser creates a regular file at the specified path.
When opened, the file will satisfy io.ReaderAt and io.ReadSeeker.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
func (*FS) Lstat ¶
Lstat returns a FileInfo describing the named file. If the file is a symlink, the returned FileInfo describes the symbolic link, not the linked file.
func (*FS) Mkdir ¶
Mkdir creates a directory at the specified path.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
func (*FS) NoMore ¶
func (fsys *FS) NoMore()
NoMore prevents all future Create*() calls, which will fail with an error wrapping fs.ErrPermission.
NoMore unblocks any blocked fs.ReadDirFile.ReadDir calls.
func (*FS) Symlink ¶
func (fsys *FS) Symlink(name string, id int64, target string, mode fs.FileMode, mtime time.Time) error
Symlink creates a symbolic link at the specified path.
In common with the other new-file methods, any missing parent directories will be created implicitly. Implicit directories can later be made explicit (only once) with FS.Mkdir.
The target argument must be an absolute path satisfying fs.ValidPath.