diff --git a/internal/archiver/blob_saver.go b/internal/archiver/blob_saver.go index 2eef0d55c..c59f08133 100644 --- a/internal/archiver/blob_saver.go +++ b/internal/archiver/blob_saver.go @@ -11,7 +11,7 @@ import ( // Saver allows saving a blob. type Saver interface { SaveBlob(ctx context.Context, t restic.BlobType, data []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, error) - Index() restic.Index + Index() restic.MasterIndex } // BlobSaver concurrently saves incoming blobs to the repo. diff --git a/internal/archiver/blob_saver_test.go b/internal/archiver/blob_saver_test.go index b3b235283..bd70e85f5 100644 --- a/internal/archiver/blob_saver_test.go +++ b/internal/archiver/blob_saver_test.go @@ -16,7 +16,7 @@ import ( var errTest = errors.New("test error") type saveFail struct { - idx restic.Index + idx restic.MasterIndex cnt int32 failAt int32 } @@ -30,7 +30,7 @@ func (b *saveFail) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, return id, false, nil } -func (b *saveFail) Index() restic.Index { +func (b *saveFail) Index() restic.MasterIndex { return b.idx } diff --git a/internal/repository/repository.go b/internal/repository/repository.go index 7e4f28d19..1966adbe9 100644 --- a/internal/repository/repository.go +++ b/internal/repository/repository.go @@ -355,12 +355,12 @@ func (r *Repository) Backend() restic.Backend { } // Index returns the currently used MasterIndex. -func (r *Repository) Index() restic.Index { +func (r *Repository) Index() restic.MasterIndex { return r.idx } // SetIndex instructs the repository to use the given index. -func (r *Repository) SetIndex(i restic.Index) error { +func (r *Repository) SetIndex(i restic.MasterIndex) error { r.idx = i.(*MasterIndex) ids := restic.NewIDSet() diff --git a/internal/restic/repository.go b/internal/restic/repository.go index a38452bdc..dcda37f04 100644 --- a/internal/restic/repository.go +++ b/internal/restic/repository.go @@ -15,9 +15,9 @@ type Repository interface { Key() *crypto.Key - SetIndex(Index) error + SetIndex(MasterIndex) error - Index() Index + Index() MasterIndex SaveFullIndex(context.Context) error SaveIndex(context.Context) error LoadIndex(context.Context) error @@ -57,8 +57,8 @@ type Lister interface { List(context.Context, FileType, func(FileInfo) error) error } -// Index keeps track of the blobs are stored within files. -type Index interface { +// MasterIndex keeps track of the blobs are stored within files. +type MasterIndex interface { Has(ID, BlobType) bool Lookup(ID, BlobType) []PackedBlob Count(BlobType) uint