package main import ( "log" "os" _ "strings" "git.lysator.liu.se/hugo/foremanFS/dir" "git.lysator.liu.se/hugo/foremanFS/fetch" "bazil.org/fuse" "bazil.org/fuse/fs" _ "bazil.org/fuse/fs/fstestutil" ) var classesForHost = map[string][]string{} // const apiurl := "http://localhost:8000/hosts.json" func main() { password := os.Args[1:][0] fetch.Init(password) c, err := fuse.Mount( "mnt", fuse.FSName("Foreman"), fuse.Subtype("foreman"), ) if err != nil { log.Fatal(err) } // defer c.Unmount() defer c.Close() log.Print("Serving filesystem") err = fs.Serve(c, FS{}) if err != nil { log.Fatal(err) } } type FS struct { // data []ResultRecord } func (fs FS) Root() (fs.Node, error) { // return Dir{ /*fs.data*/ }, nil return dir.DirHostList{ /*fs.data*/ }, nil } /* func (FS) GenerateInode(parentInode uint64, name string) uint64 { sum := uint64(0) sum += parentInode for _, c := range []byte(name) { sum += uint64(c) } log.Printf("Generating inode for %v (inode = %v, parent = %v)", name, sum, parentInode) return sum } */ /* dir hashable? */ /* TODO does two Dir object with same value hash become the same * object? */ /* type Dir struct{ // data []ResultRecord // name []string name string } */