-
Notifications
You must be signed in to change notification settings - Fork 270
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
feat(event cache): add a way to clear all chunks, clear a room's chunks + FFI feature flag #4396
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4396 +/- ##
==========================================
+ Coverage 85.20% 85.22% +0.01%
==========================================
Files 281 281
Lines 30963 30990 +27
==========================================
+ Hits 26383 26410 +27
Misses 4580 4580 ☔ View full report in Codecov by Sentry. |
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.
Winter clean up.
@@ -624,6 +645,21 @@ impl ClientBuilder { | |||
|
|||
let sdk_client = inner_builder.build().await?; | |||
|
|||
if let Some(val) = builder.use_event_cache_persistent_storage { | |||
if val { | |||
// Enable the persistent storage \o/ |
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.
\o/
…wkward By default, the event cache store will be disabled. If disabled, it will clean all the events in the cache store; most of the time this will do nothing, since the store will not even be filled with any event data, so it would be cheap to do. If some data was filled in the cache store before, then it would be cleared after the cache store has been disabled. This makes a less awkward API than the previous one, where `None` and `Some(false)` carried different semantics.
8b05176
to
d6c8867
Compare
As discussed in private, the last commit changes the semantics so that the feature flag is not optional, and always set to false. It makes it less awkward when used by consumers. (See commit message for details.) |
This adds a way to:
ClientBuilder
to enable or disable persistent storage. Note: after persistent storage has been enabled, if the embedder decides to disable it, they must explicitly set it tofalse
the next time; otherwise the on-disk storage isn't cleared.The last item isn't very satisfying, but I don't see how to do it otherwise without more involved refactorings. The way persistent storage works right now, is by checking the presence of an event cache store reference in the
RoomEventCacheState
data structure. This is filled at most once, and only once, and never cleared (it's not even clearable). As such, a restart is required for disabling the persistent storage; after restarting is the right time to clear a previous on-disk persisted storage. If we do it sooner than that, then the liveRoomEventCacheState
may keep on trying to store new updates…Part of #3280.