-
Notifications
You must be signed in to change notification settings - Fork 187
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
feature: implement hamt writing #603
Conversation
70b39d0
to
260c0c0
Compare
260c0c0
to
b0f3007
Compare
The real fix is of course to make this a streaming request... But that will come later.
124143a
to
64331d6
Compare
# Conflicts: # iroh-unixfs/src/builder.rs
stream! { | ||
while let Some(block) = blocks.next().await { | ||
let block = block?; | ||
let block_size = block.data().len() as u64; | ||
let block_size = block.data().len() as u64 + block.links().len() as u64 * 128; |
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.
@dignifiedquire this is the temp fix for not having blocks that are too large, until we implement https://github.com/n0-computer/iroh/issues/594
I could not find an actual collision, so I just added twice the exact same name for a test, which currently has the same effect.
pub fn encode<'a>(self) -> LocalBoxStream<'a, Result<Block>> { | ||
match self { | ||
Self::Branch(tree) => { | ||
async_stream::try_stream! { |
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 reads quite sane, great job.
* feature: implement hamt writing * fix: consider link size when sending data The real fix is of course to make this a streaming request... But that will come later. * test: add test for a truly large directory * refactor: cleanup * refactor: properly handle hash collisions I could not find an actual collision, so I just added twice the exact same name for a test, which currently has the same effect.
This provides basic hamt writing. You can add a big directory, get it back, and look at it from the gateway.
Go-ipfs interop has been tried for one large dir and works.
I have manually added both large non hamt dirs and large hamt dirs and looked at them in the gw.