fs

package
v0.0.0-...-0886869 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2018 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package fs abstracts the filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	io.Reader
	io.Writer
	io.Closer
	Name() string
	Size() int64
	Sync() error
}

File is the subset of methods we use on an *os.File.

type Filesystem

type Filesystem interface {
	Create(path string) (File, error)
	Open(path string) (File, error)
	Remove(path string) error
	Rename(oldname, newname string) error
	Exists(path string) bool
	MkdirAll(path string) error
	Chtimes(path string, atime, mtime time.Time) error
	Walk(root string, walkFn filepath.WalkFunc) error
	Lock(path string) (r Releaser, existed bool, err error)
}

Filesystem collects the operations we need from a filesystem.

func NewNopFilesystem

func NewNopFilesystem() Filesystem

NewNopFilesystem has methods that always succeed but do nothing.

func NewRealFilesystem

func NewRealFilesystem() Filesystem

NewRealFilesystem yields a real disk filesystem with optional memory mapping for file reading.

func NewVirtualFilesystem

func NewVirtualFilesystem() Filesystem

NewVirtualFilesystem yields an in-memory filesystem.

type Releaser

type Releaser interface {
	Release() error
}

Releaser is returned by Lock calls.

Jump to

Keyboard shortcuts

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