change to use fuse file system
This commit is contained in:
@@ -87,6 +87,10 @@ func (wfs *WFS) Root() *Directory {
|
||||
return &wfs.root
|
||||
}
|
||||
|
||||
func (wfs *WFS) String() string {
|
||||
return "seaweedfs"
|
||||
}
|
||||
|
||||
func (option *Option) setupUniqueCacheDirectory() {
|
||||
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + string(option.FilerAddresses[0]) + option.FilerMountRootPath + util.Version()))[0:8]
|
||||
option.uniqueCacheDir = path.Join(option.CacheDir, cacheUniqueId)
|
||||
|
||||
@@ -5,26 +5,19 @@ import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/hanwen/go-fuse/v2/fs"
|
||||
"github.com/hanwen/go-fuse/v2/fuse"
|
||||
"math"
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
const blockSize = 512
|
||||
|
||||
var _ = fs.NodeStatfser(&Directory{})
|
||||
|
||||
type statsCache struct {
|
||||
filer_pb.StatisticsResponse
|
||||
lastChecked int64 // unix time in seconds
|
||||
}
|
||||
|
||||
func (dir *Directory) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
|
||||
|
||||
wfs := dir.wfs
|
||||
func (wfs *WFS) StatFs(cancel <-chan struct{}, in *fuse.InHeader, out *fuse.StatfsOut) (code fuse.Status) {
|
||||
|
||||
glog.V(4).Infof("reading fs stats")
|
||||
|
||||
@@ -56,7 +49,7 @@ func (dir *Directory) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.E
|
||||
})
|
||||
if err != nil {
|
||||
glog.V(0).Infof("filer Statistics: %v", err)
|
||||
return fs.ToErrno(os.ErrInvalid)
|
||||
return fuse.OK
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,5 +76,5 @@ func (dir *Directory) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.E
|
||||
out.NameLen = 1024
|
||||
out.Frsize = uint32(blockSize)
|
||||
|
||||
return fs.OK
|
||||
return fuse.OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user