MCPcopy
hub / github.com/harness/harness / DeletePackage

Method DeletePackage

registry/app/pkg/base/base.go:579–610  ·  view source on GitHub ↗
(ctx context.Context, info pkg.PackageArtifactInfo)

Source from the content-addressed store, hash-verified

577}
578
579func (l *localBase) DeletePackage(ctx context.Context, info pkg.PackageArtifactInfo) error {
580 err := l.tx.WithTx(
581 ctx, func(ctx context.Context) error {
582 path := "/" + info.BaseArtifactInfo().Image
583 err := l.nodesDao.DeleteByNodePathAndRegistryID(ctx, path, info.BaseArtifactInfo().RegistryID)
584
585 if err != nil {
586 return err
587 }
588
589 err = l.artifactDao.DeleteByImageNameAndRegistryID(ctx,
590 info.BaseArtifactInfo().RegistryID, info.BaseArtifactInfo().Image)
591
592 if err != nil {
593 return err
594 }
595
596 err = l.imageDao.DeleteByImageNameAndRegID(ctx, info.BaseArtifactInfo().RegistryID,
597 info.BaseArtifactInfo().Image)
598
599 if err != nil {
600 return err
601 }
602 return nil
603 })
604 if err != nil {
605 log.Ctx(ctx).Warn().Msgf("Failed to delete the package %v", info.BaseArtifactInfo().Image)
606 return err
607 }
608
609 return nil
610}
611
612func (l *localBase) DeleteVersion(ctx context.Context, info pkg.PackageArtifactInfo) error {
613 err := l.tx.WithTx(

Callers

nothing calls this directly

Calls 7

MsgfMethod · 0.80
WithTxMethod · 0.65
BaseArtifactInfoMethod · 0.65
WarnMethod · 0.65

Tested by

no test coverage detected