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