-
Notifications
You must be signed in to change notification settings - Fork 260
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(base) Implement RelationalLinkedChunk
#4298
feat(base) Implement RelationalLinkedChunk
#4298
Conversation
RelationalLinkedChunk
0a23400
to
0c9f681
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4298 +/- ##
==========================================
+ Coverage 85.09% 85.11% +0.01%
==========================================
Files 274 275 +1
Lines 30183 30280 +97
==========================================
+ Hits 25684 25772 +88
- Misses 4499 4508 +9 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
A `RelationalLinkedChunk` is like a `LinkedChunk` but with a relational layout, similar to what we would have in a database. This is used by memory stores. The idea is to have a data layout that is similar for memory stores and for relational database stores, to represent a `LinkedChunk`. This type is also designed to receive `Update`. Applying `Update`s directly on a `LinkedChunk` is not ideal and particularly not trivial as the `Update`s do _not_ match the internal data layout of the `LinkedChunk`, they have been designed for storages, like a relational database for example. This type is not as performant as `LinkedChunk` (in terms of memory layout, CPU caches etc.). It is only designed to be used in memory stores, which are mostly used for test purposes or light usages of the SDK.
0c9f681
to
f063296
Compare
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.
This code is likely wrong, given that the store method should include a reference to a RoomId
(sorry, should've caught that during review of the patch adding the trait method, but noticed the problem only while doing the implementation for the SQLite backend…).
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.
lgtm! minor comments so approving to avoid back-and-forth, and I've included some ideas for bigger improvements (a single inner lock for the memory store; tweak the signature of handle_linked_chunk_updates
) that can be done here or as follow-up PRs. Thanks!
This patch adds constructors for `Position` and `ChunkIdentifier` so that we keep their inner values private.
This patch creates a new `MemoryStoreInner` and moves all fields from `MemoryStore` into this new type. All locks are removed, but a new lock is added around `MemoryStoreInner`. That way we have a single lock.
a455751
to
0a6b093
Compare
…<Update>`. This patch updates `EventCacheStore::handle_linked_chunk_updates` to take a `Vec<Update<Item, Gap>>` instead of `&[Update<Item, Gap>]`. In fact, `linked_chunk::ObservableUpdates::take()` already returns a `Vec<Update<Item, Gap>>`; we can simply forward this `Vec` up to here without any further clones.
0a6b093
to
c788221
Compare
A book floating in space in front of a black hole.
A
RelationalLinkedChunk
is like aLinkedChunk
but with a relationallayout, similar to what we would have in a database.
This is used by memory stores. The idea is to have a data layout that
is similar for memory stores and for relational database stores, to
represent a
LinkedChunk
.This type is also designed to receive
Update
. ApplyingUpdate
sdirectly on a
LinkedChunk
is not ideal and particularly not trivialas the
Update
s do not match the internal data layout of theLinkedChunk
, they have been designed for storages, like a relationaldatabase for example.
This type is not as performant as
LinkedChunk
(in terms of memorylayout, CPU caches etc.). It is only designed to be used in memory
stores, which are mostly used for test purposes or light usages of the
SDK.
Must be merged after feat(base): AddEventCacheStore::handle_linked_chunk_updates
#4299 as it contains its commitsEventCache
storage #3280