forked from cloudfoundry/bosh-softlayer-cpi-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_system_interface.go
51 lines (37 loc) · 1.51 KB
/
file_system_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package system
import (
"io"
"os"
)
type ReadWriteCloseStater interface {
io.ReadWriteCloser
ReadAt([]byte, int64) (int, error)
Stat() (os.FileInfo, error)
}
type FileSystem interface {
HomeDir(username string) (path string, err error)
// MkdirAll will not change existing dir permissions
// if dir exists and has different permissions
MkdirAll(path string, perm os.FileMode) (err error)
RemoveAll(fileOrDir string) (err error)
Chown(path, username string) (err error)
Chmod(path string, perm os.FileMode) (err error)
OpenFile(path string, flag int, perm os.FileMode) (ReadWriteCloseStater, error)
WriteFileString(path, content string) (err error)
WriteFile(path string, content []byte) (err error)
ConvergeFileContents(path string, content []byte) (written bool, err error)
ReadFileString(path string) (content string, err error)
ReadFile(path string) (content []byte, err error)
FileExists(path string) bool
Rename(oldPath, newPath string) (err error)
// After Symlink file at newPath will be pointing to file at oldPath.
// Symlink call will remove file at newPath if one exists
// to make newPath a symlink to the file at oldPath.
Symlink(oldPath, newPath string) (err error)
ReadLink(symlinkPath string) (targetPath string, err error)
CopyFile(srcPath, dstPath string) (err error)
// Returns *unique* temporary file/dir with a custom prefix
TempFile(prefix string) (file *os.File, err error)
TempDir(prefix string) (path string, err error)
Glob(pattern string) (matches []string, err error)
}