-
Notifications
You must be signed in to change notification settings - Fork 0
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
Push & Pull protocol unit test #24
Conversation
Co-authored-by: James Walker <[email protected]>
Also: - Put `CarFile` bytes into a newtype - Abstract out push&pull protocol parts into `common` - Abstract out test utilities
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.
First off, huge kudos to you for diving into the intricacies of the car-mirror protocol and coming up with a great unit test! 🚀 I can see the effort and attention to detail that went into addressing the push & pull mechanisms, especially considering the nuances of state management.
That said, I have some questions and some nitpicks.
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! 🎉
Oh snap! Merged it by mistake. |
All good, wanted to merge it anyways |
This PR implements a unit test that pushes a random DAG from one
MemoryBlockStore
to another via CAR files.Closes #16
Closes #17
Closes #18
It doesn't really do #19, because in this version, CAR mirror is treated as mostly stateless.
The only state that needs to be kept is client-side, and it's the most recent response that it got from the server (so it knows what else remains to be sent or whether the protocol is done).
And (in this version) the server side is always completely stateless.
Should this become a performance issue, then we can easily add a bunch of memoization caches.
Some ideas for such caches:
Cid -> Vec<Cid>
, instead of having to fetch the block everytime & recompute links.Cid -> Vec<Cid>
, but this time with all transitive references. Storing the whole transitive closure is going to be faster, but also requires a quadratic amount of memory in the depth of the DAG, if done for every block.Cid -> Bloom
. This one is neater, but also needs more thought, since it's likely the bloom will be the wrong size. Before we do this, we should probably do other versions first and see how memory-hungry they are.