file.go 633 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package basefs
  2. import (
  3. "os"
  4. "time"
  5. )
  6. // This could be a struct
  7. // And service would be creating these
  8. /*type File interface {
  9. ID() string
  10. Name() string
  11. Attr() fuseops.InodeAttributes
  12. Parents() []string
  13. HasParent(file File) bool
  14. }*/
  15. type File struct {
  16. ID string
  17. Name string
  18. // Build Attr from this
  19. Size uint64
  20. CreatedTime time.Time
  21. ModifiedTime time.Time
  22. AccessedTime time.Time
  23. Mode os.FileMode
  24. Parents []string
  25. Data interface{} // Any thing
  26. }
  27. func (f *File) HasParent(parent *File) bool {
  28. for _, p := range f.Parents {
  29. if p == parent.ID {
  30. return true
  31. }
  32. }
  33. return false
  34. }