Documentation ¶
Index ¶
- Constants
- Variables
- func NewDir(s *Super, i *proto.InodeInfo) fs.Node
- func NewFile(s *Super, i *proto.InodeInfo, flag uint32, pino uint64) fs.Node
- func ParseError(err error) fuse.Errno
- func ParseType(t uint32) fuse.DirentType
- type DentryCache
- type Dir
- func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error
- func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
- func (d *Dir) Forget()
- func (d *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) error
- func (d *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
- func (d *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (fs.Node, error)
- func (d *Dir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
- func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)
- func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)
- func (d *Dir) Mknod(ctx context.Context, req *fuse.MknodRequest) (fs.Node, error)
- func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)
- func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error
- func (d *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error
- func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error
- func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- func (d *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error
- func (d *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node, error)
- type File
- func (f *File) Attr(ctx context.Context, a *fuse.Attr) error
- func (f *File) Flush(ctx context.Context, req *fuse.FlushRequest) (err error)
- func (f *File) Forget()
- func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error)
- func (f *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
- func (f *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
- func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (handle fs.Handle, err error)
- func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error)
- func (f *File) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error)
- func (f *File) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error)
- func (f *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error
- func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- func (f *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error
- func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)
- type InodeCache
- type OrphanInodeList
- type SummaryCache
- type Super
- func (s *Super) ClusterName() string
- func (s *Super) GetRate(w http.ResponseWriter, r *http.Request)
- func (s *Super) InodeGet(ino uint64) (*proto.InodeInfo, error)
- func (s *Super) Root() (fs.Node, error)
- func (s *Super) SetRate(w http.ResponseWriter, r *http.Request)
- func (s *Super) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error
Constants ¶
const ( DefaultBlksize = uint32(1) << 12 DefaultMaxNameLen = uint32(256) )
const ( DefaultInodeExpiration = 120 * time.Second MaxInodeCache = 10000000 // in terms of the number of items )
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 )
const ( MinSummaryCacheEvictNum = 10 MaxSummaryCacheEvictNum = 200000 SummaryBgEvictionInterval = 2 * time.Minute DefaultSummaryExpiration = 2 * time.Minute MaxSummaryCache = 1000000 )
const BlobWriterIdleTimeoutPeriod = 10
const (
DefaultFlag = 0x0f
)
const (
DeleteExtentsTimeout = 600 * time.Second
)
const ( // the expiration duration of the dentry in the cache (used internally) DentryValidDuration = 5 * time.Second )
const (
LogTimeFormat = "20060102150405000"
)
const (
MaxSizePutOnce = int64(1) << 23
)
const (
RootInode = proto.RootIno
)
Variables ¶
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 ¶
Types ¶
type DentryCache ¶
DentryCache defines the 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) 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) Getxattr ¶
func (d *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
Getxattr has not been implemented yet.
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) ReadDirAll ¶
ReadDirAll gets all the dentries in a directory and puts them into the cache.
func (*Dir) Removexattr ¶
Removexattr has not been implemented yet.
func (*Dir) Setattr ¶
func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
Setattr handles the setattr request.
type File ¶
File defines the structure of a file.
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) 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 (*File) Removexattr ¶
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) Write ¶
func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)
Write handles the write request.
type InodeCache ¶
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 ¶
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 ¶
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) *meta.SummaryInfo
Get returns the content-summary info based on the given inode number.
func (*SummaryCache) Put ¶
func (sc *SummaryCache) Put(inode uint64, summaryInfo *meta.SummaryInfo)
Put puts the given summary info into the content-summary cache.
type Super ¶
type Super struct { CacheAction int CacheThreshold int EbsBlockSize int // 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 ¶
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) 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.