-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add ClearLogAsync method to JournaledGrain #9849
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR adds a ClearLogAsync method to JournaledGrain to enable complete erasure of stored grain data. This addresses a feature request (#8408) for a way to reset event-sourced grains to their initial state.
Key Changes:
- Added
ClearLogAsyncmethod to theJournaledGrainbase class andILogViewUpdateinterface - Implemented
ClearLogAsyncin StateStorage, LogStorage, and CustomStorage adaptors - Added backward-compatible default implementation to
ICustomStorageInterfaceusing C# default interface methods
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Orleans.EventSourcing/JournaledGrain.cs | Exposes protected ClearLogAsync method for grain subclasses |
| src/Orleans.EventSourcing/LogConsistency/ILogViewAdaptor.cs | Adds ClearLogAsync to the ILogViewUpdate interface |
| src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs | Implements clear logic for state storage backend |
| src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs | Implements clear logic for log storage backend |
| src/Orleans.EventSourcing/CustomStorage/LogViewAdaptor.cs | Implements clear logic for custom storage backend |
| src/Orleans.EventSourcing/CustomStorage/ICustomStorageInterface.cs | Adds default ClearStoredState method with NotSupportedException |
| src/Orleans.EventSourcing/Common/PrimaryBasedLogViewAdaptor.cs | Adds base implementation, ResetTentativeState helper, and caches initial state |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…com/m3nax/dotnet-orleans into feat/add-clearlog-to-journaledgrain
Added ClearLogAsync to the JournaledGrain in order to completely erase the stored data of the grain
Implemented the method in StateStorage and LogStorage
Added the method to be implemented in the ICustomStorageInterface interface with a default implementation in order to avoid breaking changes
REF: #8408
Microsoft Reviewers: Open in CodeFlow