blob: 4c97340ed2d0b3b462b2daf04752588c9d3a88b3 (
plain) (
tree)
|
|
// Package fs interace and implementations used by storage/filesystem
package fs
import (
"errors"
"io"
"os"
)
var (
ErrClosed = errors.New("File: Writing on closed file.")
ErrReadOnly = errors.New("this is a read-only filesystem")
ErrNotSupported = errors.New("feature not supported")
)
type Filesystem interface {
Create(filename string) (File, error)
Open(filename string) (File, error)
Rename(from, to string) error
Stat(filename string) (FileInfo, error)
ReadDir(path string) ([]FileInfo, error)
Join(elem ...string) string
Dir(path string) Filesystem
Base() string
}
type File interface {
Filename() string
io.Writer
io.Reader
io.Seeker
io.Closer
}
type FileInfo os.FileInfo
type BaseFile struct {
filename string
closed bool
}
//Filename returns the filename from the File
func (f *BaseFile) Filename() string {
return f.filename
}
//IsClosed returns if te file is closed
func (f *BaseFile) IsClosed() bool {
return f.closed
}
|