@hsanjuan
Latest commit e0ef9c4 Jun 15, 2022 History
When automatically switching a BasicDirectory to a HAMTDirectory because it
grew too big, the current code:

* loops every link in the BasicDirectory
* reads each node referenced by those links
* adds the nodes to a new HAMTDirectory shard, which in turn:
  * writes the nodes to the DAG service (they were just read from there!)
  * makes a link out of them (identical to the link in the BasicDirectory!)

This would happen to about (~4000 nodes), which are fully read and written for nothing.

This PR adds a new SetLink method to the HAMT Shard which, instead of taking
an ipld.Node like Set(), takes directly an ipld.Link. Then it updates
switchToSharding() to pass the links in the BasicDirectory directy, rather
than reading all the nodes.

Note that switchToBasic() works like this already, only using the links in the
HAMT directory.
8 contributors

Users who have contributed to this file

@schomatis @hannahhoward @Stebalien @kevina @whyrusleeping @aschmahmann @marten-seemann @hsanjuan