aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-05-28 13:24:48 -0700
committerChris Lu <chris.lu@gmail.com>2018-05-28 13:24:48 -0700
commit8ab7dd9d08dbf326046bfcf0c1fac5d171600a7d (patch)
tree31740591e8c648bbee74f652cc44c5f637e4413a
parentd0b238d2db81093b7f02141d4f70b446fcd0b2cd (diff)
downloadseaweedfs-8ab7dd9d08dbf326046bfcf0c1fac5d171600a7d.tar.xz
seaweedfs-8ab7dd9d08dbf326046bfcf0c1fac5d171600a7d.zip
weed mount add options for collection and replication
-rw-r--r--weed/command/mount.go8
-rw-r--r--weed/command/mount_std.go3
-rw-r--r--weed/filesys/dir.go11
-rw-r--r--weed/filesys/dirty_page.go4
-rw-r--r--weed/filesys/wfs.go8
5 files changed, 22 insertions, 12 deletions
diff --git a/weed/command/mount.go b/weed/command/mount.go
index 746e4b92e..151c6bedf 100644
--- a/weed/command/mount.go
+++ b/weed/command/mount.go
@@ -1,8 +1,10 @@
package command
type MountOptions struct {
- filer *string
- dir *string
+ filer *string
+ dir *string
+ collection *string
+ replication *string
}
var (
@@ -14,6 +16,8 @@ func init() {
cmdMount.IsDebug = cmdMount.Flag.Bool("debug", false, "verbose debug information")
mountOptions.filer = cmdMount.Flag.String("filer", "localhost:8888", "weed filer location")
mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory")
+ mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files")
+ mountOptions.replication = cmdMount.Flag.String("replication", "000", "replication to create to files")
}
var cmdMount = &Command{
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index b3f038cc2..fcf663e1c 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -47,7 +47,8 @@ func runMount(cmd *Command, args []string) bool {
c.Close()
})
- err = fs.Serve(c, filesys.NewSeaweedFileSystem(*mountOptions.filer))
+ err = fs.Serve(c, filesys.NewSeaweedFileSystem(
+ *mountOptions.filer, *mountOptions.collection, *mountOptions.replication))
if err != nil {
fuse.Unmount(*mountOptions.dir)
}
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index e53c4cfaf..b90e428ab 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -123,11 +123,12 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
dir.NodeMap[req.Name] = file
file.isOpen = true
return file, &FileHandle{
- f: file,
- RequestId: req.Header.ID,
- NodeId: req.Header.Node,
- Uid: req.Uid,
- Gid: req.Gid,
+ f: file,
+ dirtyPages: &ContinuousDirtyPages{f: file},
+ RequestId: req.Header.ID,
+ NodeId: req.Header.Node,
+ Uid: req.Uid,
+ Gid: req.Gid,
}, nil
}
diff --git a/weed/filesys/dirty_page.go b/weed/filesys/dirty_page.go
index bfb73f3b0..da442d6c6 100644
--- a/weed/filesys/dirty_page.go
+++ b/weed/filesys/dirty_page.go
@@ -108,8 +108,8 @@ func (pages *ContinuousDirtyPages) saveToStorage(ctx context.Context) (*filer_pb
request := &filer_pb.AssignVolumeRequest{
Count: 1,
- Replication: "000",
- Collection: "",
+ Replication: pages.f.wfs.replication,
+ Collection: pages.f.wfs.collection,
}
resp, err := client.AssignVolume(ctx, request)
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 1b843e2d7..b9cb0210b 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -11,12 +11,16 @@ import (
type WFS struct {
filer string
listDirectoryEntriesCache *ccache.Cache
+ collection string
+ replication string
}
-func NewSeaweedFileSystem(filer string) *WFS {
+func NewSeaweedFileSystem(filer string, collection string, replication string) *WFS {
return &WFS{
- filer: filer,
+ filer: filer,
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(6000).ItemsToPrune(100)),
+ collection: collection,
+ replication: replication,
}
}