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
ErrLocked - the filelock error.
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 ¶
Fs is 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 }
Locker is an interface of filelock.
type MemLock ¶
type MemLock struct {
// contains filtered or unexported fields
}
MemLock - definition of the memory lock.
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 }
MemMapLock - 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 (o *MemMapLock) GetLock(filename string) (filelock.TryLockerSafe, error)
GetLock - create a new lock.
func (*MemMapLock) GetRetryAttempts ¶
func (o *MemMapLock) GetRetryAttempts() uint
GetRetryAttempts - get retry count.
func (*MemMapLock) GetRetryDelay ¶
func (o *MemMapLock) GetRetryDelay() time.Duration
GetRetryDelay - time between each retry.
func (*MemMapLock) GetRetryDelayType ¶
func (o *MemMapLock) GetRetryDelayType() retry.DelayTypeFunc
GetRetryDelayType - type of retry delay.
type OsLock ¶
type OsLock struct { RetryAttempts uint RetryDelay time.Duration RetryDelayType retry.DelayTypeFunc }
OsLock defines what is available for retries.
func (*OsLock) GetRetryAttempts ¶
GetRetryAttempts returns the max number of retries allowed.
func (*OsLock) GetRetryDelay ¶
GetRetryDelay returns the timed allowed between retries.
func (*OsLock) GetRetryDelayType ¶
func (o *OsLock) GetRetryDelayType() retry.DelayTypeFunc
GetRetryDelayType returns the type of retry delay.