Skip to content
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: Add MediaRetentionPolicy to the EventCacheStore, take 2 #4571

Merged
merged 14 commits into from
Jan 28, 2025

Conversation

zecakeh
Copy link
Collaborator

@zecakeh zecakeh commented Jan 22, 2025

Supercedes #3918. Since I needed to rework everything, I used a new branch.

I believe that I addressed all the comments on #3918. The API around MediaService was not clear to me so I came up with something that works.

It is now split into several commits that can be reviewed individually, in order.

  • Public API changes documented in changelogs (optional)

@zecakeh zecakeh requested a review from Hywan January 22, 2025 10:04
@zecakeh zecakeh requested a review from a team as a code owner January 22, 2025 10:04
@zecakeh zecakeh force-pushed the media-retention-policy branch 2 times, most recently from ff37e93 to 504a9d4 Compare January 22, 2025 10:10
@bnjbvr bnjbvr removed the request for review from a team January 22, 2025 10:20
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 94.36475% with 55 lines in your changes missing coverage. Please review.

Project coverage is 85.69%. Comparing base (31e7ec1) to head (c2f39c1).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...e/src/event_cache/store/media/integration_tests.rs 96.75% 21 Missing ⚠️
crates/matrix-sdk-sqlite/src/event_cache_store.rs 88.98% 13 Missing ⚠️
...rix-sdk-base/src/event_cache/store/memory_store.rs 88.88% 9 Missing ⚠️
...es/matrix-sdk-base/src/event_cache/store/traits.rs 28.57% 5 Missing ⚠️
crates/matrix-sdk/src/media.rs 25.00% 3 Missing ⚠️
...-base/src/event_cache/store/media/media_service.rs 95.55% 2 Missing ⚠️
crates/matrix-sdk/src/send_queue/upload.rs 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4571      +/-   ##
==========================================
+ Coverage   85.44%   85.69%   +0.24%     
==========================================
  Files         286      289       +3     
  Lines       32285    33208     +923     
==========================================
+ Hits        27587    28458     +871     
- Misses       4698     4750      +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zecakeh zecakeh force-pushed the media-retention-policy branch from 6835778 to 7c4c359 Compare January 22, 2025 10:55
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work 👏. It's definitely an improvement over #3918. I like the new design. Thank you!

I've left a couple of comments, but nothing big.

@zecakeh zecakeh requested a review from Hywan January 27, 2025 17:28
@@ -12,10 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Configuration to decide whether or not to keep media in the cache, allowing
//! to do periodic cleanups to avoid to have the size of the media cache grow
//! indefinitely.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation how to run a clean up, or when it is done if done automatically, would be particularly helpful!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added instructions for this and a sentence about automatic periodic cleanups.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good to me! Please, consider my last comment about the documentation, and we are good.

Can you rebase your patches (not into a single patch, but fixup commits into their respective patches)? After that, I'll merge your PR.

This will be used as a configuration to decide whether or not to keep
media in the cache, allowing to do periodic cleanups to avoid to have
the size of the media cache grow indefinitely.

Signed-off-by: Kévin Commaille <[email protected]>
This is an API to handle the MediaRetentionPolicy with a lower level
EventCacheStoreMedia trait.

Signed-off-by: Kévin Commaille <[email protected]>
It is already a 3-tuple and we want to add more data so it will be clearer to use a stuct with named fields.

Signed-off-by: Kévin Commaille <[email protected]>
@zecakeh zecakeh force-pushed the media-retention-policy branch from 309520b to 0334ff3 Compare January 28, 2025 14:45
@zecakeh
Copy link
Collaborator Author

zecakeh commented Jan 28, 2025

I merged main in this branch to solve a conflict. Maybe you would prefer a rebase?

@Hywan
Copy link
Member

Hywan commented Jan 28, 2025

Github tells me:

This branch cannot be rebased due to conflicts

Can you try resolve these conflicts please?

@zecakeh
Copy link
Collaborator Author

zecakeh commented Jan 28, 2025

It didn't say anything to me, but I merged main again just to be sure. I didn't encounter any conflict.

@Hywan Hywan merged commit 33d691a into matrix-org:main Jan 28, 2025
40 checks passed
@Hywan
Copy link
Member

Hywan commented Jan 28, 2025

The new UI was disturbing me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants