Documentation ¶
Index ¶
- Constants
- func Assert(bOk bool)
- func PullThirdPartyUser(cfg conf.Config, log *ClientLogger) (u *conf.UserInfo, err error)
- type Buffer
- func (buf *Buffer) CanMerge(Offset uint32) bool
- func (buf *Buffer) GetAlignOffset() uint64
- func (buf *Buffer) GetData() []byte
- func (buf *Buffer) GetFileOffset() uint64
- func (buf *Buffer) GetRangeData(Start uint32, End uint32) []byte
- func (buf *Buffer) GetTailOffset() uint64
- func (buf *Buffer) IsFull(BlockSize uint32) bool
- func (buf *Buffer) MergeData(data []byte)
- func (buf *Buffer) ReSet(fe *FileEntry, BlkIdx uint64)
- func (buf *Buffer) Skip(Offset uint32)
- type CacheLock
- type CfaMountInfo
- func (mount *CfaMountInfo) Chmod(path string, mode uint32) error
- func (mount *CfaMountInfo) Chown(path string, uid, gid uint32) error
- func (mount *CfaMountInfo) ChownEx(path string, owner, group string) error
- func (mount *CfaMountInfo) Close(fd int) error
- func (mount *CfaMountInfo) DelMount()
- func (mount *CfaMountInfo) Fchmod(fd int, mode uint32) error
- func (mount *CfaMountInfo) Fgetxattr(fd int, key string) ([]byte, error)
- func (mount *CfaMountInfo) Flistxattr(fd int) ([]string, error)
- func (mount *CfaMountInfo) Flush(fd int) error
- func (mount *CfaMountInfo) Fremovexattr(fd int, key string) error
- func (mount *CfaMountInfo) Fsetxattr(fd int, key string, value []byte, flag int) error
- func (mount *CfaMountInfo) Fstat(fd int) (*Dentry, error)
- func (mount *CfaMountInfo) Fsync(fd int, datasync int) error
- func (mount *CfaMountInfo) Ftruncate(fd int, size uint64) error
- func (mount *CfaMountInfo) GetLogger() *zap.Logger
- func (mount *CfaMountInfo) GetProxyClient() *api.ProxyClient
- func (mount *CfaMountInfo) GetSimpleFileEntry(dentry *Dentry) *FileEntry
- func (mount *CfaMountInfo) Getxattr(path string, key string) ([]byte, error)
- func (mount *CfaMountInfo) Link(path, linkPath string) error
- func (mount *CfaMountInfo) Listxattr(path string) ([]string, error)
- func (mount *CfaMountInfo) Mkdir(path string, mode uint32) error
- func (mount *CfaMountInfo) MkdirAll(path string, mode uint32) error
- func (mount *CfaMountInfo) Mknod(path string, mode uint32, dev int) error
- func (mount *CfaMountInfo) Mount() error
- func (mount *CfaMountInfo) Open(path string, flags int, mode uint32) (int, error)
- func (mount *CfaMountInfo) Opendir(path string) (*Dir, error)
- func (mount *CfaMountInfo) Read(fd int, buffer []byte, offset uint64) (int, error)
- func (mount *CfaMountInfo) Readlink(path string) (string, error)
- func (mount *CfaMountInfo) Removexattr(path string, key string) error
- func (mount *CfaMountInfo) Rename(srcpath string, dstpath string) error
- func (mount *CfaMountInfo) RmDirTree(path string) error
- func (mount *CfaMountInfo) Rmdir(path string) error
- func (mount *CfaMountInfo) SetLogLevel(flag int)
- func (mount *CfaMountInfo) Setxattr(path string, key string, value []byte, flag SetXattrFlag) error
- func (mount *CfaMountInfo) Stat(path string) (*Dentry, error)
- func (mount *CfaMountInfo) StatTo()
- func (mount *CfaMountInfo) Statfs(path string, stat *Statfs) error
- func (mount *CfaMountInfo) Symlink(path, linkPath string) error
- func (mount *CfaMountInfo) Truncate(path string, length uint64) error
- func (mount *CfaMountInfo) UnLink(path string) error
- func (mount *CfaMountInfo) UseRWCache(fdEntry *FileEntry) bool
- func (mount *CfaMountInfo) Utime(path string, utime uint64, atime uint64) error
- func (mount *CfaMountInfo) Write(fd int, buffer []byte, offset uint64) (int, error)
- type DentryCache
- type Dir
- type FileBuffer
- func (fileBuf *FileBuffer) AttachBuffer(blkIdx uint64, buffer *Buffer)
- func (fileBuf *FileBuffer) DetachBuffer(blkIdx uint64)
- func (fileBuf *FileBuffer) GetAllBufferIndex() []uint64
- func (fileBuf *FileBuffer) GetBuffer(blkIdx uint64) *Buffer
- func (fileBuf *FileBuffer) IsZeroCache() bool
- func (fileBuf *FileBuffer) LockBuffer(blkIdx uint64)
- func (fileBuf *FileBuffer) RLockBuffer(blkIdx uint64)
- func (fileBuf *FileBuffer) RUnLockBuffer(blkIdx uint64)
- func (fileBuf *FileBuffer) UnLockBuffer(blkIdx uint64)
- func (fileBuf *FileBuffer) UpperIdx() uint64
- func (fileBuf *FileBuffer) Wait()
- type FileCache
- func (fileCache *FileCache) CloseFile(handle uint32) error
- func (fileCache *FileCache) GetFileEntry(handle uint32) (*FileEntry, error)
- func (fileCache *FileCache) GetMinEntryIndex() uint32
- func (fileCache *FileCache) IsLastRefer(fileEntry *FileEntry) bool
- func (fileCache *FileCache) NewFile(fd *int, fileEntry *FileEntry) error
- type FileEntry
- type LsStatus
- type MountStu
- type PrefetchWindow
- func (pw *PrefetchWindow) Cross(rw *PrefetchWindow) bool
- func (pw *PrefetchWindow) Extend(Times uint32)
- func (pw *PrefetchWindow) GetEnd() uint64
- func (pw *PrefetchWindow) GetStart() uint64
- func (pw *PrefetchWindow) Move()
- func (pw *PrefetchWindow) Reset()
- func (pw *PrefetchWindow) Shift(Step uint64)
- func (pw *PrefetchWindow) Size() uint32
- type RCache
- func (cache *RCache) AllocBuffer(fe *FileEntry, BlkIdx uint64) *Buffer
- func (cache *RCache) CheckExpire() error
- func (cache *RCache) Clean(fe *FileEntry, Size int, offset uint64) error
- func (cache *RCache) Close(fe *FileEntry) error
- func (cache *RCache) CloseAll()
- func (cache *RCache) DetachFileBuffer(fe *FileEntry)
- func (cache *RCache) DirectRead(fe *FileEntry, buffer []byte, offset uint64) (int, error)
- func (cache *RCache) DoLru(buf *Buffer)
- func (cache *RCache) DoPrefetch(fileBuf *FileBuffer, Size uint32, offset uint64)
- func (cache *RCache) DoPrefetchRead(fileBuf *FileBuffer, op *RWBlockOp) error
- func (cache *RCache) FreeBuffer(buf *Buffer)
- func (cache *RCache) GetFileBuffer(fe *FileEntry, bAlloc bool) *FileBuffer
- func (cache *RCache) GetReadWindow(fe *FileEntry, Size uint32, offset uint64) *PrefetchWindow
- func (cache *RCache) LruExpire() (fe *FileEntry, blkIdx uint64)
- func (cache *RCache) PrefetchRead() error
- func (cache *RCache) ReadOp(fe *FileEntry, fileBuf *FileBuffer, op RWBlockOp) (int, error)
- func (cache *RCache) Release(fe *FileEntry) error
- func (cache *RCache) ReleaseBuffer(fileBuf *FileBuffer, Index uint64) error
- func (cache *RCache) RemoveLru(buf *Buffer)
- func (cache *RCache) Slice(fe *FileEntry, buffer []byte, offset uint64) []RWBlockOp
- func (cache *RCache) TryDoPrefetch(fileBuf *FileBuffer, Size uint32, offset uint64)
- type RWBlockOp
- type RWCache
- func (cache *RWCache) Close(fe *FileEntry) error
- func (cache *RWCache) CloseAll()
- func (cache *RWCache) Flush(fe *FileEntry) error
- func (cache *RWCache) Read(fe *FileEntry, buffer []byte, offset uint64) (int, error)
- func (cache *RWCache) Release(fe *FileEntry) error
- func (cache *RWCache) Write(fe *FileEntry, buffer []byte, offset uint64) (int, error)
- type Reader
- type Statfs
- type WCache
- func (cache *WCache) AllocBuffer(fe *FileEntry, BlkIdx uint64) *Buffer
- func (cache *WCache) CheckExpire() error
- func (cache *WCache) Close(fe *FileEntry) error
- func (cache *WCache) CloseAll()
- func (cache *WCache) DetachFileBuffer(fe *FileEntry)
- func (cache *WCache) DirectWrite(fe *FileEntry, buffer []byte, offset uint64) (int, error)
- func (cache *WCache) DoLru(buf *Buffer)
- func (cache *WCache) Flush(fe *FileEntry) error
- func (cache *WCache) FlushBuffer(fileBuf *FileBuffer, Index uint64) error
- func (cache *WCache) FreeBuffer(buf *Buffer)
- func (cache *WCache) GetFileBuffer(fe *FileEntry, bAlloc bool) *FileBuffer
- func (cache *WCache) LruExpire() (fe *FileEntry, blkIdx uint64)
- func (cache *WCache) MergeOp(fileBuf *FileBuffer, op RWBlockOp, dataSize int) int
- func (cache *WCache) RemoveLru(buf *Buffer)
- func (cache *WCache) Slice(fe *FileEntry, buffer []byte, offset uint64) []RWBlockOp
- func (cache *WCache) StatSize(fe *FileEntry) (uint64, error)
- func (cache *WCache) SyncIo() bool
- func (cache *WCache) SyncWrite() error
- func (cache *WCache) Write(fe *FileEntry, buffer []byte, offset uint64) (int, error)
- func (cache *WCache) WriteOp(fe *FileEntry, fileBuf *FileBuffer, op RWBlockOp) (bool, int, error)
- type Writer
Constants ¶
View Source
const ( WriteLock int = 0 ReadLock int = 1 )
View Source
const InvalidHandle = int(-1)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct { Id uint32 BlkIdx uint64 Offset uint32 Len uint32 LastUpdateTime time.Time // contains filtered or unexported fields }
func (*Buffer) GetAlignOffset ¶
func (*Buffer) GetFileOffset ¶
func (*Buffer) GetTailOffset ¶
type CfaMountInfo ¶
type CfaMountInfo struct { Volume string // "CFA" ClientId string Path string // path prefix MountStu MountStu // mount status User *conf.UserInfo MountMode MountMode // Access permission of the mount path Cfg conf.Config sync.Mutex // file operation related OpenFileMax int // max open files LsSize uint16 // max items for a single 'ls' op, default 2000 // contains filtered or unexported fields }
func (*CfaMountInfo) Chmod ¶
func (mount *CfaMountInfo) Chmod(path string, mode uint32) error
change permission
func (*CfaMountInfo) ChownEx ¶
func (mount *CfaMountInfo) ChownEx(path string, owner, group string) error
change owner, group
func (*CfaMountInfo) Close ¶
func (mount *CfaMountInfo) Close(fd int) error
func (*CfaMountInfo) DelMount ¶
func (mount *CfaMountInfo) DelMount()
func (*CfaMountInfo) Fchmod ¶
func (mount *CfaMountInfo) Fchmod(fd int, mode uint32) error
change permission
func (*CfaMountInfo) Fgetxattr ¶
func (mount *CfaMountInfo) Fgetxattr(fd int, key string) ([]byte, error)
func (*CfaMountInfo) Flistxattr ¶
func (mount *CfaMountInfo) Flistxattr(fd int) ([]string, error)
func (*CfaMountInfo) Flush ¶
func (mount *CfaMountInfo) Flush(fd int) error
func (*CfaMountInfo) Fremovexattr ¶
func (mount *CfaMountInfo) Fremovexattr(fd int, key string) error
func (*CfaMountInfo) Fstat ¶
func (mount *CfaMountInfo) Fstat(fd int) (*Dentry, error)
func (*CfaMountInfo) GetLogger ¶
func (mount *CfaMountInfo) GetLogger() *zap.Logger
func (*CfaMountInfo) GetProxyClient ¶
func (mount *CfaMountInfo) GetProxyClient() *api.ProxyClient
func (*CfaMountInfo) GetSimpleFileEntry ¶
func (mount *CfaMountInfo) GetSimpleFileEntry(dentry *Dentry) *FileEntry
func (*CfaMountInfo) Getxattr ¶
func (mount *CfaMountInfo) Getxattr(path string, key string) ([]byte, error)
func (*CfaMountInfo) Link ¶
func (mount *CfaMountInfo) Link(path, linkPath string) error
create hard link
func (*CfaMountInfo) Listxattr ¶
func (mount *CfaMountInfo) Listxattr(path string) ([]string, error)
func (*CfaMountInfo) MkdirAll ¶
func (mount *CfaMountInfo) MkdirAll(path string, mode uint32) error
cmd line 'mkdir -p'
func (*CfaMountInfo) Mknod ¶
func (mount *CfaMountInfo) Mknod(path string, mode uint32, dev int) error
func (*CfaMountInfo) Mount ¶
func (mount *CfaMountInfo) Mount() error
func (*CfaMountInfo) Opendir ¶
func (mount *CfaMountInfo) Opendir(path string) (*Dir, error)
Opendir reads all items under the dir
func (*CfaMountInfo) Readlink ¶
func (mount *CfaMountInfo) Readlink(path string) (string, error)
reads a soft link file and returns the target file name
func (*CfaMountInfo) Removexattr ¶
func (mount *CfaMountInfo) Removexattr(path string, key string) error
func (*CfaMountInfo) Rename ¶
func (mount *CfaMountInfo) Rename(srcpath string, dstpath string) error
the rename op
func (*CfaMountInfo) RmDirTree ¶
func (mount *CfaMountInfo) RmDirTree(path string) error
force remove a dir and it's subdirs
func (*CfaMountInfo) Rmdir ¶
func (mount *CfaMountInfo) Rmdir(path string) error
remove an empty directory
func (*CfaMountInfo) SetLogLevel ¶
func (mount *CfaMountInfo) SetLogLevel(flag int)
flag > 0 turns up the level
func (*CfaMountInfo) Setxattr ¶
func (mount *CfaMountInfo) Setxattr(path string, key string, value []byte, flag SetXattrFlag) error
func (*CfaMountInfo) Stat ¶
func (mount *CfaMountInfo) Stat(path string) (*Dentry, error)
func (*CfaMountInfo) Symlink ¶
func (mount *CfaMountInfo) Symlink(path, linkPath string) error
create soft link
func (*CfaMountInfo) Truncate ¶
func (mount *CfaMountInfo) Truncate(path string, length uint64) error
func (*CfaMountInfo) UseRWCache ¶
func (mount *CfaMountInfo) UseRWCache(fdEntry *FileEntry) bool
type DentryCache ¶
func NewDentryCache ¶
func NewDentryCache(cacheSize int, expireTimeMs int) *DentryCache
func (*DentryCache) Get ¶
func (cache *DentryCache) Get(k interface{}) (v interface{}, ret bool, err error)
func (*DentryCache) Remove ¶
func (cache *DentryCache) Remove(k interface{}) bool
func (*DentryCache) RemovePrefix ¶
func (cache *DentryCache) RemovePrefix(prefix interface{}) error
func (*DentryCache) Set ¶
func (cache *DentryCache) Set(k, v interface{}) error
type FileBuffer ¶
type FileBuffer struct { sync.RWMutex BufferMap map[uint64]*Buffer LockMap map[uint64]*CacheLock // contains filtered or unexported fields }
func NewFileBuffer ¶
func NewFileBuffer(fe *FileEntry) *FileBuffer
func (*FileBuffer) AttachBuffer ¶
func (fileBuf *FileBuffer) AttachBuffer(blkIdx uint64, buffer *Buffer)
func (*FileBuffer) DetachBuffer ¶
func (fileBuf *FileBuffer) DetachBuffer(blkIdx uint64)
func (*FileBuffer) GetAllBufferIndex ¶
func (fileBuf *FileBuffer) GetAllBufferIndex() []uint64
func (*FileBuffer) GetBuffer ¶
func (fileBuf *FileBuffer) GetBuffer(blkIdx uint64) *Buffer
func (*FileBuffer) IsZeroCache ¶
func (fileBuf *FileBuffer) IsZeroCache() bool
func (*FileBuffer) LockBuffer ¶
func (fileBuf *FileBuffer) LockBuffer(blkIdx uint64)
func (*FileBuffer) RLockBuffer ¶
func (fileBuf *FileBuffer) RLockBuffer(blkIdx uint64)
func (*FileBuffer) RUnLockBuffer ¶
func (fileBuf *FileBuffer) RUnLockBuffer(blkIdx uint64)
func (*FileBuffer) UnLockBuffer ¶
func (fileBuf *FileBuffer) UnLockBuffer(blkIdx uint64)
func (*FileBuffer) UpperIdx ¶
func (fileBuf *FileBuffer) UpperIdx() uint64
func (*FileBuffer) Wait ¶
func (fileBuf *FileBuffer) Wait()
type FileCache ¶
read write Cache
func NewFileCache ¶
func (*FileCache) GetFileEntry ¶
func (*FileCache) GetMinEntryIndex ¶
func (*FileCache) IsLastRefer ¶
type FileEntry ¶
type FileEntry struct { sync.RWMutex Id uint64 // file's dentry id BlockSize uint32 // block size Handle int // upper-layer file handle FilePath string // file path OpenFlag int Mode uint32 // permission DirectIO bool // Direct IO Owner string // Flock owner Pid uint32 // Flock pid LastAccessTime time.Time // contains filtered or unexported fields }
type PrefetchWindow ¶
func NewPrefetchWindow ¶
func NewPrefetchWindow() *PrefetchWindow
func (*PrefetchWindow) Cross ¶
func (pw *PrefetchWindow) Cross(rw *PrefetchWindow) bool
func (*PrefetchWindow) Extend ¶
func (pw *PrefetchWindow) Extend(Times uint32)
func (*PrefetchWindow) GetEnd ¶
func (pw *PrefetchWindow) GetEnd() uint64
func (*PrefetchWindow) GetStart ¶
func (pw *PrefetchWindow) GetStart() uint64
func (*PrefetchWindow) Move ¶
func (pw *PrefetchWindow) Move()
func (*PrefetchWindow) Reset ¶
func (pw *PrefetchWindow) Reset()
func (*PrefetchWindow) Shift ¶
func (pw *PrefetchWindow) Shift(Step uint64)
func (*PrefetchWindow) Size ¶
func (pw *PrefetchWindow) Size() uint32
type RCache ¶
type RCache struct { sync.RWMutex Mount *CfaMountInfo BufferMax int FreeList *list.List Cache map[uint64]*FileBuffer LruList *list.List ExpireTime int PrefetchRoutine int PrefetchTimes int Stop bool // contains filtered or unexported fields }
func (*RCache) CheckExpire ¶
func (*RCache) DetachFileBuffer ¶
func (*RCache) DirectRead ¶
func (*RCache) DoPrefetch ¶
func (cache *RCache) DoPrefetch(fileBuf *FileBuffer, Size uint32, offset uint64)
func (*RCache) DoPrefetchRead ¶
func (cache *RCache) DoPrefetchRead(fileBuf *FileBuffer, op *RWBlockOp) error
func (*RCache) FreeBuffer ¶
func (*RCache) GetFileBuffer ¶
func (cache *RCache) GetFileBuffer(fe *FileEntry, bAlloc bool) *FileBuffer
func (*RCache) GetReadWindow ¶
func (cache *RCache) GetReadWindow(fe *FileEntry, Size uint32, offset uint64) *PrefetchWindow
func (*RCache) PrefetchRead ¶
func (*RCache) ReleaseBuffer ¶
func (cache *RCache) ReleaseBuffer(fileBuf *FileBuffer, Index uint64) error
func (*RCache) TryDoPrefetch ¶
func (cache *RCache) TryDoPrefetch(fileBuf *FileBuffer, Size uint32, offset uint64)
type RWBlockOp ¶
type RWBlockOp struct { Index uint64 // fragment index RwOffset uint32 // fragment internal offset corresponding to the write operation RwSize uint32 // data size corresponding to the Write operation // contains filtered or unexported fields }
func (*RWBlockOp) GetAlignOffset ¶
func (*RWBlockOp) GetFileOffset ¶
type RWCache ¶
type RWCache struct { Mount *CfaMountInfo // contains filtered or unexported fields }
func NewRWCache ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(mount *CfaMountInfo, entry *FileEntry) *Reader
type Statfs ¶
type Statfs struct { BlockSize uint32 // block size of the current file system Blocks uint32 // block number of the current file system Files uint32 // file numbers of the current dir, non-recursive Folders uint32 // sub dir numbers under the current dir, non-recursive Fbytes uint64 // size of all files under the current dir, non-recursive Fubytes uint64 // space occupied by files in the current directory, non-recursive Rfiles uint64 // file numbers of the current dir, the whole subtree Rfolders uint64 // sub dir numbers under the current dir, the whole subtree Rbytes uint64 // size of all files under the current dir, the whole subtree Rubytes uint64 // space occupied by files in the current directory, the whole subtree }
目录的统计信息
type WCache ¶
type WCache struct { sync.RWMutex Mount *CfaMountInfo BufferMax int FreeList *list.List Cache map[uint64]*FileBuffer LruList *list.List ExpireTime int SyncRoutine int Stop bool // contains filtered or unexported fields }
func NewWCache ¶
func NewWCache(mount *CfaMountInfo, BufferMax int, ExpireTime int, SyncRoutine int) *WCache
func (*WCache) CheckExpire ¶
func (*WCache) DetachFileBuffer ¶
func (*WCache) DirectWrite ¶
func (*WCache) FlushBuffer ¶
func (cache *WCache) FlushBuffer(fileBuf *FileBuffer, Index uint64) error
func (*WCache) FreeBuffer ¶
func (*WCache) GetFileBuffer ¶
func (cache *WCache) GetFileBuffer(fe *FileEntry, bAlloc bool) *FileBuffer
bAlloc 是否申请file buf
func (*WCache) MergeOp ¶
func (cache *WCache) MergeOp(fileBuf *FileBuffer, op RWBlockOp, dataSize int) int
Source Files ¶
Click to show internal directories.
Click to hide internal directories.