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

18
fuse.go
View file

@ -1,5 +1,21 @@
package kubelwagen
func serveFuse(dir string, closer chan bool) error {
import (
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/sirupsen/logrus"
)
func serveFuse(dir string, req chan RequestCallback, closer chan bool) error {
opts := WsFsOpts{
ReadOnly: true,
}
nfs := NewWsFs(opts, req, closer)
server, _, err := nodefs.MountRoot(dir, nfs.Root(), nil)
if err != nil {
logrus.Fatalln("cannot mount:", err)
}
defer server.Unmount()
go server.Serve()
<-closer
return nil
}