mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-25 11:39:12 +08:00
dc24bad791
compilable now. but FUSE mount is not working.
34 lines
729 B
Go
34 lines
729 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(master, dir); err != nil {
|
|
glog.Fatal("Can not start filer in dir", dir, ": ", err.Error())
|
|
return
|
|
}
|
|
|
|
r.HandleFunc("/__api__", fs.filerApiHandler)
|
|
r.HandleFunc("/", fs.filerHandler)
|
|
|
|
return fs, nil
|
|
}
|