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.

29 lines
910 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 DirectoryName string
  11. type Filer interface {
  12. CreateFile(fullFileName string, fid string) (err error)
  13. FindFile(fullFileName string) (fid string, err error)
  14. DeleteFile(fullFileName string) (fid string, err error)
  15. //Optional functions. embedded filer support these
  16. ListDirectories(dirPath string) (dirs []DirectoryName, err error)
  17. ListFiles(dirPath string, lastFileName string, limit int) (files []FileEntry, err error)
  18. DeleteDirectory(dirPath string, recursive bool) (err error)
  19. Move(fromPath string, toPath string) (err error)
  20. LookupDirectoryEntry(dirPath string, name string) (found bool, fileId string, err error)
  21. }
  22. var ErrNotFound = errors.New("filer: no entry is found in filer store")