(ctx context.Context, rep repo.Repository, v *snapshotfs.Verifier)
| 99 | } |
| 100 | |
| 101 | func (c *commandSnapshotVerify) makeVerifyWalkerFunc(ctx context.Context, rep repo.Repository, v *snapshotfs.Verifier) func(tw *snapshotfs.TreeWalker) error { |
| 102 | return func(tw *snapshotfs.TreeWalker) error { |
| 103 | manifests, err := c.loadSourceManifests(ctx, rep) |
| 104 | if err != nil { |
| 105 | return err |
| 106 | } |
| 107 | |
| 108 | snapIDManifests, err := c.loadSnapIDManifests(ctx, rep) |
| 109 | if err != nil { |
| 110 | return err |
| 111 | } |
| 112 | |
| 113 | manifests = append(manifests, snapIDManifests...) |
| 114 | |
| 115 | type twEntry struct { |
| 116 | root fs.Entry |
| 117 | rootPath string |
| 118 | } |
| 119 | |
| 120 | var treeWalkerEntries []twEntry |
| 121 | |
| 122 | for _, man := range manifests { |
| 123 | rootPath := fmt.Sprintf("%v@%v", man.Source, formatTimestamp(man.StartTime.ToTime())) |
| 124 | |
| 125 | if man.RootEntry == nil { |
| 126 | continue |
| 127 | } |
| 128 | |
| 129 | root, err := snapshotfs.SnapshotRoot(rep, man) |
| 130 | if err != nil { |
| 131 | return errors.Wrapf(err, "unable to get snapshot root: %q", rootPath) |
| 132 | } |
| 133 | |
| 134 | treeWalkerEntries = append(treeWalkerEntries, twEntry{ |
| 135 | root: root, |
| 136 | rootPath: rootPath, |
| 137 | }) |
| 138 | |
| 139 | if err := addExpectedWorkFromDirSummaryToVerifier(ctx, v, root); err != nil { |
| 140 | return errors.Wrapf(err, "unable to set stat totals from summary") |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | for _, twEntry := range treeWalkerEntries { |
| 145 | // ignore error now, return aggregate error at a higher level. |
| 146 | //nolint:errcheck |
| 147 | tw.Process(ctx, twEntry.root, twEntry.rootPath) |
| 148 | } |
| 149 | |
| 150 | for _, oidStr := range c.verifyCommandDirObjectIDs { |
| 151 | oid, err := snapshotfs.ParseObjectIDWithPath(ctx, rep, oidStr) |
| 152 | if err != nil { |
| 153 | return errors.Wrapf(err, "unable to parse: %q", oidStr) |
| 154 | } |
| 155 | |
| 156 | // ignore error now, return aggregate error at a higher level. |
| 157 | //nolint:errcheck |
| 158 | tw.Process(ctx, snapshotfs.DirectoryEntry(rep, oid, nil), oidStr) |
no test coverage detected