fs

package
v4.0.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package fs interace and implementations used by storage/filesystem

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed       = errors.New("File: Writing on closed file.")
	ErrReadOnly     = errors.New("this is a read-only filesystem")
	ErrNotSupported = errors.New("feature not supported")
)

Functions

This section is empty.

Types

type BaseFile

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

func (*BaseFile) Filename

func (f *BaseFile) Filename() string

Filename returns the filename from the File

func (*BaseFile) IsClosed

func (f *BaseFile) IsClosed() bool

IsClosed returns if te file is closed

type File

type File interface {
	Filename() string
	IsClosed() bool
	io.Writer
	io.Reader
	io.Seeker
	io.Closer
}

type FileInfo

type FileInfo os.FileInfo

type Filesystem

type Filesystem interface {
	Create(filename string) (File, error)
	Open(filename string) (File, error)
	Stat(filename string) (FileInfo, error)
	ReadDir(path string) ([]FileInfo, error)
	TempFile(dir, prefix string) (File, error)
	Rename(from, to string) error
	Join(elem ...string) string
	Dir(path string) Filesystem
	Base() string
}

type OS

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

OS a filesystem base on the os filesystem

func NewOS

func NewOS(baseDir string) *OS

NewOS returns a new OS filesystem

func (*OS) Base

func (fs *OS) Base() string

Base returns the base path of the filesytem

func (*OS) Create

func (fs *OS) Create(filename string) (File, error)

Create creates a new GlusterFSFile

func (*OS) Dir

func (fs *OS) Dir(path string) Filesystem

Dir returns a new Filesystem from the same type of fs using as baseDir the given path

func (*OS) Join

func (fs *OS) Join(elem ...string) string

Join joins the specified elements using the filesystem separator.

func (*OS) Open

func (fs *OS) Open(filename string) (File, error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading only.

func (*OS) ReadDir

func (fs *OS) ReadDir(path string) ([]FileInfo, error)

ReadDir returns the filesystem info for all the archives under the specified path.

func (*OS) Rename

func (fs *OS) Rename(from, to string) error

func (*OS) Stat

func (fs *OS) Stat(filename string) (FileInfo, error)

Stat returns the FileInfo structure describing file.

func (*OS) TempFile

func (fs *OS) TempFile(dir, prefix string) (File, error)

type OSFile

type OSFile struct {
	BaseFile
	// contains filtered or unexported fields
}

OSFile represents a file in the os filesystem

func (*OSFile) Close

func (f *OSFile) Close() error

func (*OSFile) Read

func (f *OSFile) Read(p []byte) (int, error)

func (*OSFile) ReadAt

func (f *OSFile) ReadAt(p []byte, off int64) (int, error)

func (*OSFile) Seek

func (f *OSFile) Seek(offset int64, whence int) (int64, error)

func (*OSFile) Write

func (f *OSFile) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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