2015-01-06 15:03:27 +08:00
|
|
|
package flat_namespace
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2015-04-17 03:18:06 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/go/filer"
|
2015-01-06 15:03:27 +08:00
|
|
|
)
|
|
|
|
|
2015-04-17 04:18:34 +08:00
|
|
|
type FlatNamespaceFiler struct {
|
2015-01-06 15:03:27 +08:00
|
|
|
master string
|
|
|
|
store FlatNamespaceStore
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2015-03-10 15:20:31 +08:00
|
|
|
ErrNotImplemented = errors.New("Not Implemented for flat namespace meta data store")
|
2015-01-06 15:03:27 +08:00
|
|
|
)
|
|
|
|
|
2015-04-17 04:18:34 +08:00
|
|
|
func NewFlatNamespaceFiler(master string, store FlatNamespaceStore) *FlatNamespaceFiler {
|
|
|
|
return &FlatNamespaceFiler{
|
2015-01-06 15:03:27 +08:00
|
|
|
master: master,
|
|
|
|
store: store,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) CreateFile(fullFileName string, fid string) (err error) {
|
2015-01-06 15:03:27 +08:00
|
|
|
return filer.store.Put(fullFileName, fid)
|
|
|
|
}
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) FindFile(fullFileName string) (fid string, err error) {
|
2015-01-06 15:03:27 +08:00
|
|
|
return filer.store.Get(fullFileName)
|
|
|
|
}
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) FindDirectory(dirPath string) (dirId filer.DirectoryId, err error) {
|
2015-03-10 15:20:31 +08:00
|
|
|
return 0, ErrNotImplemented
|
2015-01-06 15:03:27 +08:00
|
|
|
}
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error) {
|
2015-03-10 15:20:31 +08:00
|
|
|
return nil, ErrNotImplemented
|
2015-01-06 15:03:27 +08:00
|
|
|
}
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error) {
|
2015-03-10 15:20:31 +08:00
|
|
|
return nil, ErrNotImplemented
|
2015-01-06 15:03:27 +08:00
|
|
|
}
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) DeleteDirectory(dirPath string, recursive bool) (err error) {
|
2015-03-10 15:20:31 +08:00
|
|
|
return ErrNotImplemented
|
2015-01-06 15:03:27 +08:00
|
|
|
}
|
|
|
|
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) {
|
2015-01-06 15:03:27 +08:00
|
|
|
return filer.store.Delete(fullFileName)
|
|
|
|
}
|
|
|
|
|
2015-04-17 04:18:34 +08:00
|
|
|
func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error {
|
2015-03-10 15:20:31 +08:00
|
|
|
return ErrNotImplemented
|
2015-01-06 15:03:27 +08:00
|
|
|
}
|