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.

50 lines
1.5 KiB

  1. package flat_namespace
  2. import (
  3. "errors"
  4. "github.com/chrislusf/weed-fs/go/filer"
  5. )
  6. type FlatNamesapceFiler 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 NewFlatNamesapceFiler(master string, store FlatNamespaceStore) *FlatNamesapceFiler {
  14. return &FlatNamesapceFiler{
  15. master: master,
  16. store: store,
  17. }
  18. }
  19. func (filer *FlatNamesapceFiler) CreateFile(fullFileName string, fid string) (err error) {
  20. return filer.store.Put(fullFileName, fid)
  21. }
  22. func (filer *FlatNamesapceFiler) FindFile(fullFileName string) (fid string, err error) {
  23. return filer.store.Get(fullFileName)
  24. }
  25. func (filer *FlatNamesapceFiler) FindDirectory(dirPath string) (dirId filer.DirectoryId, err error) {
  26. return 0, ErrNotImplemented
  27. }
  28. func (filer *FlatNamesapceFiler) ListDirectories(dirPath string) (dirs []filer.DirectoryEntry, err error) {
  29. return nil, ErrNotImplemented
  30. }
  31. func (filer *FlatNamesapceFiler) ListFiles(dirPath string, lastFileName string, limit int) (files []filer.FileEntry, err error) {
  32. return nil, ErrNotImplemented
  33. }
  34. func (filer *FlatNamesapceFiler) DeleteDirectory(dirPath string, recursive bool) (err error) {
  35. return ErrNotImplemented
  36. }
  37. func (filer *FlatNamesapceFiler) DeleteFile(fullFileName string) (fid string, err error) {
  38. return filer.store.Delete(fullFileName)
  39. }
  40. func (filer *FlatNamesapceFiler) Move(fromPath string, toPath string) error {
  41. return ErrNotImplemented
  42. }