This avoids revisiting already-searched branches and cut down
the IsPinned() check times considerably when recursive pins
share big underlying DAGs.
A test has been added which double-checks that pinned and unpinned items
lookups respond as expected with shared branches.
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
Use fsrepo.IsInitialized to test for initialization instead of just
testing if the directory exists.
Also add test cases for '--init' option, including one the creates an
empty directory.
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
The new coreiface.Path maps a path to the cid.Cid
resulting from a full path resolution.
The path is internally represented as a go-ipfs/path.Path,
but that doesn't matter to the outside.
Apart from the path-to-CID mapping, it also aims to hold all
resolved segment CIDs of the path. Right now it only exposes
Root(), and only for flat paths a la /ipfs/Qmfoo. In other cases,
the root is nil.
In the future, resolution will internally use
go-ipfs/path.Resolver.ResolvePathComponents and thus always return
the proper resolved segments, via Root(), or a future Segments() func.
- Add coreiface.Path with Cid() and Root().
- Add CoreAPI.ResolvePath() for getting a coreiface.Path.
- All functions now expect and return coreiface.Path.
- Add ParsePath() and ParseCid() for constructing a coreiface.Path.
- Add coreiface.Node and Link which are simply go-ipld-node.Node and Link.
- Add CoreAPI.ResolveNode() for getting a Node from a Path.
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
To prevent put we need to have conclusive information if item is
contained in the repo, bloom filter won't give this information.
It only says if it is for sure not contained.
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
In workspace setups that have the source tree symlinked into GOPATH,
the `go list `command wouldn't recognize that we're technically within GOPATH,
because `pwd` doesn't look like it.
For example
/home/user/go/src/github.com/ipfs/go-ipfs
=> /home/user/go/ipfs/go-ipfs
produces the import path
_/home/user/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-random/random
which is not within GOPATH.
We get around this by using fully-qualified import paths instead:
starting in github.com/ipfs/go-ipfs/ instead of ./
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
It disables all outputs apart from the last hash.
Useful for adding directories as you won't have to do `| tail -1`
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
DRY up
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>