mirror of
https://github.com/restic/restic.git
synced 2026-10-30 03:55:42 +00:00
Add Index.LookupSize
This commit is contained in:
1 parent
c9d8ab9be5
commit
ca6b7ec533
2 files changed
+13
-3
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/crypto"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
)
|
||||
@@ -91,6 +92,16 @@ func (idx *Index) Has(id backend.ID) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// LookupSize returns the length of the cleartext content behind the
|
||||
// given id
|
||||
func (idx *Index) LookupSize(id backend.ID) (cleartextLength uint, err error) {
|
||||
_, _, _, encryptedLength, err := idx.Lookup(id)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return encryptedLength - crypto.Extension, nil
|
||||
}
|
||||
|
||||
// Merge loads all items from other into idx.
|
||||
func (idx *Index) Merge(other *Index) {
|
||||
debug.Log("Index.Merge", "Merge index with %p", other)
|
||||
|
||||
Reference in new issue
Block a user