adding filer!!!

This commit is contained in:
Chris Lu
2014-03-30 20:57:25 -07:00
parent d6aa6239de
commit 67be8a5af8
4 changed files with 138 additions and 35 deletions

View File

@@ -1,11 +1,11 @@
package weed_server
import (
"code.google.com/p/weed-fs/go/glog"
"errors"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/util"
"net/http"
"strconv"
"strings"
)
@@ -25,11 +25,11 @@ type FilerServer struct {
db *leveldb.DB
}
func NewFilerServer(r *http.ServeMux, master string, dir string) (fs *FilerServer, err error) {
func NewFilerServer(r *http.ServeMux, port int, master string, dir string, collection string) (fs *FilerServer, err error) {
fs = &FilerServer{
master: master,
collection: "",
port: ":8888",
collection: collection,
port: ":" + strconv.Itoa(port),
}
if fs.db, err = leveldb.OpenFile(dir, nil); err != nil {
@@ -38,8 +38,6 @@ func NewFilerServer(r *http.ServeMux, master string, dir string) (fs *FilerServe
r.HandleFunc("/", fs.filerHandler)
glog.V(0).Infoln("file server started on port ", fs.port)
return fs, nil
}