Open schomatis opened 5 years ago
/cc @overbool (in case you're interested in continuing the work from https://github.com/ipfs/go-unixfs/pull/30, but feel free to ignore it otherwise)
@schomatis 👌
Information about how the max length or bitmap is used to check for sets needs to be present in the unixfs spec too https://github.com/ipfs/specs/pull/331.
Background: https://github.com/ipfs/boxo/issues/387.
To differentiate between nodes of the HAMT directory and nodes that represent an entry in that directory (but that don't belong to it) the links in the DAG layer are being overloaded with hash information of the trie, that is, the link name is being prefixed like
AFname
(<hash-part><actual-link-name>
); so the reader stumbles upon comparisons likelen(lnk.Name) == ds.maxpadlen
when trying to figure out if this links points to a node of the HAMT directory or a entry node (a value of the in the trie leaf). I don't think this can be changed at this moment since it would be a major API breakage, but the next best thing would be to extract every reference ofmaxpadlen
(and related) to functions that clearly and explicitly tell the reader "we are checking if this link points to a node inside or outside the HAMT directory" and "we want to extract the actual name of the link embedded inlnk.Name
attribute".