mirror of
https://github.com/restic/restic.git
synced 2026-11-11 22:31:30 +00:00
Restructure, adapt for max 16MB chunk size
This commit is contained in:
1 parent
f1f96c4206
commit
f0287b2c9a
10 files changed
+42
-271
No files matched your search
@@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
"github.com/fd0/khepri"
|
||||
@@ -16,17 +16,15 @@ func fsck_tree(repo *khepri.Repository, id khepri.ID) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
hr := khepri.NewHashingReader(rd, sha256.New)
|
||||
dec := json.NewDecoder(hr)
|
||||
buf, err := ioutil.ReadAll(rd)
|
||||
|
||||
tree := &khepri.Tree{}
|
||||
err = dec.Decode(tree)
|
||||
|
||||
err = json.Unmarshal(buf, tree)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if !id.Equal(hr.Hash()) {
|
||||
if !id.Equal(khepri.IDFromData(buf)) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user