You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. package flat_namespace
  2. import (
  3. "errors"
  4. "github.com/chrislusf/seaweedfs/weed/filer"
  5. )
  6. type FlatNamespaceFiler struct {
  7. master string
  8. store FlatNamespaceStore
  9. }
  10. var (
  11. ErrNotImplemented = errors.New("Not Implemented for flat namespace meta data store")
  12. )
  13. func NewFlatNamespaceFiler(master string, store FlatNamespaceStore) *FlatNamespaceFiler {
  14. return &FlatNamespaceFiler{
  15. master: master,
  16. store: store,
  17. }
  18. }
  19. func (filer *FlatNamespaceFiler) CreateFile(fullFileName string, fid string) (err error) {
  20. return filer.store.Put(fullFileName, fid)
  21. }
  22. func (filer *FlatNamespaceFiler) FindFile(fullFileName string) (fid string, err error) {
  23. return filer.store.Get(fullFileName)
  24. }
  25. func (filer *FlatNamespaceFiler) FindDirectory(dirPath string) (dirId filer.DirectoryId, err error) {
  26. return 0, ErrNotImplemented
  27. }
  28. func (filer *FlatNamespaceFiler) ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error) {
  29. return nil, ErrNotImplemented
  30. }
  31. func (filer *FlatNamespaceFiler) ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error) {
  32. return nil, ErrNotImplemented
  33. }
  34. func (filer *FlatNamespaceFiler) DeleteDirectory(dirPath string, recursive bool) (err error) {
  35. return ErrNotImplemented
  36. }
  37. func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) {
  38. fid, err = filer.FindFile(fullFileName)
  39. if err != nil {
  40. return "", err
  41. }
  42. err = filer.store.Delete(fullFileName)
  43. if err != nil {
  44. return "", err
  45. }
  46. return fid, nil
  47. //return filer.store.Delete(fullFileName)
  48. //are you kidding me!!!!
  49. }
  50. func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error {
  51. return ErrNotImplemented
  52. }