Documentation ¶
Index ¶
- Constants
- Variables
- func AbsPath(p string) string
- func AddTrailSlash(p string) string
- func IsRoot(filename string) bool
- func ListDirFromFiles[F File](m map[string]F, name string) ([]fs.DirEntry, error)
- func ListDirFromInfo(m map[string]fs.FileInfo, name string) ([]fs.DirEntry, error)
- func NewDirInfo(name string, modTime time.Time) *fileInfo
- func NewFileInfo(name string, size int64, modTime time.Time) *fileInfo
- func OnceValueWOErr[T any](f func() (T, error)) func() (T, error)
- func RelPath(p string) string
- func RemoveTrailingSlash(p string) string
- func Walk(ctx context.Context, vfs Filesystem, root string, walkFn filepath.WalkFunc) error
- type CtxBillyFile
- func (c *CtxBillyFile) Close(ctx context.Context) error
- func (c *CtxBillyFile) Info() (fs.FileInfo, error)
- func (c *CtxBillyFile) IsDir() bool
- func (c *CtxBillyFile) Name() string
- func (c *CtxBillyFile) Read(ctx context.Context, p []byte) (n int, err error)
- func (c *CtxBillyFile) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error)
- func (c *CtxBillyFile) Seek(offset int64, whence int) (int64, error)
- func (c *CtxBillyFile) Size() int64
- func (c *CtxBillyFile) Type() fs.FileMode
- type CtxBillyFs
- func (c *CtxBillyFs) Info() (fs.FileInfo, error)
- func (c *CtxBillyFs) IsDir() bool
- func (c *CtxBillyFs) Name() string
- func (c *CtxBillyFs) Open(ctx context.Context, filename string) (File, error)
- func (c *CtxBillyFs) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)
- func (c *CtxBillyFs) Rename(ctx context.Context, oldpath string, newpath string) error
- func (c *CtxBillyFs) Stat(ctx context.Context, filename string) (fs.FileInfo, error)
- func (c *CtxBillyFs) Type() fs.FileMode
- func (c *CtxBillyFs) Unlink(ctx context.Context, filename string) error
- type DefaultFS
- type DummyFile
- func (d *DummyFile) Close(ctx context.Context) error
- func (d *DummyFile) Info() (fs.FileInfo, error)
- func (d *DummyFile) IsDir() bool
- func (d *DummyFile) Name() string
- func (d *DummyFile) Read(ctx context.Context, p []byte) (n int, err error)
- func (d *DummyFile) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error)
- func (d *DummyFile) Seek(offset int64, whence int) (int64, error)
- func (d *DummyFile) Size() int64
- func (d *DummyFile) Type() fs.FileMode
- type DummyFs
- func (d *DummyFs) FsName() string
- func (d *DummyFs) Info() (fs.FileInfo, error)
- func (d *DummyFs) IsDir() bool
- func (d *DummyFs) ModTime() time.Time
- func (d *DummyFs) Mode() fs.FileMode
- func (d *DummyFs) Name() string
- func (d *DummyFs) Open(ctx context.Context, filename string) (File, error)
- func (d *DummyFs) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)
- func (d *DummyFs) Rename(ctx context.Context, oldpath string, newpath string) error
- func (*DummyFs) Stat(ctx context.Context, filename string) (fs.FileInfo, error)
- func (d *DummyFs) Type() fs.FileMode
- func (d *DummyFs) Unlink(ctx context.Context, filename string) error
- type File
- type Filesystem
- type FilesystemPrototype
- type FsFactory
- type Hash
- type LazyOsFile
- func (f *LazyOsFile) Close(ctx context.Context) error
- func (f *LazyOsFile) Info() (fs.FileInfo, error)
- func (f *LazyOsFile) IsDir() bool
- func (f *LazyOsFile) Name() string
- func (f *LazyOsFile) Read(ctx context.Context, p []byte) (n int, err error)
- func (f *LazyOsFile) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error)
- func (f *LazyOsFile) Seek(offset int64, whence int) (int64, error)
- func (f *LazyOsFile) Size() int64
- func (f *LazyOsFile) Type() fs.FileMode
- type LogFS
- func (fs *LogFS) FsName() string
- func (fs *LogFS) Info() (fs.FileInfo, error)
- func (fs *LogFS) IsDir() bool
- func (lfs *LogFS) ModTime() time.Time
- func (lfs *LogFS) Mode() fs.FileMode
- func (fs *LogFS) Name() string
- func (fs *LogFS) Open(ctx context.Context, filename string) (file File, err error)
- func (fs *LogFS) ReadDir(ctx context.Context, path string) (entries []fs.DirEntry, err error)
- func (lfs *LogFS) Rename(ctx context.Context, oldpath string, newpath string) error
- func (lfs *LogFS) Size() int64
- func (lfs *LogFS) Stat(ctx context.Context, filename string) (info fs.FileInfo, err error)
- func (lfs *LogFS) Sys() any
- func (fs *LogFS) Type() fs.FileMode
- func (fs *LogFS) Unlink(ctx context.Context, filename string) (err error)
- type LogFile
- func (f *LogFile) Close(ctx context.Context) (err error)
- func (f *LogFile) Info() (fs.FileInfo, error)
- func (f *LogFile) IsDir() bool
- func (f *LogFile) Name() string
- func (f *LogFile) Read(ctx context.Context, p []byte) (n int, err error)
- func (f *LogFile) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error)
- func (f *LogFile) Seek(offset int64, whence int) (int64, error)
- func (f *LogFile) Size() int64
- func (f *LogFile) Type() fs.FileMode
- type MemoryFile
- func (d *MemoryFile) Close(ctx context.Context) (err error)
- func (d *MemoryFile) Info() (fs.FileInfo, error)
- func (d *MemoryFile) IsDir() bool
- func (d *MemoryFile) Name() string
- func (d *MemoryFile) Read(ctx context.Context, p []byte) (n int, err error)
- func (d *MemoryFile) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error)
- func (d *MemoryFile) Seek(offset int64, whence int) (int64, error)
- func (d *MemoryFile) Size() int64
- func (d *MemoryFile) Type() fs.FileMode
- type MemoryFs
- func (fs *MemoryFs) FsName() string
- func (fs *MemoryFs) Info() (fs.FileInfo, error)
- func (fs *MemoryFs) IsDir() bool
- func (mfs *MemoryFs) ModTime() time.Time
- func (mfs *MemoryFs) Mode() fs.FileMode
- func (fs *MemoryFs) Name() string
- func (m *MemoryFs) Open(ctx context.Context, filename string) (File, error)
- func (fs *MemoryFs) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)
- func (mfs *MemoryFs) Rename(ctx context.Context, oldpath string, newpath string) error
- func (fs *MemoryFs) Size() int64
- func (mfs *MemoryFs) Stat(ctx context.Context, filename string) (fs.FileInfo, error)
- func (fs *MemoryFs) Sys() any
- func (mfs *MemoryFs) Type() fs.FileMode
- func (fs *MemoryFs) Unlink(ctx context.Context, filename string) error
- type OsFS
- func (fs *OsFS) Info() (fs.FileInfo, error)
- func (fs *OsFS) IsDir() bool
- func (fs *OsFS) Name() string
- func (fs *OsFS) Open(ctx context.Context, filename string) (File, error)
- func (o *OsFS) ReadDir(ctx context.Context, dir string) ([]fs.DirEntry, error)
- func (fs *OsFS) Rename(ctx context.Context, oldpath string, newpath string) error
- func (fs *OsFS) Stat(ctx context.Context, filename string) (fs.FileInfo, error)
- func (ofs *OsFS) Type() fs.FileMode
- func (fs *OsFS) Unlink(ctx context.Context, filename string) error
- type Resolver
- type ResolverFS
- func (r *ResolverFS) FsName() string
- func (r *ResolverFS) Info() (fs.FileInfo, error)
- func (r *ResolverFS) IsDir() bool
- func (r *ResolverFS) ModTime() time.Time
- func (r *ResolverFS) Mode() fs.FileMode
- func (r *ResolverFS) Name() string
- func (r *ResolverFS) Open(ctx context.Context, filename string) (File, error)
- func (r *ResolverFS) ReadDir(ctx context.Context, name string) ([]fs.DirEntry, error)
- func (r *ResolverFS) Rename(ctx context.Context, oldpath string, newpath string) error
- func (r *ResolverFS) ResolvablesExtensions() []string
- func (r *ResolverFS) Size() int64
- func (r *ResolverFS) Stat(ctx context.Context, filename string) (fs.FileInfo, error)
- func (r *ResolverFS) Sys() any
- func (r *ResolverFS) Type() fs.FileMode
- func (r *ResolverFS) Unlink(ctx context.Context, filename string) error
Constants ¶
View Source
const ModeFileRO = fs.FileMode(0555)
readonly
View Source
const Separator = "/"
Variables ¶
View Source
var ErrNotExist = fs.ErrNotExist
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrOsHashLen = errors.New("oshash: buffer length must be a multiple of 8")
Functions ¶
func AddTrailSlash ¶
func ListDirFromFiles ¶
func ListDirFromInfo ¶
func NewDirInfo ¶
func OnceValueWOErr ¶
OnceValueWOErr returns a function that invokes f only once and returns the value returned by f . The returned function may be called concurrently.
If f panics, the returned function will panic with the same value on every call.
func RemoveTrailingSlash ¶
Types ¶
type CtxBillyFile ¶
type CtxBillyFile struct {
// contains filtered or unexported fields
}
func NewCtxBillyFile ¶
func NewCtxBillyFile(info fs.FileInfo, bf ctxbilly.File) *CtxBillyFile
func (*CtxBillyFile) Close ¶
func (c *CtxBillyFile) Close(ctx context.Context) error
Close implements File.
func (*CtxBillyFile) Info ¶
func (c *CtxBillyFile) Info() (fs.FileInfo, error)
Info implements File.
type CtxBillyFs ¶
type CtxBillyFs struct {
// contains filtered or unexported fields
}
func NewCtxBillyFs ¶
func NewCtxBillyFs(name string, fs ctxbilly.Filesystem) *CtxBillyFs
func (*CtxBillyFs) Info ¶
func (c *CtxBillyFs) Info() (fs.FileInfo, error)
Info implements Filesystem.
type DummyFile ¶
type DummyFile struct {
// contains filtered or unexported fields
}
type DummyFs ¶
type DummyFs struct {
// contains filtered or unexported fields
}
type File ¶
type File interface { IsDir() bool Size() int64 fs.DirEntry ctxio.Reader ctxio.ReaderAt ctxio.Closer ctxio.Seeker }
func NewDirFile ¶
type Filesystem ¶
type Filesystem interface { // Open opens the named file for reading. If successful, methods on the // returned file can be used for reading; the associated file descriptor has // mode O_RDONLY. Open(ctx context.Context, filename string) (File, error) // ReadDir reads the directory named by dirname and returns a list of // directory entries. ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error) Stat(ctx context.Context, filename string) (fs.FileInfo, error) Unlink(ctx context.Context, filename string) error Rename(ctx context.Context, oldpath, newpath string) error // As filesystem mounted to some path, make sense to have the filesystem implement DirEntry fs.DirEntry }
type FilesystemPrototype ¶
type FilesystemPrototype string
func (FilesystemPrototype) Info ¶
func (p FilesystemPrototype) Info() (fs.FileInfo, error)
Info implements Filesystem.
func (FilesystemPrototype) IsDir ¶
func (p FilesystemPrototype) IsDir() bool
IsDir implements Filesystem.
func (FilesystemPrototype) Name ¶
func (p FilesystemPrototype) Name() string
Name implements Filesystem.
func (FilesystemPrototype) Type ¶
func (p FilesystemPrototype) Type() fs.FileMode
Type implements Filesystem.
type LazyOsFile ¶
type LazyOsFile struct {
// contains filtered or unexported fields
}
func NewLazyOsFile ¶
func NewLazyOsFile(path string) (*LazyOsFile, error)
func (*LazyOsFile) Close ¶
func (f *LazyOsFile) Close(ctx context.Context) error
Close implements File.
type LogFS ¶
type LogFS struct {
// contains filtered or unexported fields
}
func WrapLogFS ¶
func WrapLogFS(vfs Filesystem) (*LogFS, error)
type LogFile ¶
type LogFile struct {
// contains filtered or unexported fields
}
func WrapLogFile ¶
type MemoryFile ¶
type MemoryFile struct {
// contains filtered or unexported fields
}
func NewMemoryFile ¶
func NewMemoryFile(name string, data []byte) *MemoryFile
func (*MemoryFile) IsDir ¶
func (d *MemoryFile) IsDir() bool
func (*MemoryFile) Seek ¶
func (d *MemoryFile) Seek(offset int64, whence int) (int64, error)
Seek implements File.
func (*MemoryFile) Size ¶
func (d *MemoryFile) Size() int64
type MemoryFs ¶
type MemoryFs struct {
// contains filtered or unexported fields
}
func NewMemoryFS ¶
func NewMemoryFS(name string, files map[string]*MemoryFile) *MemoryFs
type OsFS ¶
type OsFS struct {
// contains filtered or unexported fields
}
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) IsNestedFs ¶
func (*Resolver) ResolvePath ¶
func (r *Resolver) ResolvePath(ctx context.Context, name string, rawOpen openFile) (fsPath string, nestedFs Filesystem, nestedFsPath string, err error)
open requeue raw open, without resolver call
type ResolverFS ¶
type ResolverFS struct {
// contains filtered or unexported fields
}
func NewResolveFS ¶
func NewResolveFS(rootFs Filesystem, factories map[string]FsFactory) *ResolverFS
func (*ResolverFS) Info ¶
func (r *ResolverFS) Info() (fs.FileInfo, error)
Info implements Filesystem.
func (*ResolverFS) ModTime ¶
func (r *ResolverFS) ModTime() time.Time
ModTime implements Filesystem.
func (*ResolverFS) ResolvablesExtensions ¶
func (r *ResolverFS) ResolvablesExtensions() []string
Click to show internal directories.
Click to hide internal directories.