Replies: 6 comments 4 replies
-
@raffaeler I also would like to know how we can do it , I found this sample and I guess that is the way to delete state but I haven't tested it myself https://github.com/dotnet/samples/blob/main/orleans/Blazor/BlazorServer/Grains/TodoGrain.cs ( ClearAsync method ) |
Beta Was this translation helpful? Give feedback.
-
@r-khanmirzaee Thanks for entering the conversation. FYI the MongoDB provider completely clears all the documents when you call |
Beta Was this translation helpful? Give feedback.
-
In Orleans 9 AzureBlobStorage provider, the blobs are deleted from storage when you call ClearStateAsync. See here: |
Beta Was this translation helpful? Give feedback.
-
Thank you @dbinky. My point is that this behavior should be standardized over all the storage providers. In certain scenarios you want to delete everything about a Grain. And if the storage provider does not effectively delete all, you will suffer from a growing storage over time, which can lead to very bad situations. |
Beta Was this translation helpful? Give feedback.
-
@dbinky I understand your point, but in this case it would be better exposing two different APIs (methods) to choose the behavior. |
Beta Was this translation helpful? Give feedback.
-
@dbinky yes, exactly |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am not sure whether this use-case will fit with
ClearStateAsync
.I have a sort of workflow (represented by a grain) whose activities are also represented as grains. Since the workflow is long-running, each grain storage seems to fit the logic as it can persist its state and continue later on.
When the duty of a workflow activity is finished its state must be absorbed by the previous of following activities. This implies:
In other words, after the grain has finished its duties, its state is totally useless (and unusable) and should go away.
Once the workflow has finished, the final state will be written elsewhere, so I will need to delete its storage as well.
Is
ClearStateAsync
sufficient to avoid the storage growing over time?Beta Was this translation helpful? Give feedback.
All reactions