-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add a blob container client factory for customisation #7849
Add a blob container client factory for customisation #7849
Conversation
79c21b0
to
e084964
Compare
e084964
to
4f397bd
Compare
4f397bd
to
9f2a522
Compare
src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/IBlobContainerFactory.cs
Outdated
Show resolved
Hide resolved
src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/IBlobContainerFactory.cs
Outdated
Show resolved
Hide resolved
@@ -189,6 +195,8 @@ public async Task WriteStateAsync<T>(string grainType, GrainReference grainId, I | |||
public async Task ClearStateAsync<T>(string grainType, GrainReference grainId, IGrainState<T> grainState) | |||
{ | |||
var blobName = GetBlobName(grainType, grainId); | |||
var container = this.blobContainerFactory.BuildContainerClient(grainType, grainId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems expensive - creating a new container for each call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I wasn't wild about this either but I can't think of another way of handling it. The default implementation wouldn't create a new container each call but I guess could
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems wrong that everyone should have to pay for this, given it serves a very niche purpose. I think it would be better to have a different storage provider, eg a sharded/partitioned storage provider which delegates to another storage provider based on the partition which the grain is in. That also allows sharding across storage accounts (which this would not), so it is more compelling. cc @benjaminpetit (who is out of office currently)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everyone wouldn't have to pay for this apart from the overhead of the method call to the factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you're right, my bad.
01e3086
to
b90f431
Compare
b90f431
to
0e768be
Compare
@ReubenBond is there anything extra you'd like done on this? |
333248b
to
a39a426
Compare
a39a426
to
29d5fef
Compare
LGTM. cc @benjaminpetit for feedback. I made some minor adjustments in the latest commit. |
Allows blob containers to be customised based on grainType and grain id. This is wrapped in an interface to allow injection of dependencies and state to be maintained.
…BlobContainerFactory.cs
1f9bef2
to
1f450b2
Compare
@benjaminpetit PTAL. I recall you had an opinion that this should be implemented using a delegate instead. I wonder how that fits with the |
Hi Ruben, congratulations to y'all for shipping Orleans 7. I was wondering if there was any plans for this since the release has been completed, happy to help make any changes needed on it. |
Hi @Romanx, apologies for the lack of activity here. @benjaminpetit raised some points about using a configurable delegate to select the container instead of a 2-method interface. I'd like to see how that alternative looks in code |
Hey @ReubenBond, no problem at all. @benjaminpetit, Let me know if you need any help getting it going |
@ReubenBond @benjaminpetit, this is becoming a little more pressing for my project as we're moving to Orleans 7.0 at the moment and we'd rather not copy the storage provider into our project. Any updates on where we are with this, happy to spend some time if you've got ideas on what changes you'd like but no time yourselves? |
cc @benjaminpetit let's come up with a solution/agreement on this tomorrow, if possible |
Sorry to nudge again on this one. Is there any kind of ETA on this getting merged? We could bring this code directly into our codebase but then makes us not use the AzureStorage provider which could drift and we would rather not. Cheers |
Allows blob containers to be customised based on grainType and grain id. This is wrapped in an interface to allow injection of dependencies and state to be maintained.
Fixes #7831
Microsoft Reviewers: Open in CodeFlow