-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Fix gh 398 hash collision mitigation #408
base: master
Are you sure you want to change the base?
Fix gh 398 hash collision mitigation #408
Conversation
@jeremydmiller - I've went ahead and tackled this (#398) by abstracting the underlying data structure used to track the services. |
@jwoodmanbuildium Hey, there are changes here to tests that don't seem to be related. And also, #sadtrombone, there are breaking API changes. You cannot add optional arguments to an API unless you are making a full point release. You'd have to add overloads instead. |
@jeremydmiller - Overloads have been added in place of adding optional arguments to the previously updated methods & constructors. Regarding the test changes:
|
bumping for visibility |
I've removed the temporary fix to mitigate hash collisions & added a new opt-in behavior for tracking instances using a concurrent dictionary & instance identifier struct.
The new optional
InstanceMapBehavior
has been added to the hosting extensions & container/scope constructors. The default value will maintain the integer-based hash approach. Passing aDictionary
value will update the tracked services implementation to use a concurrent dictionary in place of the hash map. When a dictionary is used, theInstanceIdentifier
struct will be tracked through itsIEquatable
implementation, rather than the hashcode.