-
Notifications
You must be signed in to change notification settings - Fork 258
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): Add LinkedChunk::remove_item_at
#4173
feat(sdk): Add LinkedChunk::remove_item_at
#4173
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4173 +/- ##
==========================================
- Coverage 84.82% 84.82% -0.01%
==========================================
Files 269 269
Lines 28963 29007 +44
==========================================
+ Hits 24569 24605 +36
- Misses 4394 4402 +8 ☔ View full report in Codecov by Sentry. |
This patch adds the `LinkedChunk::remove_item_at` method, along with `Update::RemoveItem` variant.
This is only code move, nothing has changed.
This is a clean up patch, nothing fancy.
This is another clean up patch.
This patch fixes a bug in an optimisation inside `UpdateToVectorDiff` when an `Update::PushItems` is handled. It can sometimes create `VectorDiff::Append` instead of a `VectorDiff::Insert`. The tests will be part of the next patch.
…ateToVectorDiff`. This patch implements the support of `Update::RemoveItem` inside `UpdateToVectorDiff` to emit a `VectorDiff::Remove`.
e95830a
to
74283ea
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.
Looks good, thanks!
// can remove it. | ||
if can_unlink_chunk && chunk.is_first_chunk().not() { | ||
// Unlink `chunk`. | ||
chunk.unlink(&mut self.updates); |
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.
Looks like we should be able to share this logic with LinkedChunk::replace_gap_at
maybe?
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.
Okay, I note that on my todo list.
} | ||
|
||
// Remove the first item of the first chunk, 3 times. The chunk is empty after | ||
// that. The chunk is NOT removed because it's the first chunk. |
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 would prefer separate tests for each of these scenarios, but I'm not insisting on it.
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 was hesitant on this one, the balance is more code vs. more tests. I usually prefer small unit tests though. I note that on my to do list. Thanks for the feedback.
This patch should be reviewed commit-by-commit.
The idea is to implement
LinkedChunk::remove_item_at
, which removes an item at a specific position. This new feature propagates toUpdate
withUpdate::RemoveItem
and toUpdateToVectorDiff
which can emit aVectorDiff::Remove
.One bug has been found and fixed in
UpdateToVectorDiff
, which no impact on the SDK so far since this API is not yet used.EventCache
storage #3280