treeI.go.tmp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package smb
  2. import (
  3. "time"
  4. )
  5. type FileId uint64
  6. type StatI interface {
  7. Name() string
  8. Size() int64
  9. ModTime() time.Time
  10. IsReadOnly() bool
  11. IsExecutable() bool // for Dir false
  12. IsDir() bool
  13. IsLink() bool
  14. Link() string
  15. }
  16. type TreeI interface {
  17. Name() string
  18. Id() uint32
  19. Close() error
  20. OpenFile(path string, flags int) (FileId, error)
  21. CloseFile(FileId) error
  22. NameOfFile(FileId) string // full path
  23. //StatByPath(path string, followLinks bool) (Stat, error)
  24. StatById(id FileId, followLinks bool) (StatI, error)
  25. // For file only
  26. Read(id FileId, p []byte) (n int, err error)
  27. Write(id FileId, p []byte) (n int, err error)
  28. Seek(id FileId, offset int64) error
  29. CurrentPosition(id FileId) int64
  30. // For directory only
  31. ReadDir(id FileId, n int) ([]Stat, error)
  32. Mkdir(path string) error
  33. Symlink(oldname, newname string) error
  34. Remove(path string, recursive bool) error
  35. Truncate(id FileId, size int64) error
  36. ChangeMode(id FileId, allowWrite bool, allowExecute bool) error // allowExecute only for files
  37. Sync(FileId) error
  38. SyncAll() error
  39. }