Skip to content

IndexedDB: Add (de)serialization functionality for EventCacheStore backend #5226

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

Merged

Conversation

mgoldenberg
Copy link
Contributor

Background

This pull request is part of a series of pull requests to add an IndexedDB implementation of the EventCacheStore (see #4617, #4996, #5090, #5138). This particular pull request provides (de)serialization functionality for the types defined in #5138.

Changes

This change add a few traits to aid in (de)serialization and implements those traits on a relevant types. Furthermore, there is a struct for conveniently calling into those (de)serialization traits - i.e., IndexeddbEventCacheStoreSerializer.

traits and impls

  • Indexed - converts high-level types to/from indexed types
    • impls:
      • ChunkIndexedChunk
      • EventIndexedEvent
      • GapIndexedGap
  • IndexedKey - encodes a key for an indexed type
    • impls:
      • Chunk
        • IndexedChunkIdKey
        • IndexedNextChunkIdKey
      • Event
        • IndexedEventIdKey
        • IndexedEventPositionKey
        • IndexedEventRelationKey
      • Gap
        • IndexedGapIdKey
  • IndexedKeyBounds - encodes the lower and upper keys for an indexed type
    • impls:
      • Chunk
        • IndexedChunkIdKey
        • IndexedNextChunkIdKey
      • Event
        • IndexedEventIdKey
        • IndexedEventPositionKey
        • IndexedEventRelationKey
      • Gap
        • IndexedGapIdKey

Future Work

  • Add convenient query functions that wrap (de)serialization logic
  • Add implementation of EventCacheStore which uses query functions mentioned above

  • Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg [email protected]

@mgoldenberg mgoldenberg requested a review from a team as a code owner June 12, 2025 18:14
@mgoldenberg mgoldenberg requested review from poljar and removed request for a team June 12, 2025 18:14
@mgoldenberg mgoldenberg changed the title IndexedDB: Add (de)serialization functionality to EventCacheStore backend IndexedDB: Add (de)serialization functionality for EventCacheStore backend Jun 12, 2025
@Hywan Hywan self-assigned this Jun 12, 2025
@Hywan Hywan requested review from Hywan and removed request for poljar June 12, 2025 19:03
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.

Hey, what great patches! Thanks for them. I've left a handful of questions. Apart from that, I'm happy to approve it and merge it!

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (47c8df0) to head (7d8c185).
Report is 10 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5226      +/-   ##
==========================================
- Coverage   90.18%   90.16%   -0.02%     
==========================================
  Files         334      334              
  Lines      104681   104681              
  Branches   104681   104681              
==========================================
- Hits        94402    94390      -12     
- Misses       6226     6238      +12     
  Partials     4053     4053              

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

@mgoldenberg mgoldenberg requested a review from Hywan June 18, 2025 14:14
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, thanks for the fixup patches! You can rebase your issue, and I'll merge it as soon as the CI is fixed (not your problem, the maintainers are fixing it).

@mgoldenberg mgoldenberg force-pushed the indexeddb-event-cache-store-serializer branch from 3bd8b6e to 728140f Compare June 18, 2025 16:21
@Hywan
Copy link
Member

Hywan commented Jun 19, 2025

Can you rebase on top of main to get the new code coverage infra please?

@mgoldenberg mgoldenberg force-pushed the indexeddb-event-cache-store-serializer branch from 728140f to 7d8c185 Compare June 19, 2025 15:01
@Hywan Hywan merged commit ec30e7b into matrix-org:main Jun 19, 2025
44 checks passed
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