Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of space id/name helpers needed by enhancing SpaceInfos #10903

Merged
merged 6 commits into from
Nov 14, 2019

Conversation

hmlanigan
Copy link
Member

Description of change

Replace SpaceInfosByID(), SpaceNamesByID() and SpaceIDsByName() with AllSpaceInfos(). Reduces the number of Add methods attached to SpaceInfo{} to facilitate use in replacing the mentioned functions: ContainsName(), ContainsID(), and Difference().

QA steps

  1. deploy a charm with bindings
  2. upgrade juju

Replace SpaceIDsByName(), SpaceNamesByID() and SpaceInfosByID() with
AllSpaceInfos().  Add ContainsID(), ContainsName(), Difference()
functionaility to a SpaceInfo, to faciliate the replacement.
Due to enhancements to bridgepolicy to use SpacesInfos instead of
SpaceNamesByID() etc.
Copy link
Member

@manadart manadart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

core/network/address.go Outdated Show resolved Hide resolved
core/network/space.go Outdated Show resolved Hide resolved
@@ -545,41 +537,41 @@ func NewBindings(st EndpointBinding, givenMap map[string]string) (*Bindings, err
return &Bindings{st: st, bindingsMap: newMap}, err
}

func allOfOne(currentSpaces, givenMap map[string]string, allowEmptyValues bool) error {
func allOfOne(foundValue func(string) bool, givenMap map[string]string, allowEmptyValues bool) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@hmlanigan
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit f5a4e10 into juju:develop Nov 14, 2019
@hmlanigan hmlanigan deleted the use-spaceinfos branch November 14, 2019 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants