diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-07-03 08:10:28 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-07-12 08:02:14 +0200 |
commit | 78754a7b23e5fc7a40bd3c450d54a193aaf585b1 (patch) | |
tree | 5aff6436cbf93212aab6bb59a077a5718c0fbc23 /fs/fs.go | |
parent | 43d099919d1e1a8d6b38a300182d0cc075237fe6 (diff) | |
download | petrific-78754a7b23e5fc7a40bd3c450d54a193aaf585b1.tar.gz petrific-78754a7b23e5fc7a40bd3c450d54a193aaf585b1.tar.bz2 petrific-78754a7b23e5fc7a40bd3c450d54a193aaf585b1.zip |
Implementing backup methods
Diffstat (limited to 'fs/fs.go')
-rw-r--r-- | fs/fs.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/fs.go b/fs/fs.go new file mode 100644 index 0000000..cbfeb44 --- /dev/null +++ b/fs/fs.go @@ -0,0 +1,41 @@ +package fs + +import ( + "io" + "time" +) + +type FileType string + +const ( + FFile FileType = "file" + FDir FileType = "dir" + FSymlink FileType = "symlink" +) + +type File interface { + Type() FileType // Depending on type, the File must also implement RegularFile (FFile), Dir (FDir) or Symlink (FSymlink) + Name() string + Executable() bool // For now we will only record the executable bit instead of all permission bits + ModTime() time.Time + Delete() error +} + +type RegularFile interface { + File + Open() (io.ReadWriteCloser, error) +} + +type Dir interface { + File + Readdir() ([]File, error) + + CreateChildFile(name string, exec bool) (RegularFile, error) + CreateChildDir(name string) (Dir, error) + CreateChildSymlink(name string, target string) (Symlink, error) +} + +type Symlink interface { + File + Readlink() (string, error) +} |