Add a UnixFS `Directory` that hides implementation details and helps to
distinguish *what* is a UnixFS directory.
Replace the `unixfs.io.Directory` structure that contained the HAMT and basic
directory implementations (through inner pointers) with an interface containing
the same methods. Implement those methods in two clearly distinct structures for
each implementation (`BasicDirectory` and `HAMTDirectory`) avoiding pointer
logic and clearly differentiating which implementation does what.
The potential basic to HAMT transition was being hidden behind the `AddChild`
call at the UnixFS layer (changing one implementation pointer with the other
one), it is now being explicitly done at the MFS layer.
Rename the `dirbuilder.go` file to `directory.go` and change the `Directory` MFS
attribute `dirbuilder` to `unixfsDir` to be consistent.
License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
Keep the code style consistent. since all package alias are lowercase words, no need Camel Peak Name.
License: MIT
Signed-off-by: Spartucus <niubob@163.com>
Instead of checking if Routing is a DHT (because it can now be a tiered
router and still contain a DHT), stash the DHT in a separate field in the IPFS
node (same as we do with the PSRouter).
fixes#5197
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This makes use of the PersistentDatastore DiskUsage method to
obtain the Repo's storage usage (GetStorageUsage()).
Additionally, the --size-only flag has been added to the
"ipfs repo stat" command. This avoids counting the number of objects
in the repository and returns faster.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
Namesys returns `ErrResolveRecursion` when it stops recursing due to a depth
limit. It doesn't return success.
Alternative to #5199.
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
Focus on the UnixFS layer and avoid explicit references to protocol buffers
format (used to serialize objects of that layer). Use the `unixfs.FSNode`
structure which it abstracts from the `unixfs.pb.Data` format.
Replace `PBDagReader` field `ftpb.Data` with `ft.FSNode`, renaming it to `file`
(which is the type of UnixFS object represented in the reader) and changing its
comment removing the "cached" reference, as this structure is not used here as a
cache (`PBDagReader` doesn't modify the DAG, it's read-only). Also, removed
unused `ProtoNode` field to avoid confusions, as it would normally be present if
the `FSNode` was in fact used as a cache of the contents of the `ProtoNode`.
An example of the advantage of shifting the focus from the format to the UnixFS
layer is dropping the of use `len(pb.Blocksizes)` in favor of the more clear
`NumChildren()` abstraction.
Added `BlockSize()` accessor.
License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>