vfs

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: AGPL-3.0 Imports: 21 Imported by: 9

Documentation

Index

Constants

View Source
const (
	MODE_MASK_R = 4
	MODE_MASK_W = 2
	MODE_MASK_X = 1
)
View Source
const (
	NEW = iota
	BUSY
	REFRESH
	BREAK
	READY
	INVALID
)

* state of sliceReader * * <-- REFRESH * | | * NEW -> BUSY -> READY * | | * BREAK ---> INVALID

View Source
const F_UNLCK = syscall.F_UNLCK
View Source
const O_ACCMODE = syscall.O_ACCMODE

Variables

This section is empty.

Functions

func Access added in v0.9.0

func Access(ctx Context, ino Ino, mask int) (err syscall.Errno)

func Compact

func Compact(conf chunk.Config, store chunk.ChunkStore, slices []meta.Slice, chunkid uint64) error

func CopyFileRange added in v0.11.0

func CopyFileRange(ctx Context, nodeIn Ino, fhIn, offIn uint64, nodeOut Ino, fhOut, offOut, size uint64, flags uint32) (copied uint64, err syscall.Errno)

func Create added in v0.9.0

func Create(ctx Context, parent Ino, name string, mode uint16, cumask uint16, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)

func Fallocate added in v0.9.0

func Fallocate(ctx Context, ino Ino, mode uint8, off, length int64, fh uint64) (err syscall.Errno)

func Flock added in v0.9.0

func Flock(ctx Context, ino Ino, fh uint64, owner uint64, typ uint32, block bool) (err syscall.Errno)

func Flush added in v0.9.0

func Flush(ctx Context, ino Ino, fh uint64, lockOwner uint64) (err syscall.Errno)

func Fsync added in v0.9.0

func Fsync(ctx Context, ino Ino, datasync int, fh uint64) (err syscall.Errno)

func GetAttr added in v0.9.0

func GetAttr(ctx Context, ino Ino, opened uint8) (entry *meta.Entry, err syscall.Errno)

func GetInternalNodeByName

func GetInternalNodeByName(name string) (Ino, *Attr)

func GetXattr added in v0.9.0

func GetXattr(ctx Context, ino Ino, name string, size uint32) (value []byte, err syscall.Errno)

func Getlk added in v0.9.0

func Getlk(ctx Context, ino Ino, fh uint64, owner uint64, start, len *uint64, typ *uint32, pid *uint32) (err syscall.Errno)

func Init added in v0.9.0

func Init(conf *Config, m_ meta.Meta, store_ chunk.ChunkStore)

func InitMetrics

func InitMetrics()

func IsSpecialName

func IsSpecialName(name string) bool

func IsSpecialNode

func IsSpecialNode(ino Ino) bool
func Link(ctx Context, ino Ino, newparent Ino, newname string) (entry *meta.Entry, err syscall.Errno)

func ListXattr added in v0.9.0

func ListXattr(ctx Context, ino Ino, size int) (data []byte, err syscall.Errno)

func Lookup added in v0.9.0

func Lookup(ctx Context, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)

func Mkdir added in v0.9.0

func Mkdir(ctx Context, parent Ino, name string, mode uint16, cumask uint16) (entry *meta.Entry, err syscall.Errno)

func Mknod added in v0.9.0

func Mknod(ctx Context, parent Ino, name string, mode uint16, cumask uint16, rdev uint32) (entry *meta.Entry, err syscall.Errno)

func Open added in v0.9.0

func Open(ctx Context, ino Ino, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)

func Opendir added in v0.9.0

func Opendir(ctx Context, ino Ino) (fh uint64, err syscall.Errno)

func Read added in v0.9.0

func Read(ctx Context, ino Ino, buf []byte, off uint64, fh uint64) (n int, err syscall.Errno)

func Readdir added in v0.9.0

func Readdir(ctx Context, ino Ino, size uint32, off int, fh uint64, plus bool) (entries []*meta.Entry, err syscall.Errno)
func Readlink(ctx Context, ino Ino) (path []byte, err syscall.Errno)

func Release added in v0.9.0

func Release(ctx Context, ino Ino, fh uint64) (err syscall.Errno)

func ReleaseHandler added in v0.9.0

func ReleaseHandler(ino Ino, fh uint64)

func Releasedir added in v0.9.0

func Releasedir(ctx Context, ino Ino, fh uint64) int

func RemoveXattr added in v0.9.0

func RemoveXattr(ctx Context, ino Ino, name string) (err syscall.Errno)

func Rename added in v0.9.0

func Rename(ctx Context, parent Ino, name string, newparent Ino, newname string, flags uint32) (err syscall.Errno)

func Rmdir added in v0.9.0

func Rmdir(ctx Context, parent Ino, name string) (err syscall.Errno)

func SetAttr added in v0.9.0

func SetAttr(ctx Context, ino Ino, set int, opened uint8, mode, uid, gid uint32, atime, mtime int64, atimensec, mtimensec uint32, size uint64) (entry *meta.Entry, err syscall.Errno)

func SetXattr added in v0.9.0

func SetXattr(ctx Context, ino Ino, name string, value []byte, flags uint32) (err syscall.Errno)

func Setlk added in v0.9.0

func Setlk(ctx Context, ino Ino, fh uint64, owner uint64, start, end uint64, typ uint32, pid uint32, block bool) (err syscall.Errno)
func Symlink(ctx Context, path string, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)

func Truncate added in v0.9.0

func Truncate(ctx Context, ino Ino, size int64, opened uint8, attr *Attr) (err syscall.Errno)
func Unlink(ctx Context, parent Ino, name string) (err syscall.Errno)

func UpdateLength added in v0.9.1

func UpdateLength(inode Ino, attr *meta.Attr)

func Write added in v0.9.0

func Write(ctx Context, ino Ino, buf []byte, off, fh uint64) (err syscall.Errno)

Types

type Attr

type Attr = meta.Attr

type Config

type Config struct {
	Meta            *meta.Config
	Format          *meta.Format
	Chunk           *chunk.Config
	Version         string
	Mountpoint      string
	AttrTimeout     time.Duration
	DirEntryTimeout time.Duration
	EntryTimeout    time.Duration
	FastResolve     bool   `json:",omitempty"`
	AccessLog       string `json:",omitempty"`
}

type Context

type Context = LogContext

type DataReader

type DataReader interface {
	Open(inode Ino, length uint64) FileReader
	Truncate(inode Ino, length uint64)
	Invalidate(inode Ino, off, length uint64)
}

func NewDataReader

func NewDataReader(conf *Config, m meta.Meta, store chunk.ChunkStore) DataReader

type DataWriter

type DataWriter interface {
	Open(inode Ino, fleng uint64) FileWriter
	Flush(ctx meta.Context, inode Ino) syscall.Errno
	GetLength(inode Ino) uint64
	Truncate(inode Ino, length uint64)
}

func NewDataWriter

func NewDataWriter(conf *Config, m meta.Meta, store chunk.ChunkStore, reader DataReader) DataWriter

type Entry

type Entry meta.Entry

Entry is an alias of meta.Entry, which is used to generate the string representation lazily.

func (*Entry) String

func (entry *Entry) String() string

type FileReader

type FileReader interface {
	Read(ctx meta.Context, off uint64, buf []byte) (int, syscall.Errno)
	Close(ctx meta.Context)
}

type FileWriter

type FileWriter interface {
	Write(ctx meta.Context, offset uint64, data []byte) syscall.Errno
	Flush(ctx meta.Context) syscall.Errno
	Close(ctx meta.Context) syscall.Errno
	GetLength() uint64
	Truncate(length uint64)
}

type Ino

type Ino = meta.Ino

type LogContext

type LogContext interface {
	meta.Context
	Duration() time.Duration
}

LogContext is an interface to add duration on meta.Context.

func NewLogContext

func NewLogContext(ctx meta.Context) LogContext

NewLogContext creates an LogContext starting from now.

type Statfs

type Statfs struct {
	Bsize  uint32
	Blocks uint64
	Bavail uint64
	Files  uint64
	Favail uint64
}

func StatFS added in v0.9.0

func StatFS(ctx Context, ino Ino) (st *Statfs, err int)

Jump to

Keyboard shortcuts

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