mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Fixes #266
This commit is contained in:
parent
470d950918
commit
813a4f7456
|
@ -26,7 +26,7 @@ var cmdMount = &Command{
|
||||||
2) have a "weed filer" running
|
2) have a "weed filer" running
|
||||||
These 2 requirements can be achieved with one command "weed server -filer=true"
|
These 2 requirements can be achieved with one command "weed server -filer=true"
|
||||||
|
|
||||||
This uses bazil.org/fuse, whichenables writing FUSE file systems on
|
This uses bazil.org/fuse, which enables writing FUSE file systems on
|
||||||
Linux, and OS X.
|
Linux, and OS X.
|
||||||
|
|
||||||
On OS X, it requires OSXFUSE (http://osxfuse.github.com/).
|
On OS X, it requires OSXFUSE (http://osxfuse.github.com/).
|
||||||
|
|
|
@ -4,6 +4,7 @@ package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
|
@ -47,16 +48,10 @@ func runMount(cmd *Command, args []string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
type File struct {
|
type WFS struct{}
|
||||||
FileId filer.FileId
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (File) Attr(context context.Context, attr *fuse.Attr) error {
|
func (WFS) Root() (fs.Node, error) {
|
||||||
return nil
|
return Dir{}, nil
|
||||||
}
|
|
||||||
func (File) ReadAll(ctx context.Context) ([]byte, error) {
|
|
||||||
return []byte("hello, world\n"), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Dir struct {
|
type Dir struct {
|
||||||
|
@ -65,6 +60,8 @@ type Dir struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dir Dir) Attr(context context.Context, attr *fuse.Attr) error {
|
func (dir Dir) Attr(context context.Context, attr *fuse.Attr) error {
|
||||||
|
attr.Inode = 1
|
||||||
|
attr.Mode = os.ModeDir | 0555
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,13 +76,7 @@ func (dir Dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||||
return nil, fmt.Errorf("File Not Found for %s", name)
|
return nil, fmt.Errorf("File Not Found for %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
type WFS struct{}
|
func (dir Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||||
|
|
||||||
func (WFS) Root() (fs.Node, error) {
|
|
||||||
return Dir{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dir *Dir) ReadDir(ctx context.Context) ([]fuse.Dirent, error) {
|
|
||||||
var ret []fuse.Dirent
|
var ret []fuse.Dirent
|
||||||
if dirs, e := filer.ListDirectories(*mountOptions.filer, dir.Path); e == nil {
|
if dirs, e := filer.ListDirectories(*mountOptions.filer, dir.Path); e == nil {
|
||||||
for _, d := range dirs.Directories {
|
for _, d := range dirs.Directories {
|
||||||
|
@ -104,3 +95,17 @@ func (dir *Dir) ReadDir(ctx context.Context) ([]fuse.Dirent, error) {
|
||||||
}
|
}
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
FileId filer.FileId
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (File) Attr(context context.Context, attr *fuse.Attr) error {
|
||||||
|
attr.Inode = 2
|
||||||
|
attr.Mode = 0444
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (File) ReadAll(ctx context.Context) ([]byte, error) {
|
||||||
|
return []byte("hello, world\n"), nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue