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.

34 lines
967 B

  1. package filer
  2. import (
  3. "errors"
  4. )
  5. type FileId string //file id in SeaweedFS
  6. type FileEntry struct {
  7. Name string `json:"name,omitempty"` //file name without path
  8. Id FileId `json:"fid,omitempty"`
  9. }
  10. type DirectoryId int32
  11. type DirectoryEntry struct {
  12. Name string //dir name without path
  13. Id DirectoryId
  14. }
  15. type Filer interface {
  16. CreateFile(fullFileName string, fid string) (err error)
  17. FindFile(fullFileName string) (fid string, err error)
  18. DeleteFile(fullFileName string) (fid string, err error)
  19. //Optional functions. embedded filer support these
  20. FindDirectory(dirPath string) (dirId DirectoryId, err error)
  21. ListDirectories(dirPath string) (dirs []DirectoryEntry, err error)
  22. ListFiles(dirPath string, lastFileName string, limit int) (files []FileEntry, err error)
  23. DeleteDirectory(dirPath string, recursive bool) (err error)
  24. Move(fromPath string, toPath string) (err error)
  25. }
  26. var ErrNotFound = errors.New("filer: no entry is found in filer store")