aboutsummaryrefslogtreecommitdiff
path: root/weed/server/filer_server.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/server/filer_server.go')
-rw-r--r--weed/server/filer_server.go39
1 files changed, 18 insertions, 21 deletions
diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go
index f5784e82d..0e5135763 100644
--- a/weed/server/filer_server.go
+++ b/weed/server/filer_server.go
@@ -13,36 +13,33 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
)
+type FilerOption struct {
+ Masters []string
+ Collection string
+ DefaultReplication string
+ RedirectOnRead bool
+ DisableDirListing bool
+ MaxMB int
+ SecretKey string
+ DirListingLimit int
+}
+
type FilerServer struct {
- masters []string
- collection string
- defaultReplication string
- redirectOnRead bool
- disableDirListing bool
- secret security.Secret
- filer *filer2.Filer
- maxMB int
+ option *FilerOption
+ secret security.Secret
+ filer *filer2.Filer
}
-func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, masters []string, collection string,
- replication string, redirectOnRead bool, disableDirListing bool,
- maxMB int,
- secret string,
-) (fs *FilerServer, err error) {
+func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) (fs *FilerServer, err error) {
fs = &FilerServer{
- masters: masters,
- collection: collection,
- defaultReplication: replication,
- redirectOnRead: redirectOnRead,
- disableDirListing: disableDirListing,
- maxMB: maxMB,
+ option: option,
}
- if len(masters) == 0 {
+ if len(option.Masters) == 0 {
glog.Fatal("master list is required!")
}
- fs.filer = filer2.NewFiler(masters)
+ fs.filer = filer2.NewFiler(option.Masters)
go fs.filer.KeepConnectedToMaster()