fs

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBlksize    = uint32(1) << 12
	DefaultMaxNameLen = uint32(256)
)
View Source
const (
	DefaultInodeExpiration = 120 * time.Second
	MaxInodeCache          = 10000000 // in terms of the number of items
)
View Source
const (
	// MinInodeCacheEvictNum is used in the foreground eviction.
	// When clearing the inodes from the cache, it stops as soon as 10 inodes have been evicted.
	MinInodeCacheEvictNum = 10
	// MaxInodeCacheEvictNum is used in the back ground. We can evict 200000 inodes at max.
	MaxInodeCacheEvictNum = 200000

	BgEvictionInterval = 2 * time.Minute
)
View Source
const (
	DeleteExtentsTimeout = 600 * time.Second
)
View Source
const (
	// the expiration duration of the dentry in the cache (used internally)
	DentryValidDuration = 5 * time.Second
)
View Source
const (
	LogTimeFormat = "20060102150405000"
)
View Source
const (
	RootInode = proto.RootIno
)

Variables

View Source
var (
	// The following two are used in the FUSE cache
	// every time the lookup will be performed on the fly, and the result will not be cached
	LookupValidDuration = 5 * time.Second
	// the expiration duration of the attributes in the FUSE cache
	AttrValidDuration = 30 * time.Second
)

Functions

func NewDir

func NewDir(s *Super, i *Inode) fs.Node

NewDir returns a new directory.

func NewFile

func NewFile(s *Super, i *Inode) fs.Node

NewFile returns a new file.

func ParseError

func ParseError(err error) fuse.Errno

ParseError returns the error type.

func ParseType

func ParseType(t uint32) fuse.DirentType

ParseType returns the dentry type.

Types

type DentryCache

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

DentryCache defines the dentry cache.

func NewDentryCache

func NewDentryCache() *DentryCache

NewDentryCache returns a new dentry cache.

func (*DentryCache) Delete

func (dc *DentryCache) Delete(name string)

Delete deletes the item based on the given key.

func (*DentryCache) Get

func (dc *DentryCache) Get(name string) (uint64, bool)

Get gets the item from the cache based on the given key.

func (*DentryCache) Put

func (dc *DentryCache) Put(name string, ino uint64)

Put puts an item into the cache.

type Dir

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

Dir defines the structure of a directory

func (*Dir) Attr

func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error

Attr set the attributes of a directory.

func (*Dir) Create

func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)

Create handles the create request.

func (*Dir) Forget

func (d *Dir) Forget()

Forget is called when the evict is invoked from the kernel.

func (*Dir) Fsync

func (d *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) error

func (*Dir) Getxattr

func (d *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error

Getxattr has not been implemented yet.

func (d *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (fs.Node, error)

Link handles the link request.

func (*Dir) Listxattr

func (d *Dir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error

Listxattr has not been implemented yet.

func (*Dir) Lookup

func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)

Lookup handles the lookup request.

func (*Dir) Mkdir

func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)

Mkdir handles the mkdir request.

func (*Dir) Mknod added in v1.1.1

func (d *Dir) Mknod(ctx context.Context, req *fuse.MknodRequest) (fs.Node, error)

func (*Dir) ReadDirAll

func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

ReadDirAll gets all the dentries in a directory and puts them into the cache.

func (*Dir) Remove

func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error

Remove handles the remove request.

func (*Dir) Removexattr

func (d *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error

Removexattr has not been implemented yet.

func (*Dir) Rename

func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error

Rename handles the rename request.

func (*Dir) Setattr

func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error

Setattr handles the setattr request.

func (*Dir) Setxattr

func (d *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error

Setxattr has not been implemented yet.

func (d *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node, error)

Symlink handles the symlink request.

type File

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

File defines the structure of a file.

func (*File) Attr

func (f *File) Attr(ctx context.Context, a *fuse.Attr) error

Attr sets the attributes of a file.

func (*File) Flush

func (f *File) Flush(ctx context.Context, req *fuse.FlushRequest) (err error)

Flush has not been implemented.

func (*File) Forget

func (f *File) Forget()

Forget evicts the inode of the current file. This can only happen when the inode is on the orphan list.

func (*File) Fsync

func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error)

Fsync hanldes the fsync request.

func (*File) Getxattr

func (f *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error

Getxattr has not been implemented yet.

func (*File) Listxattr

func (f *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error

Listxattr has not been implemented yet.

func (*File) Open

func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (handle fs.Handle, err error)

Open handles the open request.

func (*File) Read

func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error)

Read handles the read request.

func (f *File) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error)

Readlink handles the readlink request.

func (*File) Release

func (f *File) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error)

Release handles the release request.

func (*File) Removexattr

func (f *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error

Removexattr has not been implemented yet.

func (*File) Setattr

func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error

Setattr handles the setattr request.

func (*File) Setxattr

func (f *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error

Setxattr has not been implemented yet.

func (*File) Write

func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)

Write handles the write request.

type Inode

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

Inode defines the structure of an inode.

func NewInode

func NewInode(info *proto.InodeInfo) *Inode

NewInode returns a new inode.

func (*Inode) String

func (inode *Inode) String() string

String returns the string format of the inode.

type InodeCache

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

InodeCache defines the structure of the inode cache.

func NewInodeCache

func NewInodeCache(exp time.Duration, maxElements int) *InodeCache

NewInodeCache returns a new inode cache.

func (*InodeCache) Delete

func (ic *InodeCache) Delete(ino uint64)

Delete deletes the inode based on the given inode ID.

func (*InodeCache) Get

func (ic *InodeCache) Get(ino uint64) *Inode

Get returns the inode based on the given inode ID.

func (*InodeCache) Put

func (ic *InodeCache) Put(inode *Inode)

Put puts the given inode into the inode cache.

type MountOption added in v1.4.0

type MountOption struct {
	MountPoint    string
	Volname       string
	Owner         string
	Master        string
	Logpath       string
	Loglvl        string
	Profport      string
	IcacheTimeout int64
	LookupValid   int64
	AttrValid     int64
	ReadRate      int64
	WriteRate     int64
	EnSyncWrite   int64
	AutoInvalData int64
	UmpDatadir    string
	Rdonly        bool
	WriteCache    bool
	KeepCache     bool
	Authenticate  bool
	TicketMess    auth.TicketMess
}

type OrphanInodeList

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

OrphanInodeList defines the orphan inode list, which is a list of orphan inodes. An orphan inode is the inode whose nlink value is 0.

func NewOrphanInodeList

func NewOrphanInodeList() *OrphanInodeList

NewOrphanInodeList returns a new orphan inode list.

func (*OrphanInodeList) Evict

func (l *OrphanInodeList) Evict(ino uint64) bool

Evict remove the given inode from the orphan inode list, and evicts it.

func (*OrphanInodeList) Put

func (l *OrphanInodeList) Put(ino uint64)

Put puts an inode into the orphan inode list.

type Super

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

Super defines the struct of a super block.

func NewSuper

func NewSuper(opt *MountOption) (s *Super, err error)

NewSuper returns a new Super.

func (*Super) ClusterName

func (s *Super) ClusterName() string

ClusterName returns the cluster name.

func (*Super) GetRate added in v1.4.0

func (s *Super) GetRate(w http.ResponseWriter, r *http.Request)

func (*Super) InodeGet

func (s *Super) InodeGet(ino uint64) (*Inode, error)

InodeGet return the inode based on the given inode ID.

func (*Super) Root

func (s *Super) Root() (fs.Node, error)

Root returns the root directory where it resides.

func (*Super) SetRate added in v1.4.0

func (s *Super) SetRate(w http.ResponseWriter, r *http.Request)

func (*Super) Statfs

func (s *Super) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error

Statfs handles the Statfs request and returns a set of statistics.

Jump to

Keyboard shortcuts

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