Documentation ¶
Index ¶
- Variables
- func NewMetaCache(entryCacheSize, attrCacheSize int, entryExpire int, attrExpire int) *metaCache
- func SetDataCache(config cache.Config)
- func SetLinkMetaDirPrefix(dirPrefix string)
- func SetMetaCache(config meta.Config)
- func SetPFSServer(server string)
- type DirEntry
- type FSClient
- type File
- func (f *File) Chmod(mode os.FileMode) error
- func (f *File) Chown(uid, gid int) error
- func (f *File) Close() error
- func (f *File) Fd() uintptr
- func (f *File) Name() string
- func (f *File) Read(b []byte) (int, error)
- func (f *File) ReadAt(b []byte, off int64) (int, error)
- func (f *File) ReadDir(n int) ([]os.DirEntry, error)
- func (f *File) Readdir(n int) ([]os.FileInfo, error)
- func (f *File) Readdirnames(n int) ([]string, error)
- func (f *File) Seek(offset int64, whence int) (ret int64, err error)
- func (f *File) SetDeadline(t time.Time) error
- func (f *File) SetReadDeadline(t time.Time) error
- func (f *File) SetWriteDeadline(t time.Time) error
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sync() error
- func (f *File) SyscallConn() (syscall.RawConn, error)
- func (f *File) Truncate(size int64) error
- func (f *File) Write(b []byte) (int, error)
- func (f *File) WriteAt(b []byte, off int64) (int, error)
- func (f *File) WriteString(s string) (n int, err error)
- type FileInfo
- type FileSystem
- func (fs *FileSystem) Chmod(name string, mode os.FileMode) error
- func (fs *FileSystem) Chown(name string, uid, gid int) error
- func (fs *FileSystem) Create(name string, flags uint32, mode uint32) (*File, error)
- func (fs *FileSystem) Mkdir(name string, mode os.FileMode) error
- func (fs *FileSystem) Open(path_ string) (*File, error)
- func (fs *FileSystem) Rename(oldPath string, newPath string) error
- func (fs *FileSystem) Rmdir(name string) error
- func (fs *FileSystem) Stat(path_ string) (os.FileInfo, error)
- func (fs *FileSystem) Unlink(name string) error
- type MockClient
- func (c *MockClient) Chmod(path string, fm os.FileMode) error
- func (c *MockClient) Chown(name string, uid, gid int) error
- func (c *MockClient) Copy(srcPath, dstPath string) error
- func (c *MockClient) Create(path string) (io.WriteCloser, error)
- func (c *MockClient) CreateFile(path string, content []byte) (int, error)
- func (c *MockClient) Exist(path string) (bool, error)
- func (c *MockClient) IsDir(path string) (bool, error)
- func (c *MockClient) IsEmptyDir(path string) (bool, error)
- func (c *MockClient) ListDir(path string) ([]os.FileInfo, error)
- func (c *MockClient) Mkdir(path string, perm os.FileMode) error
- func (c *MockClient) MkdirAll(path string, perm os.FileMode) error
- func (c *MockClient) Open(path string) (io.ReadCloser, error)
- func (c *MockClient) Readdirnames(path string, n int) ([]string, error)
- func (c *MockClient) Remove(path string) error
- func (c *MockClient) RemoveAll(path string) error
- func (c *MockClient) Rename(srcPath, dstPath string) error
- func (c *MockClient) SaveFile(file io.Reader, destPath, fileName string) error
- func (c *MockClient) Size(path string) (int64, error)
- func (c *MockClient) Stat(path string) (os.FileInfo, error)
- func (c *MockClient) Walk(root string, walkFn filepath.WalkFunc) error
- type PFSClient
- func (c *PFSClient) Chmod(path string, fm os.FileMode) error
- func (c *PFSClient) Chown(name string, uid, gid int) error
- func (c *PFSClient) Copy(srcPath, dstPath string) error
- func (c *PFSClient) Create(path string) (io.WriteCloser, error)
- func (c *PFSClient) CreateFile(path string, content []byte) (int, error)
- func (c *PFSClient) Exist(path string) (bool, error)
- func (c *PFSClient) IsDir(path string) (bool, error)
- func (c *PFSClient) IsEmptyDir(path string) (bool, error)
- func (c *PFSClient) ListDir(path string) ([]os.FileInfo, error)
- func (c *PFSClient) Mkdir(path string, perm os.FileMode) error
- func (c *PFSClient) MkdirAll(path string, perm os.FileMode) error
- func (c *PFSClient) Open(path string) (io.ReadCloser, error)
- func (c *PFSClient) Readdirnames(path string, n int) ([]string, error)
- func (c *PFSClient) Remove(path string) error
- func (c *PFSClient) RemoveAll(path string) error
- func (c *PFSClient) Rename(srcPath, dstPath string) error
- func (c *PFSClient) SaveFile(file io.Reader, destPath, fileName string) error
- func (c *PFSClient) Size(path string) (int64, error)
- func (c *PFSClient) Stat(path string) (os.FileInfo, error)
- func (c *PFSClient) Walk(root string, walkFn filepath.WalkFunc) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 0 means not use data cache BlockSize = 0 MaxReadAheadNum = 0 DataCacheExpire = 0 * time.Second DataCachePath = "/var/cache/pfs_data_cache" Driver = meta.MemDriver MetaCacheExpire = 0 * time.Second EntryCacheExpire = 0 * time.Second PathCacheExpire = 0 * time.Second MetaCachePath = "/var/cache/pfs_meta_cache" )
fs server not use cache
Functions ¶
func NewMetaCache ¶
func SetDataCache ¶
func SetLinkMetaDirPrefix ¶
func SetLinkMetaDirPrefix(dirPrefix string)
func SetMetaCache ¶
Types ¶
type FSClient ¶
type FSClient interface { Create(path string) (io.WriteCloser, error) Open(path string) (io.ReadCloser, error) CreateFile(path string, content []byte) (int, error) SaveFile(file io.Reader, destPath, fileName string) error Remove(path string) error RemoveAll(path string) error IsDir(path string) (bool, error) Exist(path string) (bool, error) IsEmptyDir(path string) (bool, error) Mkdir(path string, perm os.FileMode) error MkdirAll(path string, perm os.FileMode) error ListDir(path string) ([]os.FileInfo, error) Readdirnames(path string, n int) ([]string, error) Rename(srcPath, dstPath string) error Copy(srcPath, dstPath string) error Size(path string) (int64, error) Chmod(path string, fm os.FileMode) error Chown(name string, uid, gid int) error Walk(root string, walkFn filepath.WalkFunc) error Stat(path string) (os.FileInfo, error) }
func NewFSClient ¶
func NewFSClientWithFsID ¶
func NewFSClientWithServer ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
参考os.file对外的接口实现, 部分未实现
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
func NewFileSystem ¶
func NewFileSystem(fsMeta common.FSMeta, links map[string]common.FSMeta, skipSub bool, hasCache bool, linkMetaDirPrefix string, config *vfs.Config) (*FileSystem, error)
entryExpire 记录path对应的ino信息,一般不会修改,因此可以不设置过期时间(entryExpire = 0)。 attrExpire 记录ino对应节点的attr属性,包括mode、uid、gid和mtime等信息,文件修改时会改变。
func (*FileSystem) Rmdir ¶
func (fs *FileSystem) Rmdir(name string) error
func (*FileSystem) Unlink ¶
func (fs *FileSystem) Unlink(name string) error
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
func (*MockClient) Chown ¶ added in v0.14.5
func (c *MockClient) Chown(name string, uid, gid int) error
func (*MockClient) Copy ¶
func (c *MockClient) Copy(srcPath, dstPath string) error
func (*MockClient) Create ¶
func (c *MockClient) Create(path string) (io.WriteCloser, error)
func (*MockClient) CreateFile ¶
func (c *MockClient) CreateFile(path string, content []byte) (int, error)
func (*MockClient) IsEmptyDir ¶
func (c *MockClient) IsEmptyDir(path string) (bool, error)
func (*MockClient) Open ¶
func (c *MockClient) Open(path string) (io.ReadCloser, error)
func (*MockClient) Readdirnames ¶
func (c *MockClient) Readdirnames(path string, n int) ([]string, error)
func (*MockClient) Remove ¶
func (c *MockClient) Remove(path string) error
func (*MockClient) RemoveAll ¶
func (c *MockClient) RemoveAll(path string) error
func (*MockClient) Rename ¶
func (c *MockClient) Rename(srcPath, dstPath string) error
type PFSClient ¶
type PFSClient struct {
// contains filtered or unexported fields
}
func NewPFSClient ¶
func (*PFSClient) CreateFile ¶
func (*PFSClient) Readdirnames ¶
Click to show internal directories.
Click to hide internal directories.