MCPcopy
hub / github.com/kopia/kopia / FindSnapshotsByRootObjectID

Function FindSnapshotsByRootObjectID

snapshot/manager.go:210–230  ·  view source on GitHub ↗

FindSnapshotsByRootObjectID returns the list of matching snapshots for a given rootID.

(ctx context.Context, rep repo.Repository, rootID object.ID)

Source from the content-addressed store, hash-verified

208
209// FindSnapshotsByRootObjectID returns the list of matching snapshots for a given rootID.
210func 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.
233func UpdateSnapshot(ctx context.Context, rep repo.RepositoryWriter, m *Manifest) error {

Calls 3

ListSnapshotManifestsFunction · 0.85
LoadSnapshotsFunction · 0.85
RootObjectIDMethod · 0.80

Tested by

no test coverage detected