osmock

package
v0.0.0-...-58d8038 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const DevNull = "/dev/null"

Variables

View Source
var ErrWriteAtInAppendMode = errors.New("os: invalid use of WriteAt on file opened with O_APPEND")

Functions

This section is empty.

Types

type FS

type FS interface {
	Object() *object.Obj
	Storage() storage.Storage
	GetNode(path string) (node node.Node, err error)
}

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

baseHandle implements all the missing methods

func (*Handle) Chdir

func (h *Handle) Chdir() error

func (*Handle) Chmod

func (h *Handle) Chmod(mode os.FileMode) error

func (*Handle) Chown

func (h *Handle) Chown(uid, gid int) error

func (*Handle) Close

func (h *Handle) Close() error

func (*Handle) Fd

func (h *Handle) Fd() uintptr

func (*Handle) Name

func (h *Handle) Name() string

func (*Handle) Node

func (h *Handle) Node() (node.Node, error)

func (*Handle) Read

func (h *Handle) Read(b []byte) (n int, err error)

func (*Handle) ReadAt

func (h *Handle) ReadAt(b []byte, off int64) (n int, err error)

func (*Handle) Readdir

func (h *Handle) Readdir(n int) ([]os.FileInfo, error)

func (*Handle) Readdirnames

func (h *Handle) Readdirnames(n int) ([]string, error)

func (*Handle) Seek

func (h *Handle) Seek(offset int64, whence int) (ret int64, err error)

func (*Handle) Stat

func (h *Handle) Stat() (os.FileInfo, error)

func (*Handle) Sync

func (h *Handle) Sync() error

func (*Handle) Truncate

func (h *Handle) Truncate(size int64) error

func (*Handle) Write

func (h *Handle) Write(b []byte) (n int, err error)

func (*Handle) WriteAt

func (h *Handle) WriteAt(b []byte, off int64) (n int, err error)

func (*Handle) WriteString

func (h *Handle) WriteString(s string) (n int, err error)

type KFS

type KFS struct {
	Opt *kfscommon.Options
	// contains filtered or unexported fields
}

func New

func New(opt *kfscommon.Options, s storage.Storage) *KFS

func (*KFS) Chdir

func (kfs *KFS) Chdir(dir string) error

Chdir changes the current working directory to the named directory.

func (*KFS) Chmod

func (kfs *KFS) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*KFS) Create

func (kfs *KFS) Create(name string) (*Handle, error)

Create creates or truncates the named file. If the file already exists, it is truncated. If the file does not exist, it is created with mode 0666 (before umask). If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR.

func (*KFS) GetDir

func (kfs *KFS) GetDir(path string) (dir *node.Dir, err error)

func (*KFS) GetFile

func (kfs *KFS) GetFile(path string) (*node.File, error)

func (*KFS) GetNode

func (kfs *KFS) GetNode(path string) (n node.Node, err error)

GetNode finds the Node by path starting from the root

func (*KFS) Getwd

func (kfs *KFS) Getwd() (dir string, err error)

func (*KFS) Lstat

func (kfs *KFS) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link.

func (*KFS) Mkdir

func (kfs *KFS) Mkdir(name string, perm os.FileMode) error

Mkdir creates a new directory with the specified name and permission bits (before umask).

func (*KFS) MkdirAll

func (kfs *KFS) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates.

func (*KFS) Object

func (kfs *KFS) Object() *object.Obj

func (*KFS) Open

func (kfs *KFS) Open(name string) (*Handle, error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY.

func (*KFS) OpenFile

func (kfs *KFS) OpenFile(name string, flags int, perm os.FileMode) (h *Handle, err error)

OpenFile a file according to the flags and perm provided

func (*KFS) ReadDir

func (kfs *KFS) ReadDir(path string) ([]*object.Metadata, error)

func (*KFS) Remove

func (kfs *KFS) Remove(name string) error

Remove removes the named file or (empty) directory.

func (*KFS) RemoveAll

func (kfs *KFS) RemoveAll(name string) error

RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error).

func (*KFS) Rename

func (kfs *KFS) Rename(oldPath, newPath string) error

Rename renames (moves) oldpath to newpath. If newpath already exists and is not a directory, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

func (*KFS) Root

func (kfs *KFS) Root() *node.Dir

func (*KFS) Stat

func (kfs *KFS) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file.

func (*KFS) Storage

func (kfs *KFS) Storage() storage.Storage

func (*KFS) Truncate

func (kfs *KFS) Truncate(name string, size int64) error

Truncate changes the size of the named file.

type LinkError

type LinkError = os.LinkError

type OsFiler

type OsFiler interface {
	Chdir() error
	Chmod(mode os.FileMode) error
	Chown(uid, gid int) error
	Close() error
	Fd() uintptr
	Name() string
	Read(b []byte) (n int, err error)
	ReadAt(b []byte, off int64) (n int, err error)
	Readdir(n int) ([]os.FileInfo, error)
	Readdirnames(n int) (names []string, err error)
	Seek(offset int64, whence int) (ret int64, err error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	Write(b []byte) (n int, err error)
	WriteAt(b []byte, off int64) (n int, err error)
	WriteString(s string) (n int, err error)
}

OsFiler is the methods on *os.File

type PathError

type PathError = os.PathError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL