Add GetCachedSupportedFeatures method to hcn package#1123
Merged
dcantah merged 4 commits intomicrosoft:masterfrom Aug 20, 2021
Merged
Add GetCachedSupportedFeatures method to hcn package#1123dcantah merged 4 commits intomicrosoft:masterfrom
dcantah merged 4 commits intomicrosoft:masterfrom
Conversation
To avoid a breaking change on GetSupportedFeatures introduce a new GetCachedSupportedFeatures method. This method does the feature check and version parsing once and then assigns a global with the information. This can be used to optimize for situations where many uses of the hcn.IsXSupported methods are going to be used (kube-proxy for example). Signed-off-by: Daniel Canter <dcanter@microsoft.com>
msscotb
reviewed
Aug 19, 2021
kevpar
reviewed
Aug 19, 2021
kevpar
reviewed
Aug 19, 2021
kevpar
reviewed
Aug 19, 2021
Contributor
Author
- Change versionErr -> featuresErr - Move work inside of the sync.Once out to its own function so we can use standard return err error handling and simply assign the output in GetCachedSupportedFeatures - Mark GetSupportedFeatures as deprecated. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
5cd55e5 to
f78d0ff
Compare
kevpar
reviewed
Aug 19, 2021
Signed-off-by: Daniel Canter <dcanter@microsoft.com>
kevpar
reviewed
Aug 19, 2021
hcn/hcnsupport.go
Outdated
| return supportedFeatures, featuresErr | ||
| } | ||
|
|
||
| // Deprecated: Use GetCachedSupportedFeatures instead. |
Member
There was a problem hiding this comment.
I think the main comment needs to be first or it will be flagged as not following function comment guidelines.
Signed-off-by: Daniel Canter <dcanter@microsoft.com>
anmaxvl
approved these changes
Aug 19, 2021
anmaxvl
pushed a commit
to anmaxvl/hcsshim
that referenced
this pull request
Nov 17, 2021
Related work items: microsoft#930, microsoft#962, microsoft#1004, microsoft#1008, microsoft#1039, microsoft#1045, microsoft#1046, microsoft#1047, microsoft#1052, microsoft#1053, microsoft#1054, microsoft#1057, microsoft#1058, microsoft#1060, microsoft#1061, microsoft#1063, microsoft#1064, microsoft#1068, microsoft#1069, microsoft#1070, microsoft#1071, microsoft#1074, microsoft#1078, microsoft#1079, microsoft#1081, microsoft#1082, microsoft#1083, microsoft#1084, microsoft#1088, microsoft#1090, microsoft#1091, microsoft#1093, microsoft#1094, microsoft#1096, microsoft#1098, microsoft#1099, microsoft#1102, microsoft#1103, microsoft#1105, microsoft#1106, microsoft#1108, microsoft#1109, microsoft#1115, microsoft#1116, microsoft#1122, microsoft#1123, microsoft#1126
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To avoid a breaking change on
GetSupportedFeaturesintroduce a newGetCachedSupportedFeaturesmethod. This method does the feature checkand version parsing once and then assigns a global with the information.
This can be used to optimize for situations where many uses of the
hcn.IsXSupported methods are going to be used (kube-proxy for example).
Previously they would call
GetSupportedFeaturesand end up re-querying andrevalidating the feature ranges every time.
Signed-off-by: Daniel Canter dcanter@microsoft.com