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>
This breaks commands like `ipfs update` that expect IPFS to *not* be running.
fixes#5191
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
Remove `Offset()` from the `DagReader` interface. It's not part of the Unix API
and it wasn't used anywhere except for the tests (a helper function was added to
replace it).
License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
The `Root` structure now explicitly contains a `Directory` (instead of an
`FSNode` interface), use that `Directory`'s `DAGService` instead of its own
`dserv` variable (which was used only once in `closeChild()`). The `DAGService`
in the `Root` and the `Directory` was the same (passed as an argument in the
`NewRoot` initializer function).
This leaves the `Root` structure with only a `Directory` and a `Republisher` and
allows to better rethink its role and whether if those two structures should be
grouped together (and if that group's name should be `Root`).
License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
Make `Root` value explicitly a `Directory` structure instead of the `FSNode`
interface (which also allowed the `File` type). This helps to make the code
easier to reason about: the root of an MFS layout is always a directory, not a
(single) file.
Rename `GetValue()` to `GetDirectory()` to also make it more explicit, the
renamed function now returns a `Directory` so there is no need for type
assertions that were previously done on the `FSNode` interface to check that it
was actually a `Directory`.
`NewRoot()` now doesn't allow to create `Root` structures from DAG nodes that
contain UnixFS files.
License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
Good: If a previous read is canceled, we cancel the preloads that the read
triggered.
Bad: Future reads at that point will fail.
This fixes that issue.
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
We can't currently put binary values due to API limitations. This worked before
because the DHT wasn't checking values on local put.
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
We need it to parse the dnsaddr addresses. While we import it elsewhere, we
should really be importing it every where we need it so that other users can
import our packages directly.
fixes#5143
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
Adds a --data-encoding flag to `ipfs object get` to let the user
specify base64 encoding for object data.
License: MIT
Signed-off-by: Alex Potsides <alex@achingbrain.net>
retry publishing with a longer EOL if the first attempt fails due to a timeout.
fixes#5099
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
They've never really been enabled but they:
1. Are causing the tests to fail for various reasons (e.g., out of space).
2. Take time.
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>