-
Notifications
You must be signed in to change notification settings - Fork 254
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(linked chunk): add a way to reconstruct a linked chunk from its raw representation #4318
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4318 +/- ##
==========================================
+ Coverage 85.05% 85.07% +0.01%
==========================================
Files 275 276 +1
Lines 30309 30397 +88
==========================================
+ Hits 25780 25859 +79
- Misses 4529 4538 +9 ☔ View full report in Codecov by Sentry. |
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've left a lot of comments but (!) I like the strategy you've taken: I think it's a valid one!
I am hesitant to ask the modify the build()
method to run 2 phases:
- check data consistency,
- build the actual
LinkedChunk
I suppose you've merged the 2 phases in a single one for performance reason, but it makes it a bit more complex to understand. Not a big deal though. I wonder if it has any performance impact in reality, as we may not build huge LinkedChunk
, vs. having super clear and easy-to-understand code.
1215b8b
to
0504265
Compare
Alright, please take another look. I'm not super satisfied with the splitting of the building into two parts (you'll see that some checks are redundant, with some branches that can't be hit, because of this), but this is likely semi-temporary code anyways. The one thing I'm tempted to do is to get rid of all the error types and keep a single one "MalformedList", because the detail of what the error is only matters for the testing purposes… |
…raw representation
0504265
to
e8bfd38
Compare
What it says on the tin. Extracted from #4308, with extra testing and better error handling.
In particular, we must be careful that the passed set of chunks form a linked list, and not a looser kind of a graph.
Two things I'm not very sure about:
self.chunks
while constructing, ensureself.chunks
is empty after iterating), but an explicit pass might be more straightforward and clearer in its intent.Ends::last
is always set? It's not clear to me why it should be optional, since its users will either take it, or takefirst
when it's not set.