real

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(filesystem *fs.FS, parent fs.Dir, user, name string, perm uint32, mode uint8) (fs.Dir, error)

CreateDir is a function meant to be passed to WithCreateDir. It creates a real directory under the parent

func CreateFile

func CreateFile(filesystem *fs.FS, parent fs.Dir, user, name string, perm uint32, mode uint8) (fs.File, error)

CreateFile is a function meant to be passed to WithCreateFile. It will add an empty StaticFile to the FS whenever a client attempts to create a file.

func Remove

func Remove(filesystem *fs.FS, f fs.FSNode) error

Types

type Dir

type Dir struct {
	Path string
}

func (*Dir) Children

func (d *Dir) Children() map[string]fs.FSNode

func (*Dir) Parent

func (f *Dir) Parent() fs.Dir

func (*Dir) SetParent

func (f *Dir) SetParent(d fs.Dir)

func (*Dir) Stat

func (f *Dir) Stat() proto.Stat

func (*Dir) WriteStat

func (f *Dir) WriteStat(s *proto.Stat) error

type File

type File struct {
	Path string
	// contains filtered or unexported fields
}

func NewFile

func NewFile(path string) *File

func (*File) Close

func (f *File) Close(fid uint64) error

func (*File) Open

func (f *File) Open(fid uint64, omode proto.Mode) error

func (*File) Parent

func (f *File) Parent() fs.Dir

func (*File) Read

func (f *File) Read(fid uint64, offset uint64, count uint64) ([]byte, error)

func (*File) SetParent

func (f *File) SetParent(d fs.Dir)

func (*File) Stat

func (f *File) Stat() proto.Stat

func (*File) Write

func (f *File) Write(fid uint64, offset uint64, data []byte) (uint32, error)

func (*File) WriteStat

func (f *File) WriteStat(s *proto.Stat) error

Jump to

Keyboard shortcuts

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