Documentation
¶
Index ¶
- Variables
- func BackgroundFs(base Fs) afero.Fs
- func NewFs(base Fs, accessor Accessor) afero.Fs
- func TodoFs(base Fs) afero.Fs
- type Accessor
- type AccessorFs
- func (a *AccessorFs) Chmod(name string, mode fs.FileMode) error
- func (a *AccessorFs) Chown(name string, uid int, gid int) error
- func (a *AccessorFs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (a *AccessorFs) Create(name string) (afero.File, error)
- func (a *AccessorFs) Mkdir(name string, perm fs.FileMode) error
- func (a *AccessorFs) MkdirAll(path string, perm fs.FileMode) error
- func (a *AccessorFs) Name() string
- func (a *AccessorFs) Open(name string) (afero.File, error)
- func (a *AccessorFs) OpenFile(name string, flag int, perm fs.FileMode) (afero.File, error)
- func (a *AccessorFs) Remove(name string) error
- func (a *AccessorFs) RemoveAll(path string) error
- func (a *AccessorFs) Rename(oldname string, newname string) error
- func (a *AccessorFs) Stat(name string) (fs.FileInfo, error)
- type AccessorFunc
- type AdapterFs
- func (a *AdapterFs) ChmodContext(ctx Context, name string, mode fs.FileMode) error
- func (a *AdapterFs) ChownContext(ctx Context, name string, uid int, gid int) error
- func (a *AdapterFs) ChtimesContext(ctx Context, name string, atime time.Time, mtime time.Time) error
- func (a *AdapterFs) CreateContext(ctx Context, name string) (afero.File, error)
- func (a *AdapterFs) MkdirAllContext(ctx Context, path string, perm fs.FileMode) error
- func (a *AdapterFs) MkdirContext(ctx Context, name string, perm fs.FileMode) error
- func (a *AdapterFs) OpenContext(ctx Context, name string) (afero.File, error)
- func (a *AdapterFs) OpenFileContext(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
- func (a *AdapterFs) RemoveAllContext(ctx Context, path string) error
- func (a *AdapterFs) RemoveContext(ctx Context, name string) error
- func (a *AdapterFs) RenameContext(ctx Context, oldname string, newname string) error
- func (a *AdapterFs) StatContext(ctx Context, name string) (fs.FileInfo, error)
- type AferoFs
- type Context
- type DiscardFs
- func (a *DiscardFs) ChmodContext(ctx Context, name string, mode fs.FileMode) error
- func (a *DiscardFs) ChownContext(ctx Context, name string, uid int, gid int) error
- func (a *DiscardFs) ChtimesContext(ctx Context, name string, atime time.Time, mtime time.Time) error
- func (a *DiscardFs) CreateContext(ctx Context, name string) (afero.File, error)
- func (a *DiscardFs) MkdirAllContext(ctx Context, path string, perm fs.FileMode) error
- func (a *DiscardFs) MkdirContext(ctx Context, name string, perm fs.FileMode) error
- func (a *DiscardFs) OpenContext(ctx Context, name string) (afero.File, error)
- func (a *DiscardFs) OpenFileContext(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
- func (a *DiscardFs) RemoveAllContext(ctx Context, path string) error
- func (a *DiscardFs) RemoveContext(ctx Context, name string) error
- func (a *DiscardFs) RenameContext(ctx Context, oldname string, newname string) error
- func (a *DiscardFs) StatContext(ctx Context, name string) (fs.FileInfo, error)
- type File
- type Fs
- type Setter
- type WithSetterFs
- func (s *WithSetterFs) Chmod(ctx Context, name string, mode fs.FileMode) error
- func (s *WithSetterFs) Chown(ctx Context, name string, uid int, gid int) error
- func (s *WithSetterFs) Chtimes(ctx Context, name string, atime time.Time, mtime time.Time) error
- func (s *WithSetterFs) Create(ctx Context, name string) (afero.File, error)
- func (s *WithSetterFs) Mkdir(ctx Context, name string, perm fs.FileMode) error
- func (s *WithSetterFs) MkdirAll(ctx Context, path string, perm fs.FileMode) error
- func (s *WithSetterFs) Name() string
- func (s *WithSetterFs) Open(ctx Context, name string) (afero.File, error)
- func (s *WithSetterFs) OpenFile(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
- func (s *WithSetterFs) Remove(ctx Context, name string) error
- func (s *WithSetterFs) RemoveAll(ctx Context, path string) error
- func (s *WithSetterFs) Rename(ctx Context, oldname string, newname string) error
- func (s *WithSetterFs) Stat(ctx Context, name string) (fs.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ( Background = context.Background TODO = context.TODO WithCancel = context.WithCancel WithCancelCause = context.WithCancelCause WithDeadline = context.WithDeadline WithDeadlineCause = context.WithDeadlineCause WithValue = context.WithValue WithTimeout = context.WithTimeout WithTimeoutCause = context.WithTimeoutCause WithoutCancel = context.WithoutCancel )
Functions ¶
func BackgroundFs ¶
Types ¶
type Accessor ¶
func ToAccessor ¶
type AccessorFs ¶
AccessorFs adapts an Fs to an afero.Fs by using the given [ContextAccessor] to source the context.Context for each operation
func (*AccessorFs) Chmod ¶
func (a *AccessorFs) Chmod(name string, mode fs.FileMode) error
Chmod implements afero.Fs.
func (*AccessorFs) Chown ¶
func (a *AccessorFs) Chown(name string, uid int, gid int) error
Chown implements afero.Fs.
func (*AccessorFs) Create ¶
func (a *AccessorFs) Create(name string) (afero.File, error)
Create implements afero.Fs.
func (*AccessorFs) Mkdir ¶
func (a *AccessorFs) Mkdir(name string, perm fs.FileMode) error
Mkdir implements afero.Fs.
func (*AccessorFs) MkdirAll ¶
func (a *AccessorFs) MkdirAll(path string, perm fs.FileMode) error
MkdirAll implements afero.Fs.
func (*AccessorFs) Open ¶
func (a *AccessorFs) Open(name string) (afero.File, error)
Open implements afero.Fs.
func (*AccessorFs) Remove ¶
func (a *AccessorFs) Remove(name string) error
Remove implements afero.Fs.
func (*AccessorFs) RemoveAll ¶
func (a *AccessorFs) RemoveAll(path string) error
RemoveAll implements afero.Fs.
type AccessorFunc ¶
type AccessorFunc func() Context
func (AccessorFunc) Context ¶
func (fn AccessorFunc) Context() Context
type AdapterFs ¶
type AdapterFs struct{ Fs Fs }
AdapterFs adapts an Fs to a partial AferoFs structure. It is intended to be embedded as a utility type to satisfy an AferoFs interface with an Fs
func (*AdapterFs) ChmodContext ¶
ChmodContext implements AferoFs.
func (*AdapterFs) ChownContext ¶
ChownContext implements AferoFs.
func (*AdapterFs) ChtimesContext ¶
func (a *AdapterFs) ChtimesContext(ctx Context, name string, atime time.Time, mtime time.Time) error
ChtimesContext implements AferoFs.
func (*AdapterFs) CreateContext ¶
CreateContext implements AferoFs.
func (*AdapterFs) MkdirAllContext ¶
MkdirAllContext implements AferoFs.
func (*AdapterFs) MkdirContext ¶
MkdirContext implements AferoFs.
func (*AdapterFs) OpenContext ¶
OpenContext implements AferoFs.
func (*AdapterFs) OpenFileContext ¶
func (a *AdapterFs) OpenFileContext(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
OpenFileContext implements AferoFs.
func (*AdapterFs) RemoveAllContext ¶
RemoveAllContext implements AferoFs.
func (*AdapterFs) RemoveContext ¶
RemoveContext implements AferoFs.
func (*AdapterFs) RenameContext ¶
RenameContext implements AferoFs.
type AferoFs ¶
type AferoFs interface {
afero.Fs
// CreateContext creates a file in the filesystem, returning the file and an
// error, if any happens.
CreateContext(ctx Context, name string) (File, error)
// MkdirContext creates a directory in the filesystem, return an error if any
// happens.
MkdirContext(ctx Context, name string, perm os.FileMode) error
// MkdirAllContext creates a directory path and all parents that does not exist
// yet.
MkdirAllContext(ctx Context, path string, perm os.FileMode) error
// OpenContext opens a file, returning it or an error, if any happens.
OpenContext(ctx Context, name string) (File, error)
// OpenFileContext opens a file using the given flags and the given mode.
OpenFileContext(ctx Context, name string, flag int, perm os.FileMode) (File, error)
// RemoveContext removes a file identified by name, returning an error, if any
// happens.
RemoveContext(ctx Context, name string) error
// RemoveAllContext removes a directory path and any children it contains. It
// does not fail if the path does not exist (return nil).
RemoveAllContext(ctx Context, path string) error
// RenameContext renames a file.
RenameContext(ctx Context, oldname, newname string) error
// StatContext returns a FileInfo describing the named file, or an error, if any
// happens.
StatContext(ctx Context, name string) (os.FileInfo, error)
// ChmodContext changes the mode of the named file to mode.
ChmodContext(ctx Context, name string, mode os.FileMode) error
// ChownContext changes the uid and gid of the named file.
ChownContext(ctx Context, name string, uid, gid int) error
// ChtimesContext changes the access and modification times of the named file
ChtimesContext(ctx Context, name string, atime time.Time, mtime time.Time) error
}
AferoFs is a filesystem interface.
type DiscardFs ¶
DiscardFs adapts an afero.Fs to an AferoFs by ignoring the context.Context argument.
func (*DiscardFs) ChmodContext ¶
ChmodContext implements AferoFs.
func (*DiscardFs) ChownContext ¶
ChownContext implements AferoFs.
func (*DiscardFs) ChtimesContext ¶
func (a *DiscardFs) ChtimesContext(ctx Context, name string, atime time.Time, mtime time.Time) error
ChtimesContext implements AferoFs.
func (*DiscardFs) CreateContext ¶
CreateContext implements AferoFs.
func (*DiscardFs) MkdirAllContext ¶
MkdirAllContext implements AferoFs.
func (*DiscardFs) MkdirContext ¶
MkdirContext implements AferoFs.
func (*DiscardFs) OpenContext ¶
OpenContext implements AferoFs.
func (*DiscardFs) OpenFileContext ¶
func (a *DiscardFs) OpenFileContext(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
OpenFileContext implements AferoFs.
func (*DiscardFs) RemoveAllContext ¶
RemoveAllContext implements AferoFs.
func (*DiscardFs) RemoveContext ¶
RemoveContext implements AferoFs.
func (*DiscardFs) RenameContext ¶
RenameContext implements AferoFs.
type Fs ¶
type Fs interface {
// Create creates a file in the filesystem, returning the file and an
// error, if any happens.
Create(ctx Context, name string) (File, error)
// Mkdir creates a directory in the filesystem, return an error if any
// happens.
Mkdir(ctx Context, name string, perm os.FileMode) error
// MkdirAll creates a directory path and all parents that does not exist
// yet.
MkdirAll(ctx Context, path string, perm os.FileMode) error
// Open opens a file, returning it or an error, if any happens.
Open(ctx Context, name string) (File, error)
// OpenFile opens a file using the given flags and the given mode.
OpenFile(ctx Context, name string, flag int, perm os.FileMode) (File, error)
// Remove removes a file identified by name, returning an error, if any
// happens.
Remove(ctx Context, name string) error
// RemoveAll removes a directory path and any children it contains. It
// does not fail if the path does not exist (return nil).
RemoveAll(ctx Context, path string) error
// Rename renames a file.
Rename(ctx Context, oldname, newname string) error
// Stat returns a FileInfo describing the named file, or an error, if any
// happens.
Stat(ctx Context, name string) (os.FileInfo, error)
// The name of this FileSystem
Name() string
// Chmod changes the mode of the named file to mode.
Chmod(ctx Context, name string, mode os.FileMode) error
// Chown changes the uid and gid of the named file.
Chown(ctx Context, name string, uid, gid int) error
// Chtimes changes the access and modification times of the named file
Chtimes(ctx Context, name string, atime time.Time, mtime time.Time) error
}
Fs is a filesystem interface.
type WithSetterFs ¶
WithSetterFs adapts an afero.Fs to an Fs by calling [SetContext] on the given [ContextSetter] before forwarding each operation to the given afero.Fs
func (*WithSetterFs) OpenFile ¶
func (s *WithSetterFs) OpenFile(ctx Context, name string, flag int, perm fs.FileMode) (afero.File, error)
OpenFile implements Fs.
func (*WithSetterFs) Remove ¶
func (s *WithSetterFs) Remove(ctx Context, name string) error
Remove implements Fs.
func (*WithSetterFs) RemoveAll ¶
func (s *WithSetterFs) RemoveAll(ctx Context, path string) error
RemoveAll implements Fs.