2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Rename Index interface to MasterIndex

The interface is now only implemented by repository.MasterIndex.
This commit is contained in:
Michael Eischer 2020-07-25 21:19:46 +02:00
parent 9d1fb94c6c
commit c847aace35
4 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import (
// Saver allows saving a blob. // Saver allows saving a blob.
type Saver interface { type Saver interface {
SaveBlob(ctx context.Context, t restic.BlobType, data []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, error) 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. // BlobSaver concurrently saves incoming blobs to the repo.

View File

@ -16,7 +16,7 @@ import (
var errTest = errors.New("test error") var errTest = errors.New("test error")
type saveFail struct { type saveFail struct {
idx restic.Index idx restic.MasterIndex
cnt int32 cnt int32
failAt int32 failAt int32
} }
@ -30,7 +30,7 @@ func (b *saveFail) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte,
return id, false, nil return id, false, nil
} }
func (b *saveFail) Index() restic.Index { func (b *saveFail) Index() restic.MasterIndex {
return b.idx return b.idx
} }

View File

@ -355,12 +355,12 @@ func (r *Repository) Backend() restic.Backend {
} }
// Index returns the currently used MasterIndex. // Index returns the currently used MasterIndex.
func (r *Repository) Index() restic.Index { func (r *Repository) Index() restic.MasterIndex {
return r.idx return r.idx
} }
// SetIndex instructs the repository to use the given index. // 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) r.idx = i.(*MasterIndex)
ids := restic.NewIDSet() ids := restic.NewIDSet()

View File

@ -15,9 +15,9 @@ type Repository interface {
Key() *crypto.Key Key() *crypto.Key
SetIndex(Index) error SetIndex(MasterIndex) error
Index() Index Index() MasterIndex
SaveFullIndex(context.Context) error SaveFullIndex(context.Context) error
SaveIndex(context.Context) error SaveIndex(context.Context) error
LoadIndex(context.Context) error LoadIndex(context.Context) error
@ -57,8 +57,8 @@ type Lister interface {
List(context.Context, FileType, func(FileInfo) error) error List(context.Context, FileType, func(FileInfo) error) error
} }
// Index keeps track of the blobs are stored within files. // MasterIndex keeps track of the blobs are stored within files.
type Index interface { type MasterIndex interface {
Has(ID, BlobType) bool Has(ID, BlobType) bool
Lookup(ID, BlobType) []PackedBlob Lookup(ID, BlobType) []PackedBlob
Count(BlobType) uint Count(BlobType) uint