Documentation ¶
Index ¶
- Variables
- func NewCacheOnReadFs(base, layer afero.Fs, cacheTime time.Duration) afero.Fs
- func Walk(fs afero.Fs, root string, walkFn filepath.WalkFunc) error
- type CacheLayerGetter
- type CacheOnReadFs
- type ChangePathFile
- type ChangePathFs
- func (b *ChangePathFs) Chmod(name string, mode os.FileMode) (err error)
- func (b *ChangePathFs) Chown(name string, uid, gid int) error
- func (b *ChangePathFs) Chtimes(name string, atime, mtime time.Time) (err error)
- func (b *ChangePathFs) Create(name string) (f afero.File, err error)
- func (b *ChangePathFs) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (b *ChangePathFs) Mkdir(name string, mode os.FileMode) (err error)
- func (b *ChangePathFs) MkdirAll(name string, mode os.FileMode) (err error)
- func (b *ChangePathFs) Name() string
- func (b *ChangePathFs) Open(name string) (f afero.File, err error)
- func (b *ChangePathFs) OpenFile(name string, flag int, mode os.FileMode) (f afero.File, err error)
- func (b *ChangePathFs) Remove(name string) (err error)
- func (b *ChangePathFs) RemoveAll(name string) (err error)
- func (b *ChangePathFs) Rename(oldName, newName string) (err error)
- func (b *ChangePathFs) Stat(name string) (fi os.FileInfo, err error)
- type ChangePathFunc
- type OnlyCachedEnabler
Constants ¶
This section is empty.
Variables ¶
var ErrPathNeverRequestedBefore = errors.New("path never requested before")
ErrPathNeverRequestedBefore represent an error when path never opened/requested before
Functions ¶
func NewCacheOnReadFs ¶
NewCacheOnReadFs returns a new CacheOnReadFs
Types ¶
type CacheLayerGetter ¶
CacheLayerGetter provide a direct access to a cache layer
type CacheOnReadFs ¶
CacheOnReadFs is wrapper around afero.CacheOnReadFs with the ability to return the filesystem that is used as cache
func (*CacheOnReadFs) AllowOnlyCached ¶
func (c *CacheOnReadFs) AllowOnlyCached()
AllowOnlyCached enables the cached only mode of the CacheOnReadFs
func (*CacheOnReadFs) GetCachingFs ¶
func (c *CacheOnReadFs) GetCachingFs() afero.Fs
GetCachingFs returns the afero.Fs being used for cache
type ChangePathFile ¶
ChangePathFile is a file from ChangePathFs
func (*ChangePathFile) Name ¶
func (f *ChangePathFile) Name() string
Name Returns the name of the file
type ChangePathFs ¶
type ChangePathFs struct {
// contains filtered or unexported fields
}
ChangePathFs is a filesystem that wraps another afero.Fs and changes all given paths from all file and directory names, with a function, before calling the same method on the wrapped afero.Fs. Heavily based on afero.BasePathFs
func NewChangePathFs ¶
func NewChangePathFs(source afero.Fs, fn ChangePathFunc) *ChangePathFs
NewChangePathFs return a ChangePathFs where all paths will be change with the provided funcs
func NewTrimFilePathSeparatorFs ¶
func NewTrimFilePathSeparatorFs(source afero.Fs) *ChangePathFs
NewTrimFilePathSeparatorFs is ChangePathFs that trims a Afero.FilePathSeparator from all paths Heavily based on afero.BasePathFs
func (*ChangePathFs) Chmod ¶
func (b *ChangePathFs) Chmod(name string, mode os.FileMode) (err error)
Chmod changes the mode of the named file to mode.
func (*ChangePathFs) Chown ¶
func (b *ChangePathFs) Chown(name string, uid, gid int) error
Chown changes the uid and gid of the named file.
func (*ChangePathFs) Chtimes ¶
func (b *ChangePathFs) Chtimes(name string, atime, mtime time.Time) (err error)
Chtimes changes the access and modification times of the named file
func (*ChangePathFs) Create ¶
func (b *ChangePathFs) Create(name string) (f afero.File, err error)
Create creates a file in the filesystem, returning the file and an error, if any happens
func (*ChangePathFs) LstatIfPossible ¶
LstatIfPossible implements the afero.Lstater interface
func (*ChangePathFs) Mkdir ¶
func (b *ChangePathFs) Mkdir(name string, mode os.FileMode) (err error)
Mkdir creates a directory in the filesystem, return an error if any happens.
func (*ChangePathFs) MkdirAll ¶
func (b *ChangePathFs) MkdirAll(name string, mode os.FileMode) (err error)
MkdirAll creates a directory path and all parents that does not exist yet.
func (*ChangePathFs) Name ¶
func (b *ChangePathFs) Name() string
Name return the name of this FileSystem
func (*ChangePathFs) Open ¶
func (b *ChangePathFs) Open(name string) (f afero.File, err error)
Open opens a file, returning it or an error, if any happens.
func (*ChangePathFs) Remove ¶
func (b *ChangePathFs) Remove(name string) (err error)
Remove removes a file identified by name, returning an error, if any happens.
func (*ChangePathFs) RemoveAll ¶
func (b *ChangePathFs) RemoveAll(name string) (err error)
RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).
func (*ChangePathFs) Rename ¶
func (b *ChangePathFs) Rename(oldName, newName string) (err error)
Rename renames a file.
type ChangePathFunc ¶
ChangePathFunc is the function that will be called by ChangePathFs to change the path
type OnlyCachedEnabler ¶
type OnlyCachedEnabler interface {
AllowOnlyCached()
}
OnlyCachedEnabler enables the mode of FS that allows to open already opened files (e.g. serve from cache only)