Commit 288fddd
committed
ipld/unixfs/io: better initialization and options for Directories
WithMaxWidth()
--------------
The new option sets effectively a maximum width to the
directories.
Currently, on a dynamic directory, the switching to-from Basic to HAMT is
controlled by HAMTShardingSize, and the width of the HAMT shards by DefaultShardWidth.
When WithMaxLinks() is specified, the switching is additionally controlled by
the number of links exceeding the limit. In that case, MaxLinks is used as ShardWidth.
The directory can only be converted back to BasicDirectory when the total
number of links is below the limit.
Backwards compatibility is kept and tests have been added.
Note that when setting MaxLinks to a high number, it is possible that we still
suffer automatic conversion to HAMT before hitting MaxLinks, if the estimated
directory size is above 256KiB (as before).
WithStat()
----------
Allows to set Stat on a new directory.
WithCidBuilder()
---------------
Allows to set the CidBuilder on a new directory.1 parent 23dacad commit 288fddd
3 files changed
+374
-71
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
0 commit comments