Documentation ¶
Overview ¶
Package filesystem implements the operation of the local file system.
Index ¶
- Constants
- func ToChmodPerm(m os.FileMode) (perm uint32)
- type FileSystem
- func (f FileSystem) MD5Sum(localPath string) string
- func (f FileSystem) MkLocalTmpDir() (string, error)
- func (f FileSystem) MkLocalTmpFile(dir, pattern string) (string, error)
- func (f FileSystem) MkdirAll(path string) error
- func (f FileSystem) RemoveAll(path ...string) error
- func (f FileSystem) SHA256Sum(localPath string) string
- func (f FileSystem) Stat(name string) (os.FileInfo, error)
- type Interface
Constants ¶
const ( // FileMode0777 represents the file mode 0755 FileMode0777 = 0777 // FileMode0755 represents the file mode 0755 FileMode0755 = 0755 // FileMode0644 represents the file mode 0644 FileMode0644 = 0644 // FileMode0664 represents the file mode 0664 FileMode0664 = 0664 )
const (
// DefaultLocalTmpDir represents the CAPKK default local tmp directory
DefaultLocalTmpDir = "/var/lib/kubekey"
)
Variables ¶
This section is empty.
Functions ¶
func ToChmodPerm ¶
ToChmodPerm converts Go permission bits to POSIX permission bits.
This differs from fromFileMode in that we preserve the POSIX versions of setuid, setgid and sticky in m, because we've historically supported those bits, and we mask off any non-permission bits.
Types ¶
type FileSystem ¶
type FileSystem struct { }
FileSystem is a filesystem implementation
func (FileSystem) MD5Sum ¶
func (f FileSystem) MD5Sum(localPath string) string
MD5Sum returns the file MD5 sum for the given local path.
func (FileSystem) MkLocalTmpDir ¶
func (f FileSystem) MkLocalTmpDir() (string, error)
MkLocalTmpDir creates a temporary directory and returns the path
func (FileSystem) MkLocalTmpFile ¶
func (f FileSystem) MkLocalTmpFile(dir, pattern string) (string, error)
MkLocalTmpFile creates a temporary file and returns the path.
func (FileSystem) MkdirAll ¶
func (f FileSystem) MkdirAll(path string) error
MkdirAll the same as os.MkdirAll().
func (FileSystem) RemoveAll ¶
func (f FileSystem) RemoveAll(path ...string) error
RemoveAll the same as os.RemoveAll().
func (FileSystem) SHA256Sum ¶
func (f FileSystem) SHA256Sum(localPath string) string
SHA256Sum returns the file SHA256 sum for the given local path.
type Interface ¶
type Interface interface { // Stat returns the FileInfo structure describing the named file. Stat(name string) (os.FileInfo, error) // MkdirAll the same as os.MkdirAll(). MkdirAll(path string) error // MD5Sum returns the file MD5 sum for the given local path. MD5Sum(localPath string) string // SHA256Sum returns the file SHA256 sum for the given local path. SHA256Sum(localPath string) string // MkLocalTmpDir creates a temporary directory and returns the path. MkLocalTmpDir() (string, error) // MkLocalTmpFile creates a temporary file and returns the path. MkLocalTmpFile(dir, pattern string) (string, error) // RemoveAll the same as os.RemoveAll(). RemoveAll(path ...string) error }
Interface is an interface for filesystem operations
func NewFileSystem ¶
func NewFileSystem() Interface
NewFileSystem returns a new CAPKK local filesystem implementation