forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helpers for infering space from address or CIDR+provider subnetID
The infer logic for addresses works by parsing the subnet CIDRs and attempting to match the specified address to a single CIDR (multiple matches cause an error to be returned). The expectation is that the code using the infer helpers will obtain the SpaceInfos once and then iterate on a list of addresses. In order to avoid having to parse CIDRs every single time, this commit tweaks network.SubnetInfo so that it memoizes parsed CIDRs and adds the ParsedCIDRNetwork helper to get the parsed CIDR instance.
- Loading branch information
1 parent
2a244ae
commit 37e32d9
Showing
3 changed files
with
141 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters