kubelwagen/filesystem.go

35 lines
681 B
Go

package kubelwagen
import "github.com/hanwen/go-fuse/fuse/pathfs"
type WsFs struct {
pathfs.FileSystem
req chan RequestCallback
}
type WsFsOpts struct {
ReadOnly bool
}
func NewWsFs(opts WsFsOpts, req chan RequestCallback, closer chan bool) *pathfs.PathNodeFs {
var fs pathfs.FileSystem
wfs := &WsFs{
FileSystem: pathfs.NewDefaultFileSystem(),
req: req,
}
// TODO(barakmich): spin up a goroutine to handle notify requests
fs = wfs
if opts.ReadOnly {
fs = pathfs.NewReadonlyFileSystem(fs)
}
return pathfs.NewPathNodeFs(fs, nil)
}
func getChannel() chan Response {
return make(chan Response)
}
func (fs *WsFs) String() string {
return "kubelwagen"
}