123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package emptyfs
- import (
- "io"
- "os"
- "path/filepath"
- "time"
- "imuslab.com/arozos/mod/filesystem/fsdef"
- )
- /*
- 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 fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Chown(filename string, uid int, gid int) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Chtimes(filename string, atime time.Time, mtime time.Time) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Create(filename string) (*os.File, error) {
- return nil, fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Mkdir(filename string, mode os.FileMode) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) MkdirAll(filename string, mode os.FileMode) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Name() string {
- return ""
- }
- func (l EmptyFileSystemAbstraction) Open(filename string) (*os.File, error) {
- return nil, fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) OpenFile(filename string, flag int, perm os.FileMode) (*os.File, error) {
- return nil, fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Remove(filename string) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) RemoveAll(path string) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Rename(oldname, newname string) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) Stat(filename string) (os.FileInfo, error) {
- return nil, fsdef.ErrNullOperation
- }
- /*
- Abstraction Utilities
- */
- func (l EmptyFileSystemAbstraction) VirtualPathToRealPath(subpath string, username string) (string, error) {
- return "", fsdef.ErrVpathResolveFailed
- }
- func (l EmptyFileSystemAbstraction) RealPathToVirtualPath(fullpath string, username string) (string, error) {
- return "", fsdef.ErrRpathResolveFailed
- }
- 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{}, fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) GetFileSize(realpath string) int64 {
- return 0
- }
- func (l EmptyFileSystemAbstraction) GetModTime(realpath string) (int64, error) {
- return 0, fsdef.ErrOperationNotSupported
- }
- func (l EmptyFileSystemAbstraction) WriteFile(filename string, content []byte, mode os.FileMode) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) ReadFile(filename string) ([]byte, error) {
- return []byte(""), fsdef.ErrOperationNotSupported
- }
- func (l EmptyFileSystemAbstraction) WriteStream(filename string, stream io.Reader, mode os.FileMode) error {
- return fsdef.ErrNullOperation
- }
- func (l EmptyFileSystemAbstraction) ReadStream(filename string) (io.ReadCloser, error) {
- return nil, fsdef.ErrOperationNotSupported
- }
- func (l EmptyFileSystemAbstraction) Walk(root string, walkFn filepath.WalkFunc) error {
- return fsdef.ErrOperationNotSupported
- }
|