-
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(sdk): Introduce LinkedChunkUpdate
#3281
Conversation
6453764
to
abe2206
Compare
665eca2
to
20398ea
Compare
This patch changes the signature of `LinkedChunk<Item, Gap, const CHUNK_CAPACITY = usize>` to `LinkedChunk<const CHUNK_CAPACITY = usize, Item, Gap>`. It allows to add more generic parameters if needed, without conflicting with generic constants.
20398ea
to
93b6134
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.
I'm not a big fan of async
+ Result
infecting the whole linked chunk API, could we find another way that would help separate concerns and result in a more robust design, please?
93b6134
to
88bde57
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3281 +/- ##
==========================================
- Coverage 83.65% 83.31% -0.35%
==========================================
Files 242 242
Lines 25012 25160 +148
==========================================
+ Hits 20924 20962 +38
- Misses 4088 4198 +110 ☔ View full report in Codecov by Sentry. |
88bde57
to
10e2fbd
Compare
LinkedChunkListener
LinkedChunkUpdate
cbc4e89
to
ae6f23a
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.
Looking great! Small request to make the update_history
optional, and can you also clean the PR history before merging, please? Thanks!
1ed1c1a
to
2b6c4db
Compare
This patch creates the `LinkedChunkListener` trait. This patch also updates `LinkedChunk` to be able to use a `LinkedChunkListener`.
This patch is a turn around about the `LinkedChunkListener`. Many patches have been removed because `LinkedChunkListener` needed to support I/O, so errors and async code. The whole code was affected by that, resulting in a complex API. The idea of this patch is to decoupled this. Here is how. First off, `LinkedChunkListener` is removed. So it's one less generic parameter on `LinkedChunk`. It's also one less trait, so less implementations. Second, now `LinkedChunk` accumulates/collects all “updates” under the form of a new enum `LinkedChunkUpdate`. These updates can be read with `LinkedChunk::updates(&mut self) -> &Vec<LinkedChunkUpdate>`. The reader can simply read them, or even drain them. The reader is responsible to handle these updates and to dispatch them in a storage or whatever. `LinkedChunk` is no longer responsible to do that, removing the need to support errors and to be async. Third, the simplification has led to an optimisation by introducing a new type `LinkedChunkLinks`. The documentation explains what it does and why it was needed. The benefit of this type is: it doesn't increase the size of `LinkedChunk`, but it simplifies the code: no more `Arc`, no more `Mutex` (it was required because with I/O and async), no more borrow checker trick, and the code stays as safe as before.
This patch makes the `LinkedChunk::update_history` field optional, so that it doesn't require the user to drain it to avoid eating the universe. The `new` constructor disabled the update history, the `new_with_update_history` enables it.
2b6c4db
to
443647a
Compare
This patch introduces
LinkedChunkUpdate
andLinkedChunk::updates(&mut self) -> &mut Vec<LinkedChunkUpdate>
. It's a new mechanism that is used byLinkedChunk
in order to get a list of all updates that happened in aLinkedChunk
. This is the fundamental piece to write a persistent storage forLinkedChunk
, and thus forEventCache
, see #3280 to learn more.EventCache
storage #3280