Upgrade AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2017-09-28 17:57:05 +03:00
parent 9a767b7631
commit 182c21e38c
1096 changed files with 309697 additions and 132612 deletions
+9 -3
View File
@@ -15,6 +15,8 @@ type Hash struct {
}
// ComputeHashes computes the tree-hash and linear hash of a seekable reader r.
//
// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information.
func ComputeHashes(r io.ReadSeeker) Hash {
r.Seek(0, 0) // Read the whole stream
defer r.Seek(0, 0) // Rewind stream at end
@@ -41,12 +43,16 @@ func ComputeHashes(r io.ReadSeeker) Hash {
return Hash{
LinearHash: hsh.Sum(nil),
TreeHash: buildHashTree(hashes),
TreeHash: ComputeTreeHash(hashes),
}
}
// buildHashTree builds a hash tree root node given a set of hashes.
func buildHashTree(hashes [][]byte) []byte {
// ComputeTreeHash builds a tree hash root node given a slice of
// hashes. Glacier tree hash to be derived from SHA256 hashes of 1MB
// chucks of the data.
//
// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information.
func ComputeTreeHash(hashes [][]byte) []byte {
if hashes == nil || len(hashes) == 0 {
return nil
}