1
0
Fork 0
forked from mirrors/tar-split

verify: starts of a checking function

This commit is contained in:
Vincent Batts 2015-10-29 15:30:47 -04:00
parent 5c8d5cacba
commit 867071d1e5
4 changed files with 158 additions and 45 deletions

View file

@ -1,6 +1,10 @@
package verify
import "fmt"
import (
"fmt"
"os"
"time"
)
// CheckType is how the on disk attributes will be verified against the
// recorded header information
@ -15,14 +19,15 @@ const (
CheckFileUser
CheckFileGroup
CheckFileMtime
CheckFileDevice
CheckFileLink
CheckFileCaps
CheckFileDevice // major/minor
CheckFileLink // linkname
CheckFileCaps // which is just a subset of xattrs on linux
)
var (
// DefaultChecks is the default for verfication steps against each
// storage.VerficationEntry
// storage.VerficationEntry.
// These may need to vary from platform to platform
DefaultChecks = CheckDigest | CheckFileAttributes
// CheckFileAttributes are the group of file attribute checks done
CheckFileAttributes = CheckFileSize | CheckFileMode | CheckFileUser |
@ -32,3 +37,26 @@ var (
// ErrNotSupportedPlatform is when the platform does not support given features
ErrNotSupportedPlatform = fmt.Errorf("platform does not support this feature")
)
// FileAttrer exposes the functions corresponding to file attribute checks
type FileAttrer interface {
Sizer
Moder
ModTimer
LinkName() string
}
// Sizer returns the size of the file (see also os.FileInfo)
type Sizer interface {
Size() int64
}
// Moder returns the mode of the file (see also os.FileInfo)
type Moder interface {
Mode() os.FileMode
}
// ModTimer returns the mtime of the file (see also os.FileInfo)
type ModTimer interface {
ModTime() time.Time
}