filer.go 910 B

1234567891011121314151617181920212223242526272829
  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")