MCPcopy
hub / github.com/kopia/kopia / inspectSingleIndexBlob

Method inspectSingleIndexBlob

cli/command_index_inspect.go:142–167  ·  view source on GitHub ↗
(ctx context.Context, rep repo.DirectRepository, blobID blob.ID, output chan indexBlobPlusContentInfo)

Source from the content-addressed store, hash-verified

140}
141
142func (c *commandIndexInspect) inspectSingleIndexBlob(ctx context.Context, rep repo.DirectRepository, blobID blob.ID, output chan indexBlobPlusContentInfo) error {
143 log(ctx).Debugf("Inspecting blob %v...", blobID)
144
145 bm, err := rep.BlobReader().GetMetadata(ctx, blobID)
146 if err != nil {
147 return errors.Wrapf(err, "unable to get metadata for %v", blobID)
148 }
149
150 var data gather.WriteBuffer
151 defer data.Close()
152
153 if err = rep.BlobReader().GetBlob(ctx, blobID, 0, -1, &data); err != nil {
154 return errors.Wrapf(err, "unable to get data for %v", blobID)
155 }
156
157 entries, err := content.ParseIndexBlob(blobID, data.Bytes(), rep.ContentReader().ContentFormat())
158 if err != nil {
159 return errors.Wrapf(err, "unable to recover index from %v", blobID)
160 }
161
162 for _, ent := range entries {
163 output <- indexBlobPlusContentInfo{bm, ent}
164 }
165
166 return nil
167}

Callers 2

runWithOutputMethod · 0.95
inspectAllBlobsMethod · 0.95

Calls 8

CloseMethod · 0.95
BytesMethod · 0.95
ParseIndexBlobFunction · 0.92
GetMetadataMethod · 0.65
BlobReaderMethod · 0.65
GetBlobMethod · 0.65
ContentFormatMethod · 0.65
ContentReaderMethod · 0.65

Tested by

no test coverage detected