ipfs / js-ipfs-unixfs

JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)
Other
87 stars 34 forks source link

feat: add config option to control fanout size #356

Closed achingbrain closed 1 year ago

achingbrain commented 1 year ago

Adds a shardFanoutBytes option to the importer to allow configuring the number of bytes used for the HAMT prefix, also a test.

rvagg commented 1 year ago

Yeah, it shouldn't be "bytes". This is a typical problem with HAMT descriptions, we're dealing with different units and the UnixFS one makes it even harder by hex stringifying and then depending on the prefix length of the hex string!

rvagg commented 1 year ago

Made my suggested changes in #357 - going with "bits" - the nice thing about using bits is that you don't have to worry about divisibility. You can't really do a fanout that's not a power of 2, so start low and power up from the bit count.

achingbrain commented 1 year ago

It was bytes because the shard split threshold option next to it was bytes so it was a (flawed) attempt to keep the units consistent, but quite right bits is more correct. Thanks all.