Implementation of UnloadStateAsync#1750
Conversation
Implementation of UnloadStateAsyc (dapr#1728) Signed-off-by: Oliver Tomlinson <oliverjamestomlinson@gmail.com>
| /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> | ||
| /// <returns>A task that represents the asynchronous unload operation.</returns> | ||
| /// <exception cref="InvalidOperationException">Thrown if the state is modified and not yet persisted, unless allowed by options.</exception> | ||
| Task UnloadStateAsync(string stateName, UnloadStateOptions options = null, CancellationToken cancellationToken = default); |
There was a problem hiding this comment.
consider adding as a default interface method with a NotImplementedException / virtual behavior.
There was a problem hiding this comment.
In this scenario, adding a default interface method to throw NotSupportedException isn't a meaningful inclusion because we already provide the concrete type implementing this interface ourselves, and this will ship with same-day support.
Especially as this project doesn't support dependency injection, I would not expect that developers have implemented their own types on this interface, modified the library to use them instead, update the package and see this new method on the interface and call it in their applications just to see a TypeLoadException because they didn't implement the method themselves - I just don't think that's likely. I wouldn't have expected them to wrap every actor invocation in a try/catch block either, so this would just shift throwing a TypeLoadException to an NotSupportedException - not a meaningful change here.
| @@ -0,0 +1,14 @@ | |||
| // Options for UnloadStateAsync operation | |||
Description
Adds an
UnloadStateAsync()method to the Actor StateManager, so that state can be removed from the cache, without being removed from diskIssue reference
#1728
Please reference the issue this PR will close: #[1728]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: