2015-01-06 07:03:27 +00:00
|
|
|
package flat_namespace
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2015-04-16 19:18:06 +00:00
|
|
|
"github.com/chrislusf/seaweedfs/go/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) {
|
2015-01-06 07:03:27 +00:00
|
|
|
return filer.store.Delete(fullFileName)
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|