JCS-pub/client/internal/mount/vfs/vfs.go

45 lines
971 B
Go

package vfs
import (
"gitlink.org.cn/cloudream/jcs-pub/client/internal/db"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/downloader"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/mount/config"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/mount/fuse"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/mount/vfs/cache"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/uploader"
)
type Vfs struct {
db *db.DB
config *config.Config
cache *cache.Cache
}
func NewVfs(cfg *config.Config, db *db.DB, uploader *uploader.Uploader, downloader *downloader.Downloader) *Vfs {
return &Vfs{
db: db,
config: cfg,
cache: cache.NewCache(cfg, db, uploader, downloader),
}
}
func (v *Vfs) Start() {
v.cache.Start()
}
func (v *Vfs) Stop() {
v.cache.Stop()
}
func (v *Vfs) Root() fuse.FsDir {
return newRoot(v)
}
func (v *Vfs) Stats() fuse.FsStats {
return fuse.FsStats{}
}
func (v *Vfs) Dump() cache.CacheStatus {
return v.cache.Dump()
}