filesystem

package
v0.0.0-...-d4d6057 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CreateMode = os.FileMode(0600)
)
View Source
var (
	ErrNotSupported = fmt.Errorf("Operation is not supported")
)

Functions

func HasFlags

func HasFlags(flag, search int) bool

Types

type Asset

type Asset interface {
	File
	Metadata() *Metadata
}

type Backend

type Backend interface {
	Mkdir(name string, perm os.FileMode) error
	MkdirAll(name string, perm os.FileMode) error
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
	RemoveAll(name string) error
	Rename(oldName, newName string) error
	Stat(name string) (os.FileInfo, error)
}

type BaseFile

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

func NewBaseFile

func NewBaseFile(file File, metadata *Metadata) *BaseFile

func (*BaseFile) Metadata

func (file *BaseFile) Metadata() *Metadata

type BaseFileSystem

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

func NewBaseFileSystem

func NewBaseFileSystem(backend Backend) *BaseFileSystem

func (*BaseFileSystem) Mkdir

func (fs *BaseFileSystem) Mkdir(name string, perm os.FileMode) error

func (*BaseFileSystem) MkdirAll

func (fs *BaseFileSystem) MkdirAll(name string, perm os.FileMode) error

func (*BaseFileSystem) OpenAsset

func (fs *BaseFileSystem) OpenAsset(name string, flag int, perm os.FileMode) (Asset, error)

func (*BaseFileSystem) OpenAssetByID

func (fs *BaseFileSystem) OpenAssetByID(id ID, flag int, perm os.FileMode) (basefile Asset, err error)

func (*BaseFileSystem) OpenFile

func (fs *BaseFileSystem) OpenFile(name string, flag int, perm os.FileMode) (file File, err error)

func (*BaseFileSystem) Rename

func (fs *BaseFileSystem) Rename(oldName, newName string) (err error)

func (*BaseFileSystem) Stat

func (fs *BaseFileSystem) Stat(name string) (fi os.FileInfo, err error)

func (*BaseFileSystem) StatByID

func (fs *BaseFileSystem) StatByID(id ID) (fi os.FileInfo, err error)

type File

type File interface {
	io.ReadWriteCloser
	io.ReaderAt
	io.Seeker
	io.WriterAt

	Name() string
	Readdir(count int) ([]os.FileInfo, error)
	Readdirnames(n int) ([]string, error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	WriteString(s string) (ret int, err error)
}

type FileInfo

type FileInfo struct {
	os.FileInfo
	*Metadata
}

func (*FileInfo) ID

func (fi *FileInfo) ID() ID

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

type FileSystem

type FileSystem interface {
	Backend
	OpenAssetByID(id ID, flag int, perm os.FileMode) (File, error)
	OpenAsset(name string, flag int, perm os.FileMode) (Asset, error)
	StatByID(id ID) (os.FileInfo, error)
}

type ID

type ID []byte

func NewID

func NewID() ID

func NewIDFromString

func NewIDFromString(str string) (ID, error)

func (ID) String

func (id ID) String() string

type Metadata

type Metadata struct {
	ID         ID
	FileID     ID
	Mode       os.FileMode
	Name       string
	Attributes map[string]interface{}
}

func (*Metadata) MarshalJSON

func (metadata *Metadata) MarshalJSON() ([]byte, error)

func (*Metadata) UnmarshalJSON

func (metadata *Metadata) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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