From 388cf950f5dd840c8dab91fe7d15bf7aed6843a9 Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Tue, 7 Jan 2025 11:38:06 +0100 Subject: [PATCH] rename to DisableExtraIdentityDefaulting --- api/ocm/cpi/modopts.go | 4 +-- api/ocm/cpi/repocpi/view_cv.go | 6 ++-- api/ocm/internal/modopts.go | 28 +++++++++---------- api/ocm/modopts.go | 6 ++-- api/ocm/tools/transfer/transfer.go | 2 +- .../transferhandler/standard/handler.go | 4 +-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/api/ocm/cpi/modopts.go b/api/ocm/cpi/modopts.go index 0e6b4d11c..0679dc335 100644 --- a/api/ocm/cpi/modopts.go +++ b/api/ocm/cpi/modopts.go @@ -35,8 +35,8 @@ func NewTargetElementOptions(list ...TargetElementOption) *TargetElementOptions return &m } -func RawIdentity(flag ...bool) internal.TargetOptionImpl { - return internal.RawIdentity(flag...) +func DisableExtraIdentityDefaulting(flag ...bool) internal.TargetOptionImpl { + return internal.DisableExtraIdentityDefaulting(flag...) } //////////////////////////////////////////////////////////////////////////////// diff --git a/api/ocm/cpi/repocpi/view_cv.go b/api/ocm/cpi/repocpi/view_cv.go index 9b32119d6..fd44231e1 100644 --- a/api/ocm/cpi/repocpi/view_cv.go +++ b/api/ocm/cpi/repocpi/view_cv.go @@ -468,7 +468,7 @@ func (c *componentVersionAccessView) SetResource(meta *cpi.ResourceMeta, acc com } else { cd.Resources[idx] = *res } - if opts.IsModifyElement() && !opts.IsRawIdentity() { + if opts.IsModifyElement() && !opts.IsDisableExtraIdentityDefaulting() { // default handling for completing an extra identity for modifications, only. compdesc.DefaultResources(cd) } @@ -549,7 +549,7 @@ func (c *componentVersionAccessView) SetSource(meta *cpi.SourceMeta, acc compdes } else { cd.Sources[idx] = *res } - if !opts.IsRawIdentity() { + if !opts.IsDisableExtraIdentityDefaulting() { compdesc.DefaultSources(cd) } return c.bridge.Update(false) @@ -587,7 +587,7 @@ func (c *componentVersionAccessView) SetReference(ref *cpi.ComponentReference, o cd.References[idx].Equivalent(ref) cd.References[idx] = *ref } - if opts.IsModifyElement(moddef) && !opts.IsRawIdentity() { + if opts.IsModifyElement(moddef) && !opts.IsDisableExtraIdentityDefaulting() { compdesc.DefaultReferences(cd) } return c.bridge.Update(false) diff --git a/api/ocm/internal/modopts.go b/api/ocm/internal/modopts.go index e96ffb68d..df43fc40f 100644 --- a/api/ocm/internal/modopts.go +++ b/api/ocm/internal/modopts.go @@ -109,9 +109,9 @@ type TargetOptionImpl interface { type TargetElementOptions struct { TargetElement TargetElement - // RawIdentity disables the implicit defaulting of the extraIdentity. + // DisableExtraIdentityDefaulting disables the implicit defaulting of the extraIdentity. // A transfer operation must set this flag to preserve the normalizations. - RawIdentity *bool + DisableExtraIdentityDefaulting *bool } type TargetElementOption interface { @@ -132,11 +132,11 @@ func (m *TargetElementOptions) ApplyElementModificationOption(opts *ElementModif func (m *TargetElementOptions) ApplyTargetOption(opts *TargetElementOptions) { optionutils.Transfer(&opts.TargetElement, m.TargetElement) - optionutils.Transfer(&opts.RawIdentity, m.RawIdentity) + optionutils.Transfer(&opts.DisableExtraIdentityDefaulting, m.DisableExtraIdentityDefaulting) } -func (m *TargetElementOptions) IsRawIdentity() bool { - return utils.AsBool(m.RawIdentity) +func (m *TargetElementOptions) IsDisableExtraIdentityDefaulting() bool { + return utils.AsBool(m.DisableExtraIdentityDefaulting) } func (m *TargetElementOptions) ApplyTargetOptions(list ...TargetElementOption) *TargetElementOptions { @@ -364,27 +364,27 @@ func (m TargetIdentity) ApplyTargetOption(opts *TargetElementOptions) { //////////////////////////////////////////////////////////////////////////////// -type rawidentity bool +type disableextraidentitydefaulting bool -func (m rawidentity) ApplyBlobModificationOption(opts *BlobModificationOptions) { +func (m disableextraidentitydefaulting) ApplyBlobModificationOption(opts *BlobModificationOptions) { m.ApplyModificationOption(&opts.ModificationOptions) } -func (m rawidentity) ApplyModificationOption(opts *ModificationOptions) { +func (m disableextraidentitydefaulting) ApplyModificationOption(opts *ModificationOptions) { m.ApplyTargetOption(&opts.TargetElementOptions) } -func (m rawidentity) ApplyElementModificationOption(opts *ElementModificationOptions) { +func (m disableextraidentitydefaulting) ApplyElementModificationOption(opts *ElementModificationOptions) { m.ApplyTargetOption(&opts.TargetElementOptions) } -func (m rawidentity) ApplyTargetOption(opts *TargetElementOptions) { - opts.RawIdentity = utils.BoolP(m) +func (m disableextraidentitydefaulting) ApplyTargetOption(opts *TargetElementOptions) { + opts.DisableExtraIdentityDefaulting = utils.BoolP(m) } -// RawIdentity disables the defaulting of the extra identity. -func RawIdentity(flag ...bool) TargetOptionImpl { - return rawidentity(utils.OptionalDefaultedBool(true, flag...)) +// DisableExtraIdentityDefaulting disables the defaulting of the extra identity. +func DisableExtraIdentityDefaulting(flag ...bool) TargetOptionImpl { + return disableextraidentitydefaulting(utils.OptionalDefaultedBool(true, flag...)) } //////////////////////////////////////////////////////////////////////////////// diff --git a/api/ocm/modopts.go b/api/ocm/modopts.go index eb416efd4..5d0fb9ded 100644 --- a/api/ocm/modopts.go +++ b/api/ocm/modopts.go @@ -66,9 +66,9 @@ func TargetIndex(idx int) internal.TargetOptionImpl { return internal.TargetIndex(idx) } -// RawIdentity disables the defaulting of the extra identity -func RawIdentity(flag ...bool) internal.TargetOptionImpl { - return internal.RawIdentity(flag...) +// DisableExtraIdentityDefaulting disables the defaulting of the extra identity +func DisableExtraIdentityDefaulting(flag ...bool) internal.TargetOptionImpl { + return internal.DisableExtraIdentityDefaulting(flag...) } const AppendElement = internal.TargetIndex(-1) diff --git a/api/ocm/tools/transfer/transfer.go b/api/ocm/tools/transfer/transfer.go index 872f7b095..8d6687000 100644 --- a/api/ocm/tools/transfer/transfer.go +++ b/api/ocm/tools/transfer/transfer.go @@ -273,7 +273,7 @@ func copyVersion(printer common.Printer, log logging.Logger, hist common.History err = handler.HandleTransferResource(r, m, hint, t) } else { if err == nil { // old resource found -> keep current access method - t.SetResource(r.Meta(), old.Access, ocm.ModifyElement(), ocm.SkipVerify(), ocm.RawIdentity()) + t.SetResource(r.Meta(), old.Access, ocm.ModifyElement(), ocm.SkipVerify(), ocm.DisableExtraIdentityDefaulting()) } notifyArtifactInfo(printer, log, "resource", i, r.Meta(), hint, "already present") } diff --git a/api/ocm/tools/transfer/transferhandler/standard/handler.go b/api/ocm/tools/transfer/transferhandler/standard/handler.go index f9a5c3db5..0f8f7cf6b 100644 --- a/api/ocm/tools/transfer/transferhandler/standard/handler.go +++ b/api/ocm/tools/transfer/transferhandler/standard/handler.go @@ -87,7 +87,7 @@ func (h *Handler) HandleTransferResource(r ocm.ResourceAccess, m cpi.AccessMetho } defer blob.Close() return accessio.Retry(h.opts.GetRetries(), time.Second, func() error { - return t.SetResourceBlob(r.Meta(), blob, hint, h.GlobalAccess(t.GetContext(), m), ocm.SkipVerify(), ocm.RawIdentity()) + return t.SetResourceBlob(r.Meta(), blob, hint, h.GlobalAccess(t.GetContext(), m), ocm.SkipVerify(), ocm.DisableExtraIdentityDefaulting()) }) } @@ -98,7 +98,7 @@ func (h *Handler) HandleTransferSource(r ocm.SourceAccess, m cpi.AccessMethod, h } defer blob.Close() return accessio.Retry(h.opts.GetRetries(), time.Second, func() error { - return t.SetSourceBlob(r.Meta(), blob, hint, h.GlobalAccess(t.GetContext(), m), ocm.RawIdentity()) + return t.SetSourceBlob(r.Meta(), blob, hint, h.GlobalAccess(t.GetContext(), m), ocm.DisableExtraIdentityDefaulting()) }) }