func (v *Verifier) VerifyFile(ctx context.Context, oid object.ID, entryPath string) error {
	verifierLog(ctx).Debugf("verifying object %v", oid)

	defer func() {
		atomic.AddInt32(&v.processed, 1)
	}()

	contentIDs, err := v.rep.VerifyObject(ctx, oid)
	if err != nil {
		return errors.Wrap(err, "verify object")
	}

	if v.blobMap != nil {
		for _, cid := range contentIDs {
			ci, err := v.rep.ContentInfo(ctx, cid)
			if err != nil {
				return errors.Wrapf(err, "error verifying content %v", cid)
			}

			if _, ok := v.blobMap[ci.GetPackBlobID()]; !ok {
				return errors.Errorf("object %v is backed by missing blob %v", oid, ci.GetPackBlobID())
			}
		}
	}

	//nolint:gosec
	if 100*rand.Float64() < v.opts.VerifyFilesPercent {
		if err := v.readEntireObject(ctx, oid, entryPath); err != nil {
			return errors.Wrapf(err, "error reading object %v", oid)
		}
	}

	return nil
}
// VerifyFile verifies a single file object (using content check, blob map check or full read).
VerifyFile verifies a single file object (using content check, blob map check or full read).
// VerifyFile verifies a single file object ( using content check blob map check or full read ) .
func (v *Verifier) VerifyFile(ctx context.Context, oid object.ID, entryPath string) error {
	verifierLog(ctx).Debugf("verifying object %v", oid)
	defer func() {
		atomic.AddInt32(&v.processed, 1)
	}()
	contentIDs, err := v.rep.VerifyObject(ctx, oid)
	if err != nil {
		return errors.Wrap(err, "verify object")
	}
	if v.blobMap != nil {
		for _, cid := range contentIDs {
			ci, err := v.rep.ContentInfo(ctx, cid)
			if err != nil {
				return errors.Wrapf(err, "error verifying content %v", cid)
			}
			if _, ok := v.blobMap[ci.GetPackBlobID()]; !ok {
				return errors.Errorf("object %v is backed by missing blob %v", oid, ci.GetPackBlobID())
			}
		}
	}
	if 100*rand.Float64() < v.opts.VerifyFilesPercent {
		if err := v.readEntireObject(ctx, oid, entryPath); err != nil {
			return errors.Wrapf(err, "error reading object %v", oid)
		}
	}
	return nil
}
func ( v * Verifier ) VerifyFile ( ctx context . Context , oid object . ID , entryPath string ) error { verifierLog ( ctx ) . Debugf ( " " , oid ) defer func ( ) { atomic . AddInt32 ( & v . processed , 1 ) } ( ) contentIDs , err := v . rep . VerifyObject ( ctx , oid ) if err != nil { return errors . Wrap ( err , " " ) } if v . blobMap != nil { for _ , cid := range contentIDs { ci , err := v . rep . ContentInfo ( ctx , cid ) if err != nil { return errors . Wrapf ( err , " " , cid ) } if _ , ok := v . blobMap [ ci . GetPackBlobID ( ) ] ; ! ok { return errors . Errorf ( " " , oid , ci . GetPackBlobID ( ) ) } } } if 100 * rand . Float64 ( ) < v . opts . VerifyFilesPercent { if err := v . readEntireObject ( ctx , oid , entryPath ) ; err != nil { return errors . Wrapf ( err , " " , oid ) } } return nil }
VerifyFile verifies a single file object (using content check, blob map check or full read).
VerifyFile verifies a single file object ( using content check blob map check or full read ) .
//nolint:gosec