FindSnapshotsByRootObjectID returns the list of matching snapshots for a given rootID.
(ctx context.Context, rep repo.Repository, rootID object.ID)
| 208 | |
| 209 | // FindSnapshotsByRootObjectID returns the list of matching snapshots for a given rootID. |
| 210 | func FindSnapshotsByRootObjectID(ctx context.Context, rep repo.Repository, rootID object.ID) ([]*Manifest, error) { |
| 211 | ids, err := ListSnapshotManifests(ctx, rep, nil, nil) |
| 212 | if err != nil { |
| 213 | return nil, errors.Wrap(err, "error listing snapshot manifests") |
| 214 | } |
| 215 | |
| 216 | manifests, err := LoadSnapshots(ctx, rep, ids) |
| 217 | if err != nil { |
| 218 | return nil, errors.Wrap(err, "error loading snapshot manifests") |
| 219 | } |
| 220 | |
| 221 | var result []*Manifest |
| 222 | |
| 223 | for _, m := range manifests { |
| 224 | if m.RootObjectID() == rootID { |
| 225 | result = append(result, m) |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | return result, nil |
| 230 | } |
| 231 | |
| 232 | // UpdateSnapshot updates the snapshot by saving the provided data and deleting old manifest ID. |
| 233 | func UpdateSnapshot(ctx context.Context, rep repo.RepositoryWriter, m *Manifest) error { |
no test coverage detected