Skip to content

Commit

Permalink
cmn: Expose CopyProps for use in operator
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Wilson <[email protected]>
  • Loading branch information
aaronnw committed Sep 5, 2024
1 parent d8a71bb commit 3615956
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmn/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion cmn/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions cmn/iter_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 3615956

Please sign in to comment.