seaweedfs/go/weed/weed_server/filer_server.go
Chris Lu 5f4dc11409 1. root dir has id of 0
2. only delete empty folders
3. correct listing files under a folder
2014-04-09 21:01:48 -07:00

33 lines
675 B
Go

package weed_server
import (
"code.google.com/p/weed-fs/go/filer"
"code.google.com/p/weed-fs/go/glog"
"net/http"
"strconv"
)
type FilerServer struct {
port string
master string
collection string
filer filer.Filer
}
func NewFilerServer(r *http.ServeMux, port int, master string, dir string, collection string) (fs *FilerServer, err error) {
fs = &FilerServer{
master: master,
collection: collection,
port: ":" + strconv.Itoa(port),
}
if fs.filer, err = filer.NewFilerEmbedded(dir); err != nil {
glog.Fatal("Can not start filer in dir", dir, ": ", err.Error())
return
}
r.HandleFunc("/", fs.filerHandler)
return fs, nil
}