func BenchmarkLoadIndex(b *testing.B) { WithTestEnvironment(b, repoFixture, func(repodir string) { repo := OpenLocalRepo(b, repodir) b.ResetTimer() for i := 0; i < b.N; i++ { repo.SetIndex(repository.NewMasterIndex()) OK(b, repo.LoadIndex()) } }) }
func BenchmarkLoadIndex(b *testing.B) { repodir, cleanup := Env(b, repoFixture) defer cleanup() repo := repository.TestOpenLocal(b, repodir) b.ResetTimer() for i := 0; i < b.N; i++ { repo.SetIndex(repository.NewMasterIndex()) OK(b, repo.LoadIndex()) } }
// New returns a new checker which runs on repo. func New(repo *repository.Repository) *Checker { c := &Checker{ packs: backend.NewIDSet(), blobs: backend.NewIDSet(), masterIndex: repository.NewMasterIndex(), indexes: make(map[backend.ID]*repository.Index), repo: repo, } c.blobRefs.M = make(map[backend.ID]uint) return c }
func reloadIndex(t *testing.T, repo restic.Repository) { repo.SetIndex(repository.NewMasterIndex()) if err := repo.LoadIndex(); err != nil { t.Fatalf("error loading new index: %v", err) } }