fs

package
v2.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 20 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 (
	// the expiration duration of the dentry in the cache (used internally)
	DentryValidDuration = 5 * time.Second
	DefaultReaddirLimit = 1024
)
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 (
	MinSummaryCacheEvictNum   = 10
	MaxSummaryCacheEvictNum   = 200000
	SummaryBgEvictionInterval = 2 * time.Minute
	DefaultSummaryExpiration  = 2 * time.Minute
	MaxSummaryCache           = 1000000
)
View Source
const (
	DeleteExtentsTimeout = 600 * 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 *proto.InodeInfo) fs.Node

NewDir returns a new directory.

func NewFile

func NewFile(s *Super, i *proto.InodeInfo, parentIno uint64) 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) ReadDir

func (d *Dir) ReadDir(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) ([]fuse.Dirent, 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) Release

func (d *Dir) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error)

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 DirContext

type DirContext struct {
	Name string
}

used to locate the position in parent

type DirContexts

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

func NewDirContexts

func NewDirContexts() (dctx *DirContexts)

func (*DirContexts) GetCopy

func (dctx *DirContexts) GetCopy(handle fuse.HandleID) DirContext

func (*DirContexts) Put

func (dctx *DirContexts) Put(handle fuse.HandleID, dirCtx *DirContext)

func (*DirContexts) Remove

func (dctx *DirContexts) Remove(handle fuse.HandleID)

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 only when fsyncOnClose is enabled.

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 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 info based on the given inode number.

func (*InodeCache) Get

func (ic *InodeCache) Get(ino uint64) *proto.InodeInfo

Get returns the inode info based on the given inode number.

func (*InodeCache) Put

func (ic *InodeCache) Put(info *proto.InodeInfo)

Put puts the given inode info into the inode cache.

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 SummaryCache

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

SummaryCache defines the structure of the content-summary cache.

func NewSummaryCache

func NewSummaryCache(exp time.Duration, maxElement int) *SummaryCache

NewSummaryCache returns a new content-summary cache.

func (*SummaryCache) Delete

func (sc *SummaryCache) Delete(inode uint64)

Delete deletes the content-summary info based on the given inode number.

func (*SummaryCache) Get

func (sc *SummaryCache) Get(inode uint64) *proto.SummaryInfo

Get returns the content-summary info based on the given inode number.

func (*SummaryCache) Put

func (sc *SummaryCache) Put(inode uint64, summaryInfo *proto.SummaryInfo)

Put puts the given summary info into the content-summary cache.

type Super

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

Super defines the struct of a super block.

func NewSuper

func NewSuper(opt *proto.MountOptions) (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) (*proto.InodeInfo, error)

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