mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
26 lines
577 B
Go
26 lines
577 B
Go
package scanner
|
|
|
|
import "fmt"
|
|
|
|
type File struct {
|
|
Name string
|
|
Flags uint32
|
|
Modified int64
|
|
Version uint32
|
|
Size int64
|
|
Blocks []Block
|
|
}
|
|
|
|
func (f File) String() string {
|
|
return fmt.Sprintf("File{Name:%q, Flags:0x%x, Modified:%d, Version:%d, Size:%d, NumBlocks:%d}",
|
|
f.Name, f.Flags, f.Modified, f.Version, f.Size, len(f.Blocks))
|
|
}
|
|
|
|
func (f File) Equals(o File) bool {
|
|
return f.Modified == o.Modified && f.Version == o.Version
|
|
}
|
|
|
|
func (f File) NewerThan(o File) bool {
|
|
return f.Modified > o.Modified || (f.Modified == o.Modified && f.Version > o.Version)
|
|
}
|