package filesystem import ( "errors" "io" "os" "path/filepath" "time" ) /* filesystemAbstraction.go This file contains all the abstraction funtion of a local file system. */ type EmptyFileSystemAbstraction struct { } func NewEmptyFileSystemAbstraction() EmptyFileSystemAbstraction { return EmptyFileSystemAbstraction{} } func (l EmptyFileSystemAbstraction) Chmod(filename string, mode os.FileMode) error { return nil } func (l EmptyFileSystemAbstraction) Chown(filename string, uid int, gid int) error { return nil } func (l EmptyFileSystemAbstraction) Chtimes(filename string, atime time.Time, mtime time.Time) error { return nil } func (l EmptyFileSystemAbstraction) Create(filename string) (*os.File, error) { return nil, nil } func (l EmptyFileSystemAbstraction) Mkdir(filename string, mode os.FileMode) error { return nil } func (l EmptyFileSystemAbstraction) MkdirAll(filename string, mode os.FileMode) error { return nil } func (l EmptyFileSystemAbstraction) Name() string { return "" } func (l EmptyFileSystemAbstraction) Open(filename string) (*os.File, error) { return nil, nil } func (l EmptyFileSystemAbstraction) OpenFile(filename string, flag int, perm os.FileMode) (*os.File, error) { return nil, nil } func (l EmptyFileSystemAbstraction) Remove(filename string) error { return nil } func (l EmptyFileSystemAbstraction) RemoveAll(path string) error { return nil } func (l EmptyFileSystemAbstraction) Rename(oldname, newname string) error { return nil } func (l EmptyFileSystemAbstraction) Stat(filename string) (os.FileInfo, error) { return nil, nil } /* Abstraction Utilities */ func (l EmptyFileSystemAbstraction) VirtualPathToRealPath(subpath string, username string) (string, error) { return "", errors.New("empty filesystem abstraction") } func (l EmptyFileSystemAbstraction) RealPathToVirtualPath(fullpath string, username string) (string, error) { return "", errors.New("empty filesystem abstraction") } func (l EmptyFileSystemAbstraction) FileExists(realpath string) bool { return false } func (l EmptyFileSystemAbstraction) IsDir(realpath string) bool { return false } func (l EmptyFileSystemAbstraction) Glob(realpathWildcard string) ([]string, error) { return []string{}, nil } func (l EmptyFileSystemAbstraction) GetFileSize(realpath string) int64 { return 0 } func (l EmptyFileSystemAbstraction) GetModTime(realpath string) (int64, error) { return 0, errors.New("empty filesystem abstraction") } func (l EmptyFileSystemAbstraction) WriteFile(filename string, content []byte, mode os.FileMode) error { return nil } func (l EmptyFileSystemAbstraction) ReadFile(filename string) ([]byte, error) { return []byte(""), errors.New("empty filesystem abstraction") } func (l EmptyFileSystemAbstraction) WriteStream(filename string, stream io.Reader, mode os.FileMode) error { return errors.New("operation not supported on dummy file system") } func (l EmptyFileSystemAbstraction) ReadStream(filename string) (io.ReadCloser, error) { return nil, errors.New("operation not supported on dummy file system") } func (l EmptyFileSystemAbstraction) Walk(root string, walkFn filepath.WalkFunc) error { return errors.New("empty filesystem abstraction") }