From 3615956198f8a2299f7762d08bb12dc874581f53 Mon Sep 17 00:00:00 2001 From: Aaron Wilson Date: Thu, 5 Sep 2024 20:44:55 +0000 Subject: [PATCH] cmn: Expose CopyProps for use in operator Signed-off-by: Aaron Wilson --- cmn/api.go | 2 +- cmn/config.go | 2 +- cmn/iter_fields.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmn/api.go b/cmn/api.go index 910a6db6d0..6ea4ddbbe9 100644 --- a/cmn/api.go +++ b/cmn/api.go @@ -249,7 +249,7 @@ func (bp *Bprops) Validate(targetCnt int) error { } func (bp *Bprops) Apply(propsToSet *BpropsToSet) { - err := copyProps(propsToSet, bp, apc.Daemon) + err := CopyProps(propsToSet, bp, apc.Daemon) debug.AssertNoErr(err) } diff --git a/cmn/config.go b/cmn/config.go index f3eea7b9df..9b36cfa3d2 100644 --- a/cmn/config.go +++ b/cmn/config.go @@ -756,7 +756,7 @@ func (c *Config) TestingEnv() bool { /////////////////// func (c *ClusterConfig) Apply(updateConf *ConfigToSet, asType string) error { - return copyProps(updateConf, c, asType) + return CopyProps(updateConf, c, asType) } func (c *ClusterConfig) String() string { diff --git a/cmn/iter_fields.go b/cmn/iter_fields.go index 23aa54a10f..96cab3b54d 100644 --- a/cmn/iter_fields.go +++ b/cmn/iter_fields.go @@ -224,8 +224,8 @@ func iterFields(prefix string, v any, updf updateFunc, opts IterOpts) (dirty, st return } -// update dst with the values from src -func copyProps(src, dst any, asType string) error { +// CopyProps update dst with the values from src +func CopyProps(src, dst any, asType string) error { var ( srcVal = reflect.ValueOf(src) dstVal = reflect.ValueOf(dst).Elem() @@ -271,7 +271,7 @@ func copyProps(src, dst any, asType string) error { } } else { // Recurse into struct - if err := copyProps(srcValField.Elem().Interface(), dstValField.Addr().Interface(), asType); err != nil { + if err := CopyProps(srcValField.Elem().Interface(), dstValField.Addr().Interface(), asType); err != nil { return err } }