first servicable server

This commit is contained in:
Barak Michener 2018-03-29 14:29:05 -07:00
parent 90aa93a1d7
commit 869999fc3e
8 changed files with 309 additions and 12 deletions

35
filesystem.go Normal file
View file

@ -0,0 +1,35 @@
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"
}