writefs

package
v2.0.15 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const (
	LowFS levelFS = iota
	MediumFS
	HighFS
)

Variables

View Source
var ErrNotImplemented = errors.NewPlain("not implemented")

Functions

func Close

func Close(fsys fs.FS) error

func Fullpath

func Fullpath(fsys fs.FS, name string) (string, error)

func HasContent

func HasContent(fsys fs.FS) bool

func MkDir

func MkDir(fsys fs.FS, path string) error

func NewDirEntry

func NewDirEntry(info fs.FileInfo) *dirEntry

NewDirEntry creates a new DirEntry from a FileInfo.

func NewFileInfoDir

func NewFileInfoDir(base string) *fileInfoDir

NewFileInfoDir creates a new FileInfo for a directory.

func NewNopReadCloser

func NewNopReadCloser(r io.Reader) io.ReadCloser

NopReadCloser returns a ReadCloser with a no-op Close method wrapping

func NewNopWriteCloser

func NewNopWriteCloser(w io.Writer) io.WriteCloser

func NewSidecarAESWriter

func NewSidecarAESWriter(w io.Writer, aesWriter io.WriteCloser) (io.WriteCloser, error)

func NewSidecarChecksumWriter

func NewSidecarChecksumWriter(w io.Writer, sidecars map[checksum.DigestAlgorithm]io.WriteCloser) (io.WriteCloser, error)

func NewSubFS

func NewSubFS(fsys fs.FS, dir string) *subFS

func Remove

func Remove(fsys fs.FS, path string) error

func Rename

func Rename(fsys fs.FS, oldPath, newPath string) error

func SubFSCreate added in v2.0.3

func SubFSCreate(fsys fs.FS, path string) (fs.FS, error)

func WriteFile

func WriteFile(fsys fs.FS, name string, data []byte) error

Types

type CloseFS

type CloseFS interface {
	Close() error
}

type CreateFS

type CreateFS interface {
	Create(path string) (FileWrite, error)
}

type CreateFSFunc

type CreateFSFunc func(f *Factory, path string) (fs.FS, error)

type Factory

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

func NewFactory

func NewFactory() (*Factory, error)

func (*Factory) Get

func (f *Factory) Get(path string) (fs.FS, error)

func (*Factory) Register

func (f *Factory) Register(create CreateFSFunc, identifyRegex string, level levelFS) error

type FileWrite

type FileWrite interface {
	io.WriteCloser
}

func Create

func Create(fsys fs.FS, path string) (FileWrite, error)

type FileWriteSeeker

type FileWriteSeeker interface {
	FileWrite
	io.Seeker
}

type FileWriterAt

type FileWriterAt interface {
	FileWrite
	io.WriterAt
}

type FullpathFS

type FullpathFS interface {
	Fullpath(name string) (string, error)
}

type IsLockedFS

type IsLockedFS interface {
	fs.FS
	IsLocked() bool
}

IsLockedFS is a fs.FS that can be checked for being locked.

type MkDirFS

type MkDirFS interface {
	MkDir(path string) error
}

type Mutex

type Mutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMutex

func NewMutex() *Mutex

func (*Mutex) IsLocked

func (m *Mutex) IsLocked() bool

func (*Mutex) Lock

func (m *Mutex) Lock()

func (*Mutex) Unlock

func (m *Mutex) Unlock()

type ReadWriteFS

type ReadWriteFS interface {
	fs.FS
	CreateFS
}

type RemoveFS

type RemoveFS interface {
	Remove(path string) error
}

type RenameFS

type RenameFS interface {
	Rename(oldPath, newPath string) error
}

type WriteFileFS

type WriteFileFS interface {
	WriteFile(name string, data []byte) error
}

Jump to

Keyboard shortcuts

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