ipfs / ipfs/boxo

ipld/unixfs/hamt: Encapsulate and document `maxpadlen` logic

Open
#388 3 comments 0 reactions 0 assignees View on GitHub
help wanted status/deferred
Dominant language
Go
Stars
316
Forks
163
Avg merge
4d 12h
Merged PRs (30d)
8

Description

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` (``); so the reader stumbles upon comparisons like `len(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 of `maxpadlen` (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 in `lnk.Name` attribute".

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.