Skip to content

Commit

Permalink
vpcagent: models: separate Copy() and CopyJoined()
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed May 26, 2020
1 parent cb27b18 commit 146ab44
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/vpcagent/models/modelsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (mss *ModelSets) NewEmpty() apihelper.IModelSets {
return NewModelSets()
}

func (mss *ModelSets) Copy() apihelper.IModelSets {
func (mss *ModelSets) copy_() *ModelSets {
mssCopy := &ModelSets{
Vpcs: mss.Vpcs.Copy().(Vpcs),
Wires: mss.Wires.Copy().(Wires),
Expand All @@ -103,12 +103,17 @@ func (mss *ModelSets) Copy() apihelper.IModelSets {
Guestnetworks: mss.Guestnetworks.Copy().(Guestnetworks),
Guestsecgroups: mss.Guestsecgroups.Copy().(Guestsecgroups),
}
mssCopy.join()
return mssCopy
}

func (mss *ModelSets) Copy() apihelper.IModelSets {
return mss.copy_()
}

func (mss *ModelSets) CopyJoined() apihelper.IModelSets {
return mss.Copy()
mssCopy := mss.copy_()
mssCopy.join()
return mssCopy
}

func (mss *ModelSets) ApplyUpdates(mssNews apihelper.IModelSets) apihelper.ModelSetsUpdateResult {
Expand Down

0 comments on commit 146ab44

Please sign in to comment.