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

Adds support for providing Actor type name during runtime. #680

Closed
wants to merge 1 commit into from

Conversation

bjorkstromm
Copy link
Member

Description

Adds support for providing Actor type name during runtime.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #677

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@codecov
Copy link

codecov bot commented May 16, 2021

Codecov Report

Merging #680 (cc6c236) into master (5a84326) will increase coverage by 0.02%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #680      +/-   ##
==========================================
+ Coverage   63.58%   63.61%   +0.02%     
==========================================
  Files         129      129              
  Lines        4248     4254       +6     
  Branches      476      477       +1     
==========================================
+ Hits         2701     2706       +5     
  Misses       1419     1419              
- Partials      128      129       +1     
Flag Coverage Δ
net5 63.49% <85.71%> (+0.02%) ⬆️
netcoreapp3.1 63.56% <85.71%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...Dapr.Actors/Runtime/ActorRegistrationCollection.cs 90.90% <80.00%> (-9.10%) ⬇️
src/Dapr.Actors/Runtime/ActorTypeInformation.cs 41.46% <100.00%> (+1.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a84326...cc6c236. Read the comment docs.

bjorkstromm added a commit to bjorkstromm/dotnet-sdk that referenced this pull request May 16, 2021
public void RegisterActor<TActor>(string actorTypeName, Action<ActorRegistration> configure = null)
where TActor : Actor
{
var actorTypeInfo = ActorTypeInformation.Get(typeof(TActor), actorTypeName);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's going to take me a bit to review this and rationalize the change. I have to check whether there are other places where we call ActorTypeInformation.Get.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. To clarify, this should be a non-breaking change. I added an overload for ActorTypeInformation.Get which takes an string parameter for specifying the actor type name.

public static ActorTypeInformation Get(Type actorType)

The above still exists, but will call the below with actorTypeName: null.

public static ActorTypeInformation Get(Type actorType, string actorTypeName)

And then in the above method I've just modified it to check is actorTypeName is provided.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. To clarify, this should be a non-breaking change. I added an overload for ActorTypeInformation.Get which takes an string parameter for specifying the actor type name.

What I'm concerned about isn't the addition of a new method it's a the introduction of a 'split brain' problem. We need to make sure it's not possible for two parts of the system to disagree about the type name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please do the following:

  • On ActorTypeInformation - mark TryGet(Type) and Get(Type) as [Obsolete]- we want to make sure we don't have code calling those since they don't accept a type name override.
  • On ActorHost we need another overload of CreateForTest that accepts a type name.
  • Update the remaining references to Get(Type) to call GetType(Type, null) - these will be unit tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this here bjorkstromm@e1b62c9

But since this PR was unintentionally closed, changes won't appear here. Could you please reopen, or should I open a new PR?

@rynowak rynowak closed this in 638bf4c Jun 6, 2021
@bjorkstromm
Copy link
Member Author

@rynowak it seems like this was not closed by intention... Can you reopen, and I'll address feedback mentioned here: #680 (comment)

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.

Add support to provide Actor TypeName during runtime at startup.
3 participants