file.go 811 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2014 Jakob Borg and other contributors. All rights reserved.
  2. // Use of this source code is governed by an MIT-style license that can be
  3. // found in the LICENSE file.
  4. package scanner
  5. import "fmt"
  6. type File struct {
  7. Name string
  8. Flags uint32
  9. Modified int64
  10. Version uint64
  11. Size int64
  12. Blocks []Block
  13. Suppressed bool
  14. }
  15. func (f File) String() string {
  16. return fmt.Sprintf("File{Name:%q, Flags:0%o, Modified:%d, Version:%d, Size:%d, NumBlocks:%d, Sup:%v}",
  17. f.Name, f.Flags, f.Modified, f.Version, f.Size, len(f.Blocks), f.Suppressed)
  18. }
  19. func (f File) Equals(o File) bool {
  20. return f.Modified == o.Modified && f.Version == o.Version
  21. }
  22. func (f File) NewerThan(o File) bool {
  23. return f.Modified > o.Modified || (f.Modified == o.Modified && f.Version > o.Version)
  24. }