Browse Source

modify flat_namespace to support list directories

pull/254/head
zhaozhi 10 years ago
parent
commit
eb77a96052
  1. 10
      go/filer/flat_namespace/flat_namespace_filer.go
  2. 9
      go/filer/flat_namespace/flat_namespace_store.go

10
go/filer/flat_namespace/flat_namespace_filer.go

@ -29,16 +29,16 @@ func (filer *FlatNamespaceFiler) FindFile(fullFileName string) (fid string, err
return filer.store.Get(fullFileName) return filer.store.Get(fullFileName)
} }
func (filer *FlatNamespaceFiler) FindDirectory(dirPath string) (dirId filer.DirectoryId, err error) { func (filer *FlatNamespaceFiler) FindDirectory(dirPath string) (dirId filer.DirectoryId, err error) {
return 0, ErrNotImplemented
return filer.store.FindDirectory(dirPath)
} }
func (filer *FlatNamespaceFiler) ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error) { func (filer *FlatNamespaceFiler) ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error) {
return nil, ErrNotImplemented
return filer.store.ListDirectories(dirPath)
} }
func (filer *FlatNamespaceFiler) ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error) { func (filer *FlatNamespaceFiler) ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error) {
return nil, ErrNotImplemented
return filer.store.ListFiles(dirPath, lastFileName, limit)
} }
func (filer *FlatNamespaceFiler) DeleteDirectory(dirPath string, recursive bool) (err error) { func (filer *FlatNamespaceFiler) DeleteDirectory(dirPath string, recursive bool) (err error) {
return ErrNotImplemented
return filer.store.DeleteDirectory(dirPath, recursive)
} }
func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) { func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) {
@ -46,5 +46,5 @@ func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, er
} }
func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error { func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error {
return ErrNotImplemented
return filer.store.Move(fromPath, toPath)
} }

9
go/filer/flat_namespace/flat_namespace_store.go

@ -1,9 +1,16 @@
package flat_namespace package flat_namespace
import ()
import "github.com/chrislusf/seaweedfs/go/filer"
type FlatNamespaceStore interface { type FlatNamespaceStore interface {
Put(fullFileName string, fid string) (err error) Put(fullFileName string, fid string) (err error)
Get(fullFileName string) (fid string, err error) Get(fullFileName string) (fid string, err error)
Delete(fullFileName string) (fid string, err error) Delete(fullFileName string) (fid string, err error)
//redis store support these functions
FindDirectory(dirPath string) (dirId filer.DirectoryId, err error)
ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error)
ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error)
DeleteDirectory(dirPath string, recursive bool) (err error)
Move(fromPath string, toPath string) error
} }
Loading…
Cancel
Save