mirror of
https://github.com/restic/restic.git
synced 2025-12-03 22:21:47 +00:00
convert MemorizeList to be repository based
Ideally, code that uses a repository shouldn't directly interact with the underlying backend. Thus, move MemorizeList one layer up.
This commit is contained in:
@@ -116,7 +116,7 @@ func SearchKey(ctx context.Context, s *Repository, password string, maxKeys int,
|
||||
checked := 0
|
||||
|
||||
if len(keyHint) > 0 {
|
||||
id, err := restic.Find(ctx, s.Backend(), restic.KeyFile, keyHint)
|
||||
id, err := restic.Find(ctx, s, restic.KeyFile, keyHint)
|
||||
|
||||
if err == nil {
|
||||
key, err := OpenKey(ctx, s, id, password)
|
||||
|
||||
@@ -584,20 +584,14 @@ func (r *Repository) SetIndex(i restic.MasterIndex) error {
|
||||
func (r *Repository) LoadIndex(ctx context.Context, p *progress.Counter) error {
|
||||
debug.Log("Loading index")
|
||||
|
||||
indexList, err := backend.MemorizeList(ctx, r.Backend(), restic.IndexFile)
|
||||
indexList, err := restic.MemorizeList(ctx, r, restic.IndexFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if p != nil {
|
||||
var numIndexFiles uint64
|
||||
err := indexList.List(ctx, restic.IndexFile, func(fi backend.FileInfo) error {
|
||||
_, err := restic.ParseID(fi.Name)
|
||||
if err != nil {
|
||||
debug.Log("unable to parse %v as an ID", fi.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
err := indexList.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error {
|
||||
numIndexFiles++
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user