add fs.FSStatfser for SeaweedFS weed mount

This commit is contained in:
Chris Lu
2018-11-23 00:24:51 -08:00
parent 2e32b44061
commit 444dfded84
10 changed files with 584 additions and 139 deletions

View File

@@ -2,6 +2,8 @@ package topology
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/storage"
)
type VolumeLocationList struct {
@@ -63,3 +65,15 @@ func (dnll *VolumeLocationList) Refresh(freshThreshHold int64) {
dnll.list = l
}
}
func (dnll *VolumeLocationList) Stats(vid storage.VolumeId, freshThreshHold int64) (size uint64, fileCount int) {
for _, dnl := range dnll.list {
if dnl.LastSeen < freshThreshHold {
vinfo, err := dnl.GetVolumesById(vid)
if err == nil {
return vinfo.Size - vinfo.DeletedByteCount, vinfo.FileCount - vinfo.DeleteCount
}
}
}
return 0, 0
}