filesystem

package
v0.0.0-...-cf2fa2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIsDir        = &os.PathError{Err: errors.New("is a directory")}
	ErrIsNotDir     = &os.PathError{Err: errors.New("is not a directory")}
	ErrNotSupported = &os.PathError{Err: errors.New("fs doesn't support this operation")}
	ErrInvalidSeek  = &os.PathError{Err: errors.New("invalid seek offset")}
	ErrReadOnly     = os.ErrPermission
)

Functions

func CheckFlag

func CheckFlag(flag int, allowedFlags int) bool

func New

func New(driver *ddrv.Driver, asyncWrite bool) afero.Fs

func NewLogFs

func NewLogFs(src afero.Fs) afero.Fs

NewLogFs creates an instance with logging

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

func (*File) IsDir

func (f *File) IsDir() bool

func (*File) ModTime

func (f *File) ModTime() time.Time

func (*File) Mode

func (f *File) Mode() os.FileMode

func (*File) Name

func (f *File) Name() string

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) ReadAt

func (f *File) ReadAt(p []byte, off int64) (n int, err error)

func (*File) Readdir

func (f *File) Readdir(count int) ([]os.FileInfo, error)

func (*File) Readdirnames

func (f *File) Readdirnames(n int) ([]string, error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Size

func (f *File) Size() int64

func (*File) Stat

func (f *File) Stat() (os.FileInfo, error)

func (*File) Sync

func (f *File) Sync() error

func (*File) Sys

func (f *File) Sys() interface{}

func (*File) Truncate

func (f *File) Truncate(_ int64) error

func (*File) Write

func (f *File) Write(p []byte) (int, error)

func (*File) WriteAt

func (f *File) WriteAt(_ []byte, _ int64) (int, error)

func (*File) WriteString

func (f *File) WriteString(s string) (ret int, err error)

type Fs

type Fs struct {
	// contains filtered or unexported fields
}

func (*Fs) Chmod

func (fs *Fs) Chmod(_ string, _ os.FileMode) error

func (*Fs) Chown

func (fs *Fs) Chown(_ string, _, _ int) error

func (*Fs) Chtimes

func (fs *Fs) Chtimes(name string, _ time.Time, mtime time.Time) error

func (*Fs) Create

func (fs *Fs) Create(name string) (afero.File, error)

func (*Fs) Mkdir

func (fs *Fs) Mkdir(name string, _ os.FileMode) error

func (*Fs) MkdirAll

func (fs *Fs) MkdirAll(path string, _ os.FileMode) error

func (*Fs) Name

func (fs *Fs) Name() string

func (*Fs) Open

func (fs *Fs) Open(name string) (afero.File, error)

func (*Fs) OpenFile

func (fs *Fs) OpenFile(name string, flag int, _ os.FileMode) (afero.File, error)

OpenFile supported flags, O_WRONLY, O_CREATE, O_RDONLY

func (*Fs) Remove

func (fs *Fs) Remove(name string) error

func (*Fs) RemoveAll

func (fs *Fs) RemoveAll(path string) error

func (*Fs) Rename

func (fs *Fs) Rename(oldname, newname string) error

func (*Fs) Stat

func (fs *Fs) Stat(name string) (os.FileInfo, error)

type LogFs

type LogFs struct {
	// contains filtered or unexported fields
}

LogFs is a wrapper to log interactions around file system accesses

func (*LogFs) Chmod

func (lf *LogFs) Chmod(name string, mode os.FileMode) error

Chmod calls will not be logged

func (*LogFs) Chown

func (lf *LogFs) Chown(name string, uid int, gid int) error

Chown calls will not be logged

func (*LogFs) Chtimes

func (lf *LogFs) Chtimes(name string, atime time.Time, mtime time.Time) error

Chtimes calls will not be logged

func (*LogFs) Create

func (lf *LogFs) Create(name string) (afero.File, error)

Create calls will be logged

func (*LogFs) Mkdir

func (lf *LogFs) Mkdir(name string, perm os.FileMode) error

Mkdir calls will be logged

func (*LogFs) MkdirAll

func (lf *LogFs) MkdirAll(path string, perm os.FileMode) error

MkdirAll calls will be logged

func (*LogFs) Name

func (lf *LogFs) Name() string

Name calls will not be logged

func (*LogFs) Open

func (lf *LogFs) Open(name string) (afero.File, error)

Open calls will be logged

func (*LogFs) OpenFile

func (lf *LogFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

OpenFile calls will be logged

func (*LogFs) Remove

func (lf *LogFs) Remove(name string) error

Remove calls will be logged

func (*LogFs) RemoveAll

func (lf *LogFs) RemoveAll(path string) error

RemoveAll calls will be logged

func (*LogFs) Rename

func (lf *LogFs) Rename(oldname, newname string) error

Rename calls will not be logged

func (*LogFs) Stat

func (lf *LogFs) Stat(name string) (os.FileInfo, error)

Stat calls will not be logged

type LogFsFile

type LogFsFile struct {
	// contains filtered or unexported fields
}

LogFsFile is a wrapper to log interactions around file accesses

func (*LogFsFile) Close

func (lff *LogFsFile) Close() error

Close calls will be logged

func (*LogFsFile) Name

func (lff *LogFsFile) Name() string

Name won't be logged

func (*LogFsFile) Read

func (lff *LogFsFile) Read(p []byte) (int, error)

Read only log error

func (*LogFsFile) ReadAt

func (lff *LogFsFile) ReadAt(p []byte, off int64) (int, error)

ReadAt only log error

func (*LogFsFile) Readdir

func (lff *LogFsFile) Readdir(count int) ([]os.FileInfo, error)

Readdir won't be logged

func (*LogFsFile) Readdirnames

func (lff *LogFsFile) Readdirnames(n int) ([]string, error)

func (*LogFsFile) Seek

func (lff *LogFsFile) Seek(offset int64, whence int) (int64, error)

Seek only log error

func (*LogFsFile) Stat

func (lff *LogFsFile) Stat() (os.FileInfo, error)

func (*LogFsFile) Sync

func (lff *LogFsFile) Sync() error

func (*LogFsFile) Truncate

func (lff *LogFsFile) Truncate(size int64) error

func (*LogFsFile) Write

func (lff *LogFsFile) Write(p []byte) (int, error)

Write only log error

func (*LogFsFile) WriteAt

func (lff *LogFsFile) WriteAt(p []byte, off int64) (int, error)

WriteAt only log error

func (*LogFsFile) WriteString

func (lff *LogFsFile) WriteString(str string) (int, error)

WriteString only log error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL