MCPcopy
hub / github.com/kopia/kopia / run

Method run

cli/command_snapshot_pin.go:28–47  ·  view source on GitHub ↗
(ctx context.Context, rep repo.RepositoryWriter)

Source from the content-addressed store, hash-verified

26}
27
28func (c *commandSnapshotPin) run(ctx context.Context, rep repo.RepositoryWriter) error {
29 if len(c.addPins)+len(c.removePins) == 0 {
30 return errors.New("must specify --add and/or --remove")
31 }
32
33 for _, id := range c.snapshotIDs {
34 m, err := snapshot.LoadSnapshot(ctx, rep, manifest.ID(id))
35 if err == nil {
36 if err = c.pinSnapshot(ctx, rep, m); err != nil {
37 return errors.Wrapf(err, "error pinning %v", id)
38 }
39 } else if !errors.Is(err, snapshot.ErrSnapshotNotFound) {
40 return errors.Wrapf(err, "error loading snapshot %v", id)
41 } else if err := c.pinSnapshotsByRootObjectID(ctx, rep, id); err != nil {
42 return errors.Wrapf(err, "error pinning snapshots by root ID %v", id)
43 }
44 }
45
46 return nil
47}
48
49func (c *commandSnapshotPin) pinSnapshotsByRootObjectID(ctx context.Context, rep repo.RepositoryWriter, rootID string) error {
50 rootOID, err := object.ParseID(rootID)

Callers

nothing calls this directly

Calls 4

pinSnapshotMethod · 0.95
LoadSnapshotFunction · 0.92
IDTypeAlias · 0.92

Tested by

no test coverage detected