vfs

package
v0.0.0-...-cb82e99 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextHandle

func NextHandle() uint64

func NextInodeID

func NextInodeID() uint64

Types

type Cache

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

func NewCache

func NewCache(s, c types.Storager, logger *zap.Logger) *Cache

func (*Cache) Start

func (c *Cache) Start()

func (*Cache) Stop

func (c *Cache) Stop()

type Config

type Config struct {
	StoragePath string

	Logger *zap.Logger
}

type DirHandle

type DirHandle struct {
	ID uint64
	// contains filtered or unexported fields
}

func (*DirHandle) Next

func (dh *DirHandle) Next() (ino *Inode, err error)

type FS

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

func NewFS

func NewFS(cfg *Config) (fs *FS, err error)

func (*FS) Create

func (fs *FS) Create(parent uint64, name string) (ino *Inode, fh *FileHandle, err error)

func (*FS) CreateDirHandle

func (fs *FS) CreateDirHandle(ino *Inode) (dh *DirHandle, err error)

func (*FS) CreateFileHandle

func (fs *FS) CreateFileHandle(ino *Inode) (fh *FileHandle, err error)

func (*FS) Delete

func (fs *FS) Delete(parent uint64, name string) (err error)

func (*FS) DeleteDir

func (fs *FS) DeleteDir(path string) (err error)

func (*FS) DeleteDirHandle

func (fs *FS) DeleteDirHandle(dhid uint64) (err error)

func (*FS) DeleteEntry

func (fs *FS) DeleteEntry(parent uint64, name string) (err error)

func (*FS) DeleteFileHandle

func (fs *FS) DeleteFileHandle(fhid uint64) (err error)

func (*FS) DeleteInode

func (fs *FS) DeleteInode(ino *Inode) (err error)

func (*FS) DeleteInodeByID

func (fs *FS) DeleteInodeByID(id uint64) (err error)

func (*FS) GetDirHandle

func (fs *FS) GetDirHandle(dhid uint64) (dh *DirHandle, err error)

func (*FS) GetEntry

func (fs *FS) GetEntry(parent uint64, name string) (ino *Inode, err error)

func (*FS) GetFileHandle

func (fs *FS) GetFileHandle(fhid uint64) (fh *FileHandle, err error)

func (*FS) GetInode

func (fs *FS) GetInode(id uint64) (ino *Inode, err error)

func (*FS) SetInode

func (fs *FS) SetInode(ino *Inode) (err error)

func (*FS) Stat

func (fs *FS) Stat(parent uint64, name string) (ino *Inode, err error)

type FileHandle

type FileHandle struct {
	ID uint64
	// contains filtered or unexported fields
}

func (*FileHandle) CloseForWrite

func (fh *FileHandle) CloseForWrite() (err error)

func (*FileHandle) GetInode

func (fh *FileHandle) GetInode() *Inode

func (*FileHandle) PrepareForWrite

func (fh *FileHandle) PrepareForWrite() (err error)

func (*FileHandle) Read

func (fh *FileHandle) Read(offset uint64, buf []byte) (n int, err error)

func (*FileHandle) Write

func (fh *FileHandle) Write(offset uint64, buf []byte) (n int, err error)

type Inode

type Inode struct {
	ID       uint64
	ParentID uint64

	Path       string
	Name       string
	Generation uint64
	Size       uint64
	Mode       uint32 // The same with os.FileMode
	Atime      time.Time
	Mtime      time.Time
	Ctime      time.Time
}

func (*Inode) DecodeMsg

func (z *Inode) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Inode) EncodeMsg

func (z *Inode) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Inode) GetEntryPath

func (ino *Inode) GetEntryPath(name string) string

func (*Inode) IsDir

func (ino *Inode) IsDir() bool

func (*Inode) MarshalMsg

func (z *Inode) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Inode) Msgsize

func (z *Inode) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Inode) UnmarshalMsg

func (z *Inode) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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