fs

package
v0.0.0-...-d5b5c0c Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Move

func Move(from, to FS, pFrom, pTo string) error

Move is not concurrency-safe.

Types

type BufCloser

type BufCloser struct{ *bytes.Buffer }

func (BufCloser) Close

func (b BufCloser) Close() error

type DirMaker

type DirMaker interface {
	Mkdir(perm os.FileMode, path ...string) error
}

DirMaker is an FS which has a meaningful concept of a directory. This prevents objects being moved into a directory which does not exist, so the directory must be created.

Mkdir should create any necessary parent directories with the same privilege passed as "perm".

type FS

type FS interface {
	kfs.FileSystem

	Open(string) (io.ReadCloser, error)
	Create(string) (io.WriteCloser, error)
	Move(from, to string) error
	Split(path string) (parent, rest string)
}

type Kind

type Kind int
const (
	KindReal Kind = iota
	KindMem
)

func KindOf

func KindOf(of reflect.Type) Kind

type Mem

type Mem struct {
	kfs.FileSystem
	// contains filtered or unexported fields
}

func MakeMem

func MakeMem() Mem

func (Mem) Create

func (m Mem) Create(path string) (io.WriteCloser, error)

func (Mem) Join

func (m Mem) Join(subs ...string) string

func (Mem) Move

func (m Mem) Move(from, to string) error

func (Mem) Open

func (m Mem) Open(path string) (io.ReadCloser, error)

func (Mem) ReadDir

func (m Mem) ReadDir(some string) (infos []os.FileInfo, err error)

func (Mem) Split

func (m Mem) Split(some string) (parent, rest string)

type MemInfo

type MemInfo struct {
	os.FileInfo
	// contains filtered or unexported fields
}

func (MemInfo) Name

func (m MemInfo) Name() string

type Real

type Real struct{ Where string }

func (Real) Create

func (r Real) Create(name string) (io.WriteCloser, error)

func (Real) Join

func (r Real) Join(ps ...string) string

func (Real) Lstat

func (r Real) Lstat(path string) (os.FileInfo, error)

func (Real) Mkdir

func (r Real) Mkdir(perm os.FileMode, path ...string) error

func (Real) Move

func (r Real) Move(from, to string) error

func (Real) Open

func (r Real) Open(name string) (io.ReadCloser, error)

func (Real) ReadDir

func (r Real) ReadDir(name string) ([]os.FileInfo, error)

func (Real) Split

func (r Real) Split(path string) (parent, rest string)

type SyncMem

type SyncMem struct {
	*sync.RWMutex
	Mem
}

func MakeSyncMem

func MakeSyncMem() SyncMem

func (SyncMem) Create

func (s SyncMem) Create(which string) (io.WriteCloser, error)

func (SyncMem) Move

func (s SyncMem) Move(from, to string) error

func (SyncMem) Open

func (s SyncMem) Open(which string) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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