MCPcopy
hub / github.com/kopia/kopia / VerifyObject

Function VerifyObject

repo/object/object_reader.go:22–36  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

20// VerifyObject ensures that all objects backing ObjectID are present in the repository
21// and returns the content IDs of which it is composed.
22func 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
38type objectReader struct {
39 // objectReader implements io.Reader, but needs context to read from repository

Callers 5

VerifyObjectMethod · 0.92
VerifyObjectMethod · 0.92
TestIndirectionFunction · 0.85
TestConcatenateFunction · 0.85

Calls 3

contentIDsMethod · 0.95
iterateBackingContentsFunction · 0.85
ContentInfoMethod · 0.65

Tested by 3

TestIndirectionFunction · 0.68
TestConcatenateFunction · 0.68