VerifyObject ensures that all objects backing ObjectID are present in the repository and returns the content IDs of which it is composed.
(ctx context.Context, cr contentReader, oid ID)
| 20 | // VerifyObject ensures that all objects backing ObjectID are present in the repository |
| 21 | // and returns the content IDs of which it is composed. |
| 22 | func VerifyObject(ctx context.Context, cr contentReader, oid ID) ([]content.ID, error) { |
| 23 | tracker := &contentIDTracker{} |
| 24 | |
| 25 | if err := iterateBackingContents(ctx, cr, oid, tracker, func(contentID content.ID) error { |
| 26 | if _, err := cr.ContentInfo(ctx, contentID); err != nil { |
| 27 | return errors.Wrapf(err, "error getting content info for %v", contentID) |
| 28 | } |
| 29 | |
| 30 | return nil |
| 31 | }); err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | |
| 35 | return tracker.contentIDs(), nil |
| 36 | } |
| 37 | |
| 38 | type objectReader struct { |
| 39 | // objectReader implements io.Reader, but needs context to read from repository |