New ChecksumStorage and new PackagePool interfaces

This commit is contained in:
Andrey Smirnov
2017-04-19 02:49:00 +03:00
parent 6994e35119
commit 5566111a7b
5 changed files with 238 additions and 14 deletions
+5
View File
@@ -37,6 +37,11 @@ type ChecksumInfo struct {
SHA512 string
}
// Complete checks if all the checksums are present
func (cksum *ChecksumInfo) Complete() bool {
return cksum.MD5 != "" && cksum.SHA1 != "" && cksum.SHA256 != "" && cksum.SHA512 != ""
}
// ChecksumsForFile generates size, MD5, SHA1 & SHA256 checksums for given file
func ChecksumsForFile(path string) (ChecksumInfo, error) {
file, err := os.Open(path)