Documentation ¶
Index ¶
- Variables
- func Checksum32(path string) uint32
- func Copy(src, dest string) error
- func Equal(fid1, fid2 FID) bool
- func ExInfoFrom(size int64, ctime, atime, mtime time.Time, fid FID) *stdExFileInfo
- func Exists(path string) bool
- func Hash(hasher hash.Hash, path string) ([]byte, error)
- func HashStr(hasher hash.Hash, path string) (string, error)
- func IsDir(path string) bool
- func NormalizePath(path string) string
- type ExFileInfo
- type FID
- type MockFileInfo
- type MockFileOpEntry
- type MockOperations
- func (m *MockOperations) Create(path string) (*os.File, error)
- func (m *MockOperations) Mkdir(path string, perm os.FileMode) error
- func (m *MockOperations) MkdirAll(path string, perm os.FileMode) error
- func (m *MockOperations) On(method string) *MockOperations
- func (m *MockOperations) Open(path string) (*os.File, error)
- func (m *MockOperations) Remove(path string) error
- func (m *MockOperations) RemoveAll(path string) error
- func (m *MockOperations) Rename(oldpath, newpath string) error
- func (m *MockOperations) SetError(err error) *MockOperations
- func (m *MockOperations) SetValue(what interface{}) *MockOperations
- func (m *MockOperations) Stat(path string) (os.FileInfo, error)
- type Operations
- type TarReader
Constants ¶
This section is empty.
Variables ¶
var OS osOperations
OS allows access to the os package methods that are the same as in the Operations interface.
Functions ¶
func Checksum32 ¶
Checksum32 create a crc32 checksum for file at path.
func ExInfoFrom ¶
func HashStr ¶
HashStr creates a hexadecimal string of the hash of the file at path using the specified Hash.
func NormalizePath ¶
NormalizePath converts all slashes in a path to '/' (forward) slashes
Types ¶
type ExFileInfo ¶
type ExFileInfo interface { os.FileInfo // Support the os.FileInfo interface Path() string // Full path of file CTime() time.Time // Creation time ATime() time.Time // Last access time FID() FID // System independent File ID }
ExFileInfo is an extended version of the os.FileInfo interface that includes additional information.
func ExStat ¶
func ExStat(path string) (fileInfo ExFileInfo, err error)
ExStat is an extended version of the os.Stat() method.
func ExStatFromFileInfo ¶
func ExStatFromFileInfo(fi os.FileInfo, path string) (ExFileInfo, error)
ExStatFromFileInfo takes a os.FileInfo and a path and returns an ExFileInfo.
type FID ¶
FID represents a file identifier. On Linux it is the INode. On Windows it is the file index and volume serial number.
type MockFileInfo ¶
type MockFileInfo struct { MName string MSize int64 MMode os.FileMode MModTime time.Time MIsDir bool MSys interface{} }
func (MockFileInfo) IsDir ¶
func (fi MockFileInfo) IsDir() bool
func (MockFileInfo) ModTime ¶
func (fi MockFileInfo) ModTime() time.Time
func (MockFileInfo) Mode ¶
func (fi MockFileInfo) Mode() os.FileMode
func (MockFileInfo) Name ¶
func (fi MockFileInfo) Name() string
func (MockFileInfo) Size ¶
func (fi MockFileInfo) Size() int64
func (MockFileInfo) Sys ¶
func (fi MockFileInfo) Sys() interface{}
type MockFileOpEntry ¶
type MockFileOpEntry struct { Err error RValue interface{} }
type MockOperations ¶
type MockOperations struct {
// contains filtered or unexported fields
}
func MockOps ¶
func MockOps() *MockOperations
func (*MockOperations) Create ¶
func (m *MockOperations) Create(path string) (*os.File, error)
Create returns nil, Err from MockOps if MockOps Err is not nil. Otherwise it returns os.Create(os.DevNull).
func (*MockOperations) Mkdir ¶
func (m *MockOperations) Mkdir(path string, perm os.FileMode) error
Mkdir returns Err from MockOps. It does nothing.
func (*MockOperations) MkdirAll ¶
func (m *MockOperations) MkdirAll(path string, perm os.FileMode) error
MkdirAll returns Err from MockOps. It does nothing.
func (*MockOperations) On ¶
func (m *MockOperations) On(method string) *MockOperations
func (*MockOperations) Open ¶
func (m *MockOperations) Open(path string) (*os.File, error)
Open returns nil, Err from MockOps if MockOps err is not nil. Otherwise it returns os.Open(os.DevNull).
func (*MockOperations) Remove ¶
func (m *MockOperations) Remove(path string) error
Remove returns Err from MockOps. It does nothing.
func (*MockOperations) RemoveAll ¶
func (m *MockOperations) RemoveAll(path string) error
RemoveAll returns Err from MockOps. It does nothing.
func (*MockOperations) Rename ¶
func (m *MockOperations) Rename(oldpath, newpath string) error
Rename returns Err from MockOps. It does nothing.
func (*MockOperations) SetError ¶
func (m *MockOperations) SetError(err error) *MockOperations
func (*MockOperations) SetValue ¶
func (m *MockOperations) SetValue(what interface{}) *MockOperations
type Operations ¶
type Operations interface { Remove(path string) error RemoveAll(path string) error Mkdir(path string, perm os.FileMode) error MkdirAll(path string, perm os.FileMode) error Create(path string) (*os.File, error) Open(name string) (file *os.File, err error) Rename(oldpath, newpath string) error Stat(path string) (os.FileInfo, error) }
Operations is the operations on a file. The interface exists to allow mocking of file system operations.
type TarReader ¶
type TarReader struct {
// contains filtered or unexported fields
}
TarReader type contains all the artifacts needed to unpack a tar file.