Documentation
¶
Index ¶
- Variables
- type Archiver
- type FileSystem
- type Fs
- func (f *Fs) AppendIfMissing(filePath string, content []byte, mode os.FileMode) error
- func (f *Fs) Chmod(name string, mode os.FileMode) error
- func (f *Fs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (f *Fs) CopyDir(src string, dst string) error
- func (f *Fs) CopyFile(src string, dst string) error
- func (f *Fs) Create(name string) (afero.File, error)
- func (f *Fs) DownloadRemoteFile(url string, name string) error
- func (f *Fs) Exists(path string) (bool, error)
- func (f *Fs) FileContainsBytes(filename string, subslice []byte) (bool, error)
- func (f *Fs) MkdirAll(path string, perm os.FileMode) error
- func (f *Fs) ReadFile(filename string) ([]byte, error)
- func (f *Fs) Remove(name string) error
- func (f *Fs) RemoveAll(path string) error
- func (f *Fs) Rename(oldname string, newname string) error
- func (f *Fs) Stat(path string) (os.FileInfo, error)
- func (f *Fs) WriteFile(filename string, data []byte, perm os.FileMode) error
- type Locker
- type MemLock
- type MemMapLock
- type OsLock
- type Unarchiver
Constants ¶
This section is empty.
Variables ¶
var (
ErrLocked = filelock.ErrLocked
)
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface {
AppendIfMissing(name string, content []byte, mode os.FileMode) error
Chmod(name string, mode os.FileMode) error
CopyDir(src string, dst string) error
CopyFile(src string, dst string) error
Chtimes(name string, atime time.Time, mtime time.Time) error
Create(name string) (afero.File, error)
DownloadRemoteFile(url string, name string) error
Exists(path string) (bool, error)
FileContainsBytes(filename string, subslice []byte) (bool, error)
MkdirAll(path string, perm os.FileMode) error
ReadFile(filename string) ([]byte, error)
Rename(oldname string, newname string) error
Remove(name string) error
RemoveAll(path string) error
Stat(path string) (os.FileInfo, error)
WriteFile(filename string, data []byte, perm os.FileMode) error
}
FileSystem is an interface that wraps a subset of afero calls but also adds a few of our own
type Fs ¶
A wrapper around the real afero.Fs we want
func (*Fs) AppendIfMissing ¶
AppendIfMissing appends the content string to the given file
func (*Fs) CopyDir ¶
CopyDir copies the contents of the given directory to another directory on the same filesystem
func (*Fs) DownloadRemoteFile ¶
DownloadRemoteFile downloads file from the internet onto disk
func (*Fs) FileContainsBytes ¶
FileContainsBytes returns whether or not the given file contains the subslice, otherwise an error
func (*Fs) RemoveAll ¶
RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).
type Locker ¶
type Locker interface {
GetLock(filename string) (filelock.TryLockerSafe, error)
GetRetryAttempts() uint
GetRetryDelay() time.Duration
GetRetryDelayType() retry.DelayTypeFunc
}
type MemMapLock ¶
type MemMapLock struct {
RetryAttempts uint
RetryDelay time.Duration
RetryDelayType retry.DelayTypeFunc
Locks map[string]*MemLock
// The error you want GetLock() to throw
Err error
// The error you want TryLock() to throw
LockErr error
}
This is a super simple implementation and could probably be done with something better than a map, but heh its mostly for testing
func (*MemMapLock) GetLock ¶
func (f *MemMapLock) GetLock(filename string) (filelock.TryLockerSafe, error)
func (*MemMapLock) GetRetryAttempts ¶
func (o *MemMapLock) GetRetryAttempts() uint
func (*MemMapLock) GetRetryDelay ¶
func (o *MemMapLock) GetRetryDelay() time.Duration
func (*MemMapLock) GetRetryDelayType ¶
func (o *MemMapLock) GetRetryDelayType() retry.DelayTypeFunc
type OsLock ¶
type OsLock struct {
RetryAttempts uint
RetryDelay time.Duration
RetryDelayType retry.DelayTypeFunc
}
func (*OsLock) GetRetryAttempts ¶
func (*OsLock) GetRetryDelay ¶
func (*OsLock) GetRetryDelayType ¶
func (o *OsLock) GetRetryDelayType() retry.DelayTypeFunc
type Unarchiver ¶
type Unarchiver struct{}