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

Simplified programmatic configuration for bootstrap providers #19 #205

Merged
merged 4 commits into from
Mar 10, 2015
Merged

Simplified programmatic configuration for bootstrap providers #19 #205

merged 4 commits into from
Mar 10, 2015

Conversation

yevhen
Copy link
Contributor

@yevhen yevhen commented Mar 8, 2015

No description provided.

@dnfclas
Copy link

dnfclas commented Mar 8, 2015

Hi @yevhen, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@yevhen
Copy link
Contributor Author

yevhen commented Mar 8, 2015

I've also added utility extension method for IDictionary lookup. It's internal. I think there many places in code where it could be useful. Finding smth in dictionary is so common :)

@@ -21,7 +21,7 @@ MIT License
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

using System;
using System;
Copy link
Contributor

Choose a reason for hiding this comment

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

A slip?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably

@yevhen
Copy link
Contributor Author

yevhen commented Mar 9, 2015

The build has failed on Jenkins and it has nothing to do with my changes. The test for observers has failed for some intermittent reasons (timeouts).

@gabikliot gabikliot self-assigned this Mar 9, 2015
var fullName = boostrapProviderType.FullName;
if (category.Providers.ContainsKey(fullName))
throw new InvalidOperationException(
string.Format("Bootstrap provider of type {0} has been already registered",
Copy link
Contributor

Choose a reason for hiding this comment

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

We definitely should not limit to only one impl. of a given Bootstrap Provider. One should be able to pass multiple providers of the exact same type. We currently allow that. The difference in this PR is in the line below:
var config = new ProviderConfiguration( properties ?? new Dictionary<string, string>(), fullName, fullName);
the last arg should be provider name, not fullName of the type.
It means the RegisterBootstrapProvider should accept a name argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I'll add name parameter

@gabikliot
Copy link
Contributor

Yevgeny, you can also look at some examples here: #201
It's quite similar to your code, with small differences.
Your PR is basically putting the same code in the framework, instead of keeping it as an example, which is a nice and welcomed extension.

@gabikliot
Copy link
Contributor

I also tried to run the tests. They indeed fail. The problem is that in your PR you removed the line: Providers = new Dictionary<string, IProviderConfiguration>(); in the ProviderCategoryConfiguration.Load.

It now puts a burden of making sure to init this property on the caller, and there were paths in the code that did not do that. I think it would be more robust to init it in the constructor.
In general I also don't like much the "explicit init" style of code
(category = new ProviderCategoryConfiguration()
731 + {
732 + Name = bootstrapCategoryKey,
733 + Providers = new Dictionary<string, IProviderConfiguration>()
734 + };

is it going back to C from C++? That's one of the pillars of OOP - encapsulation, right?

Anyway, it is also very easy to run the tests, either in the VS or by the Test script.

@yevhen
Copy link
Contributor Author

yevhen commented Mar 9, 2015

@gabikliot

Your PR is basically putting the same code in the framework, instead of keeping it as an example, which is a nice and welcomed extension.

I didn't get it. Did you mean it's better to leave it as just an example and not try to add it to the framework?

@yevhen
Copy link
Contributor Author

yevhen commented Mar 9, 2015

@gabikliot

I also tried to run the tests. They indeed fail. The problem is that in your PR you removed the line: Providers = new Dictionary(); in the ProviderCategoryConfiguration.Load.

That's a bug. I'll fix it.
Strange, I did run tests via cmd line as well. Perhaps, I haven't rebuild the code before running test.cmd.

@gabikliot
Copy link
Contributor

I didn't get it. Did you mean it's better to leave it as just an example and not try to add it to the framework?

No, the other way. I liked it. I said it's better then the example approach I used in the sample.

@yevhen
Copy link
Contributor Author

yevhen commented Mar 9, 2015

@gabikliot

(category = new ProviderCategoryConfiguration()
731 + {
732 + Name = bootstrapCategoryKey,
733 + Providers = new Dictionary()
734 + };

As per your example (gabikliot@844e26b). And follows the usual idiom when working with non-immutable objects.

gabikliot added a commit that referenced this pull request Mar 10, 2015
Simplified programmatic configuration for bootstrap providers #19
@gabikliot gabikliot merged commit 8ff4dfc into dotnet:master Mar 10, 2015
gabikliot added a commit to gabikliot/orleans that referenced this pull request Mar 17, 2015
sergeybykov added a commit that referenced this pull request Mar 17, 2015
Added wrapper functions for stream and storage provider configurations, following @yevhen's PR #205.
@yevhen yevhen deleted the programmatic_bootstrapper_config branch March 29, 2015 20:57
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants