Extract path and resolver
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jul 28, 2018 at 23:57 UTC
ede2caba468baff344052181c644682689a20c82
54 files changed
+64
-593
core/builder.go
+1
-1
@@ -10,7 +10,6 @@ import (
10
"time"
11
12
filestore "github.com/ipfs/go-ipfs/filestore"
13
- resolver "github.com/ipfs/go-ipfs/path/resolver"
13
pin "github.com/ipfs/go-ipfs/pin"
14
repo "github.com/ipfs/go-ipfs/repo"
15
cfg "github.com/ipfs/go-ipfs/repo/config"
@@ -18,6 +17,7 @@ import (
17
uio "github.com/ipfs/go-ipfs/unixfs/io"
18
bserv "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
19
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
20
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
21
22
offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
23
goprocessctx "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess/context"
core/commands/dag/dag.go
+1
-1
@@ -10,8 +10,8 @@ import (
10
cmds "github.com/ipfs/go-ipfs/commands"
11
e "github.com/ipfs/go-ipfs/core/commands/e"
12
coredag "github.com/ipfs/go-ipfs/core/coredag"
13
- path "github.com/ipfs/go-ipfs/path"
13
pin "github.com/ipfs/go-ipfs/pin"
14
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
15
16
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
17
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
core/commands/dht.go
+1
-1
@@ -10,8 +10,8 @@ import (
10
11
cmds "github.com/ipfs/go-ipfs/commands"
12
e "github.com/ipfs/go-ipfs/core/commands/e"
13
- path "github.com/ipfs/go-ipfs/path"
13
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
14
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
15
16
b58 "gx/ipfs/QmWFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY/go-base58-fast/base58"
17
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
core/commands/files.go
+2
-2
@@ -16,12 +16,12 @@ import (
16
core "github.com/ipfs/go-ipfs/core"
17
e "github.com/ipfs/go-ipfs/core/commands/e"
18
mfs "github.com/ipfs/go-ipfs/mfs"
19
- path "github.com/ipfs/go-ipfs/path"
20
- resolver "github.com/ipfs/go-ipfs/path/resolver"
19
ft "github.com/ipfs/go-ipfs/unixfs"
20
uio "github.com/ipfs/go-ipfs/unixfs/io"
21
bservice "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
22
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
23
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
24
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
25
26
cmds "gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
27
humanize "gx/ipfs/QmPSBJL4momYnE7DcUyk2DVhD6rH488ZmHBGLbxNdhU44K/go-humanize"
core/commands/get.go
+1
-1
@@ -11,9 +11,9 @@ import (
11
12
core "github.com/ipfs/go-ipfs/core"
13
e "github.com/ipfs/go-ipfs/core/commands/e"
14
- path "github.com/ipfs/go-ipfs/path"
14
uarchive "github.com/ipfs/go-ipfs/unixfs/archive"
15
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
16
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
17
18
"gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
19
"gx/ipfs/QmPtj12fdwuAqj9sBSTNUxBNu8kCGNp8b3o8yUzMm5GHpq/pb"
core/commands/ls.go
+2
-2
@@ -9,13 +9,13 @@ import (
9
cmds "github.com/ipfs/go-ipfs/commands"
10
core "github.com/ipfs/go-ipfs/core"
11
e "github.com/ipfs/go-ipfs/core/commands/e"
12
- path "github.com/ipfs/go-ipfs/path"
13
- resolver "github.com/ipfs/go-ipfs/path/resolver"
12
unixfs "github.com/ipfs/go-ipfs/unixfs"
13
uio "github.com/ipfs/go-ipfs/unixfs/io"
14
unixfspb "github.com/ipfs/go-ipfs/unixfs/pb"
15
blockservice "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
16
merkledag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
17
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
18
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
19
20
offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
21
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
core/commands/object/diff.go
+1
-1
@@ -9,7 +9,7 @@ import (
9
core "github.com/ipfs/go-ipfs/core"
10
e "github.com/ipfs/go-ipfs/core/commands/e"
11
"github.com/ipfs/go-ipfs/dagutils"
12
- path "github.com/ipfs/go-ipfs/path"
12
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
13
cmdkit "gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
14
)
15
core/commands/object/object.go
+1
-1
@@ -17,10 +17,10 @@ import (
17
lgc "github.com/ipfs/go-ipfs/commands/legacy"
18
core "github.com/ipfs/go-ipfs/core"
19
e "github.com/ipfs/go-ipfs/core/commands/e"
20
- path "github.com/ipfs/go-ipfs/path"
20
pin "github.com/ipfs/go-ipfs/pin"
21
ft "github.com/ipfs/go-ipfs/unixfs"
22
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
23
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
24
25
cmds "gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
26
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
core/commands/object/patch.go
+1
-1
@@ -11,9 +11,9 @@ import (
11
core "github.com/ipfs/go-ipfs/core"
12
e "github.com/ipfs/go-ipfs/core/commands/e"
13
"github.com/ipfs/go-ipfs/dagutils"
14
- path "github.com/ipfs/go-ipfs/path"
14
ft "github.com/ipfs/go-ipfs/unixfs"
15
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
16
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
17
18
cmds "gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
19
logging "gx/ipfs/QmcVVHfdyv15GVPk7NrxdWjh2hLVccXnoD8j2tyQShiXJb/go-log"
core/commands/pin.go
+2
-2
@@ -11,12 +11,12 @@ import (
11
core "github.com/ipfs/go-ipfs/core"
12
e "github.com/ipfs/go-ipfs/core/commands/e"
13
corerepo "github.com/ipfs/go-ipfs/core/corerepo"
14
- path "github.com/ipfs/go-ipfs/path"
15
- resolver "github.com/ipfs/go-ipfs/path/resolver"
14
pin "github.com/ipfs/go-ipfs/pin"
15
uio "github.com/ipfs/go-ipfs/unixfs/io"
16
bserv "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
17
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
18
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
19
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
20
21
u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
22
"gx/ipfs/QmQwgv79RHrRnoXmhnpC1BPtY55HHeneGMpPwmmBU1fUAG/go-verifcid"
core/commands/publish.go
+1
-1
@@ -12,7 +12,7 @@ import (
12
core "github.com/ipfs/go-ipfs/core"
13
e "github.com/ipfs/go-ipfs/core/commands/e"
14
keystore "github.com/ipfs/go-ipfs/keystore"
15
- path "github.com/ipfs/go-ipfs/path"
15
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
16
17
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
18
peer "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer"
core/commands/refs.go
+1
-1
@@ -10,7 +10,7 @@ import (
10
cmds "github.com/ipfs/go-ipfs/commands"
11
"github.com/ipfs/go-ipfs/core"
12
e "github.com/ipfs/go-ipfs/core/commands/e"
13
- path "github.com/ipfs/go-ipfs/path"
13
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
14
15
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
16
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
core/commands/resolve.go
+1
-1
@@ -11,7 +11,7 @@ import (
11
e "github.com/ipfs/go-ipfs/core/commands/e"
12
ns "github.com/ipfs/go-ipfs/namesys"
13
nsopts "github.com/ipfs/go-ipfs/namesys/opts"
14
- path "github.com/ipfs/go-ipfs/path"
14
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
15
16
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
17
)
core/commands/tar.go
+1
-1
@@ -8,9 +8,9 @@ import (
8
core "github.com/ipfs/go-ipfs/core"
9
e "github.com/ipfs/go-ipfs/core/commands/e"
10
"github.com/ipfs/go-ipfs/core/coreunix"
11
- path "github.com/ipfs/go-ipfs/path"
11
tar "github.com/ipfs/go-ipfs/tar"
12
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
13
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
14
15
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
16
)
core/commands/unixfs/ls.go
+2
-2
@@ -12,12 +12,12 @@ import (
12
cmds "github.com/ipfs/go-ipfs/commands"
13
core "github.com/ipfs/go-ipfs/core"
14
e "github.com/ipfs/go-ipfs/core/commands/e"
15
- path "github.com/ipfs/go-ipfs/path"
16
- resolver "github.com/ipfs/go-ipfs/path/resolver"
15
unixfs "github.com/ipfs/go-ipfs/unixfs"
16
uio "github.com/ipfs/go-ipfs/unixfs/io"
17
unixfspb "github.com/ipfs/go-ipfs/unixfs/pb"
18
merkledag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
19
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
20
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
21
)
22
23
type LsLink struct {
core/core.go
+1
-1
@@ -27,7 +27,6 @@ import (
27
namesys "github.com/ipfs/go-ipfs/namesys"
28
ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher"
29
p2p "github.com/ipfs/go-ipfs/p2p"
30
- "github.com/ipfs/go-ipfs/path/resolver"
30
pin "github.com/ipfs/go-ipfs/pin"
31
repo "github.com/ipfs/go-ipfs/repo"
32
config "github.com/ipfs/go-ipfs/repo/config"
@@ -36,6 +35,7 @@ import (
35
merkledag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
36
bitswap "gx/ipfs/QmSLYFS88MpPsszqWdhGSxvHyoTnmaU4A74SD6KGib6Z3m/go-bitswap"
37
bsnet "gx/ipfs/QmSLYFS88MpPsszqWdhGSxvHyoTnmaU4A74SD6KGib6Z3m/go-bitswap/network"
38
+ "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
39
40
u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
41
rhelpers "gx/ipfs/QmQpvpeXa8rBfDmt3bdh2ckw2867vsYN1ozf79X7U5rij9/go-libp2p-routing-helpers"
core/coreapi/interface/path.go
+1
-1
@@ -1,7 +1,7 @@
1
package iface
2
3
import (
4
- ipfspath "github.com/ipfs/go-ipfs/path"
4
+ ipfspath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
5
6
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
7
)
core/coreapi/key.go
+1
-1
@@ -8,7 +8,7 @@ import (
8
9
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
10
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
11
- ipfspath "github.com/ipfs/go-ipfs/path"
11
+ ipfspath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
12
13
peer "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer"
14
crypto "gx/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5/go-libp2p-crypto"
core/coreapi/name.go
+1
-1
@@ -13,7 +13,7 @@ import (
13
keystore "github.com/ipfs/go-ipfs/keystore"
14
namesys "github.com/ipfs/go-ipfs/namesys"
15
nsopts "github.com/ipfs/go-ipfs/namesys/opts"
16
- ipath "github.com/ipfs/go-ipfs/path"
16
+ ipath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
17
18
offline "gx/ipfs/QmbFRJeEmEU16y3BmKKaD4a9fm5oHsEAMHe2vSB1UnfLMi/go-ipfs-routing/offline"
19
peer "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer"
core/coreapi/name_test.go
+1
-1
@@ -7,7 +7,7 @@ import (
7
"testing"
8
"time"
9
10
- ipath "github.com/ipfs/go-ipfs/path"
10
+ ipath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
11
12
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
13
opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
core/coreapi/path.go
+2
-2
@@ -8,9 +8,9 @@ import (
8
core "github.com/ipfs/go-ipfs/core"
9
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
10
namesys "github.com/ipfs/go-ipfs/namesys"
11
- ipfspath "github.com/ipfs/go-ipfs/path"
12
- resolver "github.com/ipfs/go-ipfs/path/resolver"
11
uio "github.com/ipfs/go-ipfs/unixfs/io"
12
+ ipfspath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
13
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
14
15
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
16
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
core/corehttp/commands.go
+1
-1
@@ -12,8 +12,8 @@ import (
12
oldcmds "github.com/ipfs/go-ipfs/commands"
13
core "github.com/ipfs/go-ipfs/core"
14
corecommands "github.com/ipfs/go-ipfs/core/commands"
15
- path "github.com/ipfs/go-ipfs/path"
15
config "github.com/ipfs/go-ipfs/repo/config"
16
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
17
18
cmds "gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
19
cmdsHttp "gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds/http"
core/corehttp/gateway_handler.go
+2
-2
@@ -16,11 +16,11 @@ import (
16
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
17
"github.com/ipfs/go-ipfs/dagutils"
18
"github.com/ipfs/go-ipfs/importer"
19
- path "github.com/ipfs/go-ipfs/path"
20
- resolver "github.com/ipfs/go-ipfs/path/resolver"
19
ft "github.com/ipfs/go-ipfs/unixfs"
20
uio "github.com/ipfs/go-ipfs/unixfs/io"
21
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
22
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
23
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
24
25
humanize "gx/ipfs/QmPSBJL4momYnE7DcUyk2DVhD6rH488ZmHBGLbxNdhU44K/go-humanize"
26
chunker "gx/ipfs/QmVDjhUMtkRskBFAVNwyXuLSKbeAya7JKPnzAxMKDaK4x4/go-ipfs-chunker"
core/corehttp/gateway_test.go
+1
-1
@@ -15,10 +15,10 @@ import (
15
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
16
namesys "github.com/ipfs/go-ipfs/namesys"
17
nsopts "github.com/ipfs/go-ipfs/namesys/opts"
18
- path "github.com/ipfs/go-ipfs/path"
18
repo "github.com/ipfs/go-ipfs/repo"
19
config "github.com/ipfs/go-ipfs/repo/config"
20
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
21
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
22
23
id "gx/ipfs/QmY51bqSM5XgxQZqsBrQcRkKTnCb8EKpJpR9K6Qax7Njco/go-libp2p/p2p/protocol/identify"
24
ci "gx/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5/go-libp2p-crypto"
core/corerepo/pinning.go
+2
-2
@@ -18,9 +18,9 @@ import (
18
"fmt"
19
20
"github.com/ipfs/go-ipfs/core"
21
- path "github.com/ipfs/go-ipfs/path"
22
- resolver "github.com/ipfs/go-ipfs/path/resolver"
21
uio "github.com/ipfs/go-ipfs/unixfs/io"
22
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
23
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
24
25
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
26
)
core/coreunix/cat.go
+2
-2
@@ -4,9 +4,9 @@ import (
4
"context"
5
6
core "github.com/ipfs/go-ipfs/core"
7
- path "github.com/ipfs/go-ipfs/path"
8
- resolver "github.com/ipfs/go-ipfs/path/resolver"
7
uio "github.com/ipfs/go-ipfs/unixfs/io"
8
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
9
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
10
)
11
12
func Cat(ctx context.Context, n *core.IpfsNode, pstr string) (uio.DagReader, error) {
core/pathresolver.go
+2
-2
@@ -6,8 +6,8 @@ import (
6
"strings"
7
8
namesys "github.com/ipfs/go-ipfs/namesys"
9
- path "github.com/ipfs/go-ipfs/path"
10
- resolver "github.com/ipfs/go-ipfs/path/resolver"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
+ resolver "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path/resolver"
11
12
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
13
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
core/pathresolver_test.go
+1
-1
@@ -5,7 +5,7 @@ import (
5
6
core "github.com/ipfs/go-ipfs/core"
7
coremock "github.com/ipfs/go-ipfs/core/mock"
8
- path "github.com/ipfs/go-ipfs/path"
8
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
9
)
10
11
func TestResolveNoComponents(t *testing.T) {
dagutils/utils.go
+1
-1
@@ -4,9 +4,9 @@ import (
4
"context"
5
"errors"
6
7
- path "github.com/ipfs/go-ipfs/path"
7
bserv "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
8
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
12
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
dagutils/utils_test.go
+1
-1
@@ -4,9 +4,9 @@ import (
4
"context"
5
"testing"
6
7
- path "github.com/ipfs/go-ipfs/path"
7
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
8
mdtest "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag/test"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
12
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
fuse/ipns/common.go
+1
-1
@@ -5,8 +5,8 @@ import (
5
6
"github.com/ipfs/go-ipfs/core"
7
nsys "github.com/ipfs/go-ipfs/namesys"
8
- path "github.com/ipfs/go-ipfs/path"
8
ft "github.com/ipfs/go-ipfs/unixfs"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
ci "gx/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5/go-libp2p-crypto"
11
)
12
fuse/ipns/ipns_unix.go
+1
-1
@@ -14,9 +14,9 @@ import (
14
core "github.com/ipfs/go-ipfs/core"
15
mfs "github.com/ipfs/go-ipfs/mfs"
16
namesys "github.com/ipfs/go-ipfs/namesys"
17
- path "github.com/ipfs/go-ipfs/path"
17
ft "github.com/ipfs/go-ipfs/unixfs"
18
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
19
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
20
21
fuse "gx/ipfs/QmSJBsmLP1XMjv8hxYg2rUMdPDB7YUpyBo9idjrJ6Cmq6F/fuse"
22
fs "gx/ipfs/QmSJBsmLP1XMjv8hxYg2rUMdPDB7YUpyBo9idjrJ6Cmq6F/fuse/fs"
fuse/readonly/readonly_unix.go
+1
-1
@@ -11,10 +11,10 @@ import (
11
"syscall"
12
13
core "github.com/ipfs/go-ipfs/core"
14
- path "github.com/ipfs/go-ipfs/path"
14
uio "github.com/ipfs/go-ipfs/unixfs/io"
15
ftpb "github.com/ipfs/go-ipfs/unixfs/pb"
16
mdag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
17
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
18
19
lgbl "gx/ipfs/QmRPkGkHLB72caXgdDYnoaWigXNWx95BcYDKV1n3KTEpaG/go-libp2p-loggables"
20
fuse "gx/ipfs/QmSJBsmLP1XMjv8hxYg2rUMdPDB7YUpyBo9idjrJ6Cmq6F/fuse"
mfs/mfs_test.go
+1
-1
@@ -15,11 +15,11 @@ import (
15
"time"
16
17
importer "github.com/ipfs/go-ipfs/importer"
18
- "github.com/ipfs/go-ipfs/path"
18
ft "github.com/ipfs/go-ipfs/unixfs"
19
uio "github.com/ipfs/go-ipfs/unixfs/io"
20
bserv "gx/ipfs/QmNqRBAhovtf4jVd5cF7YvHaFSsQHHZBaUFwGQWPM2CV7R/go-blockservice"
21
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
22
+ "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
23
24
u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
25
offline "gx/ipfs/QmS6mo1dPpHdYsVkm27BRZDLxpKBCiJKUH8fHX15XFfMez/go-ipfs-exchange-offline"
mfs/ops.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
gopath "path"
7
"strings"
8
9
- path "github.com/ipfs/go-ipfs/path"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
12
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
namesys/base.go
+1
-1
@@ -7,7 +7,7 @@ import (
7
context "context"
8
9
opts "github.com/ipfs/go-ipfs/namesys/opts"
10
- path "github.com/ipfs/go-ipfs/path"
10
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
11
)
12
13
type resolver interface {
namesys/cache.go
+1
-1
@@ -3,7 +3,7 @@ package namesys
3
import (
4
"time"
5
6
- path "github.com/ipfs/go-ipfs/path"
6
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
7
)
8
9
func (ns *mpns) cacheGet(name string) (path.Path, bool) {
namesys/dns.go
+1
-1
@@ -8,7 +8,7 @@ import (
8
"time"
9
10
opts "github.com/ipfs/go-ipfs/namesys/opts"
11
- path "github.com/ipfs/go-ipfs/path"
11
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
12
isd "gx/ipfs/QmZmmuAXgX73UQmX1jRKjTGmjzq24Jinqkq8vzkBtno4uX/go-is-domain"
13
)
14
namesys/interface.go
+1
-1
@@ -36,7 +36,7 @@ import (
36
context "context"
37
38
opts "github.com/ipfs/go-ipfs/namesys/opts"
39
- path "github.com/ipfs/go-ipfs/path"
39
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
40
41
ci "gx/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5/go-libp2p-crypto"
42
)
namesys/ipns_resolver_validation_test.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
"time"
7
8
opts "github.com/ipfs/go-ipfs/namesys/opts"
9
- path "github.com/ipfs/go-ipfs/path"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
u "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
12
record "gx/ipfs/QmVsp2KdPYE6M8ryzCk5KHLo3zprcY5hBDaYx6uPCFUdxA/go-libp2p-record"
namesys/namesys.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
"time"
7
8
opts "github.com/ipfs/go-ipfs/namesys/opts"
9
- path "github.com/ipfs/go-ipfs/path"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
12
lru "gx/ipfs/QmVYxfoJQiZijTgPNHCHgHELvQpbsJNTg6Crmc3dQkj3yy/golang-lru"
namesys/namesys_test.go
+1
-1
@@ -7,8 +7,8 @@ import (
7
"time"
8
9
opts "github.com/ipfs/go-ipfs/namesys/opts"
10
- path "github.com/ipfs/go-ipfs/path"
10
"github.com/ipfs/go-ipfs/unixfs"
11
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
12
13
pstore "gx/ipfs/QmZR2XWVVBCtbgBWnQhWk2xcQfaR3W8faQPriAiaaj7rsr/go-libp2p-peerstore"
14
offroute "gx/ipfs/QmbFRJeEmEU16y3BmKKaD4a9fm5oHsEAMHe2vSB1UnfLMi/go-ipfs-routing/offline"
namesys/proquint.go
+1
-1
@@ -7,7 +7,7 @@ import (
7
context "context"
8
9
opts "github.com/ipfs/go-ipfs/namesys/opts"
10
- path "github.com/ipfs/go-ipfs/path"
10
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
11
proquint "gx/ipfs/QmYnf27kzqR2cxt6LFZdrAFJuQd6785fTkBvMuEj9EeRxM/proquint"
12
)
13
namesys/publisher.go
+1
-1
@@ -7,9 +7,9 @@ import (
7
"sync"
8
"time"
9
10
- path "github.com/ipfs/go-ipfs/path"
10
pin "github.com/ipfs/go-ipfs/pin"
11
ft "github.com/ipfs/go-ipfs/unixfs"
12
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
13
14
routing "gx/ipfs/QmZ383TySJVeZWzGnWui6pRcKyYZk9VkKTuW7tmKRWk5au/go-libp2p-routing"
15
proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
namesys/republisher/repub.go
+1
-1
@@ -7,7 +7,7 @@ import (
7
8
keystore "github.com/ipfs/go-ipfs/keystore"
9
namesys "github.com/ipfs/go-ipfs/namesys"
10
- path "github.com/ipfs/go-ipfs/path"
10
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
11
12
goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
13
gpctx "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess/context"
namesys/republisher/repub_test.go
+1
-1
@@ -10,7 +10,7 @@ import (
10
mock "github.com/ipfs/go-ipfs/core/mock"
11
namesys "github.com/ipfs/go-ipfs/namesys"
12
. "github.com/ipfs/go-ipfs/namesys/republisher"
13
- path "github.com/ipfs/go-ipfs/path"
13
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
14
15
goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
16
mocknet "gx/ipfs/QmY51bqSM5XgxQZqsBrQcRkKTnCb8EKpJpR9K6Qax7Njco/go-libp2p/p2p/net/mock"
namesys/resolve_test.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
"testing"
7
"time"
8
9
- path "github.com/ipfs/go-ipfs/path"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
mockrouting "gx/ipfs/QmbFRJeEmEU16y3BmKKaD4a9fm5oHsEAMHe2vSB1UnfLMi/go-ipfs-routing/mock"
12
testutil "gx/ipfs/QmcW4FGAt24fdK1jBgWQn3yP4R9ZLyWQqjozv9QK7epRhL/go-testutil"
namesys/routing.go
+1
-1
@@ -6,7 +6,7 @@ import (
6
"time"
7
8
opts "github.com/ipfs/go-ipfs/namesys/opts"
9
- path "github.com/ipfs/go-ipfs/path"
9
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
10
11
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
12
dht "gx/ipfs/QmTktQYCKzQjhxF6dk5xJPRuhHn3JBiKGvMLoiDy1mYmxC/go-libp2p-kad-dht"
package.json
+6
@@ -563,6 +563,12 @@
563
"hash": "QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59",
564
"name": "go-merkledag",
565
"version": "1.0.0"
566
+ },
567
+ {
568
+ "author": "why",
569
+ "hash": "QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ",
570
+ "name": "go-path",
571
+ "version": "1.0.1"
572
}
573
],
574
"gxVersion": "0.10.0",
path/path.go
deleted
-181
@@ -1,181 +0,0 @@
1
-// Package path contains utilities to work with ipfs paths.
2
-package path
3
-
4
-import (
5
- "errors"
6
- "path"
7
- "strings"
8
-
9
- cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
10
-)
11
-
12
-var (
13
- // ErrBadPath is returned when a given path is incorrectly formatted
14
- ErrBadPath = errors.New("invalid 'ipfs ref' path")
15
-
16
- // ErrNoComponents is used when Paths after a protocol
17
- // do not contain at least one component
18
- ErrNoComponents = errors.New(
19
- "path must contain at least one component")
20
-)
21
-
22
-// A Path represents an ipfs content path:
23
-// * /<cid>/path/to/file
24
-// * /ipfs/<cid>
25
-// * /ipns/<cid>/path/to/folder
26
-// * etc
27
-type Path string
28
-
29
-// ^^^
30
-// TODO: debate making this a private struct wrapped in a public interface
31
-// would allow us to control creation, and cache segments.
32
-
33
-// FromString safely converts a string type to a Path type.
34
-func FromString(s string) Path {
35
- return Path(s)
36
-}
37
-
38
-// FromCid safely converts a cid.Cid type to a Path type.
39
-func FromCid(c *cid.Cid) Path {
40
- return Path("/ipfs/" + c.String())
41
-}
42
-
43
-// Segments returns the different elements of a path
44
-// (elements are delimited by a /).
45
-func (p Path) Segments() []string {
46
- cleaned := path.Clean(string(p))
47
- segments := strings.Split(cleaned, "/")
48
-
49
- // Ignore leading slash
50
- if len(segments[0]) == 0 {
51
- segments = segments[1:]
52
- }
53
-
54
- return segments
55
-}
56
-
57
-// String converts a path to string.
58
-func (p Path) String() string {
59
- return string(p)
60
-}
61
-
62
-// IsJustAKey returns true if the path is of the form <key> or /ipfs/<key>, or
63
-// /ipld/<key>
64
-func (p Path) IsJustAKey() bool {
65
- parts := p.Segments()
66
- return len(parts) == 2 && (parts[0] == "ipfs" || parts[0] == "ipld")
67
-}
68
-
69
-// PopLastSegment returns a new Path without its final segment, and the final
70
-// segment, separately. If there is no more to pop (the path is just a key),
71
-// the original path is returned.
72
-func (p Path) PopLastSegment() (Path, string, error) {
73
-
74
- if p.IsJustAKey() {
75
- return p, "", nil
76
- }
77
-
78
- segs := p.Segments()
79
- newPath, err := ParsePath("/" + strings.Join(segs[:len(segs)-1], "/"))
80
- if err != nil {
81
- return "", "", err
82
- }
83
-
84
- return newPath, segs[len(segs)-1], nil
85
-}
86
-
87
-// FromSegments returns a path given its different segments.
88
-func FromSegments(prefix string, seg ...string) (Path, error) {
89
- return ParsePath(prefix + strings.Join(seg, "/"))
90
-}
91
-
92
-// ParsePath returns a well-formed ipfs Path.
93
-// The returned path will always be prefixed with /ipfs/ or /ipns/.
94
-// The prefix will be added if not present in the given string.
95
-// This function will return an error when the given string is
96
-// not a valid ipfs path.
97
-func ParsePath(txt string) (Path, error) {
98
- parts := strings.Split(txt, "/")
99
- if len(parts) == 1 {
100
- kp, err := ParseCidToPath(txt)
101
- if err == nil {
102
- return kp, nil
103
- }
104
- }
105
-
106
- // if the path doesnt begin with a '/'
107
- // we expect this to start with a hash, and be an 'ipfs' path
108
- if parts[0] != "" {
109
- if _, err := ParseCidToPath(parts[0]); err != nil {
110
- return "", ErrBadPath
111
- }
112
- // The case when the path starts with hash without a protocol prefix
113
- return Path("/ipfs/" + txt), nil
114
- }
115
-
116
- if len(parts) < 3 {
117
- return "", ErrBadPath
118
- }
119
-
120
- if parts[1] == "ipfs" {
121
- if _, err := ParseCidToPath(parts[2]); err != nil {
122
- return "", err
123
- }
124
- } else if parts[1] != "ipns" && parts[1] != "ipld" { //TODO: make this smarter
125
- return "", ErrBadPath
126
- }
127
-
128
- return Path(txt), nil
129
-}
130
-
131
-// ParseCidToPath takes a CID in string form and returns a valid ipfs Path.
132
-func ParseCidToPath(txt string) (Path, error) {
133
- if txt == "" {
134
- return "", ErrNoComponents
135
- }
136
-
137
- c, err := cid.Decode(txt)
138
- if err != nil {
139
- return "", err
140
- }
141
-
142
- return FromCid(c), nil
143
-}
144
-
145
-// IsValid checks if a path is a valid ipfs Path.
146
-func (p *Path) IsValid() error {
147
- _, err := ParsePath(p.String())
148
- return err
149
-}
150
-
151
-// Join joins strings slices using /
152
-func Join(pths []string) string {
153
- return strings.Join(pths, "/")
154
-}
155
-
156
-// SplitList splits strings usings /
157
-func SplitList(pth string) []string {
158
- return strings.Split(pth, "/")
159
-}
160
-
161
-// SplitAbsPath clean up and split fpath. It extracts the first component (which
162
-// must be a Multihash) and return it separately.
163
-func SplitAbsPath(fpath Path) (*cid.Cid, []string, error) {
164
- parts := fpath.Segments()
165
- if parts[0] == "ipfs" || parts[0] == "ipld" {
166
- parts = parts[1:]
167
- }
168
-
169
- // if nothing, bail.
170
- if len(parts) == 0 {
171
- return nil, nil, ErrNoComponents
172
- }
173
-
174
- c, err := cid.Decode(parts[0])
175
- // first element in the path is a cid
176
- if err != nil {
177
- return nil, nil, err
178
- }
179
-
180
- return c, parts[1:], nil
181
-}
path/path_test.go
deleted
-85
@@ -1,85 +0,0 @@
1
-package path
2
-
3
-import (
4
- "testing"
5
-)
6
-
7
-func TestPathParsing(t *testing.T) {
8
- cases := map[string]bool{
9
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
10
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a": true,
11
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b/c/d/e/f": true,
12
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
13
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a": true,
14
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b/c/d/e/f": true,
15
- "/ipns/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b/c/d/e/f": true,
16
- "/ipns/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
17
- "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b/c/d/e/f": true,
18
- "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
19
- "/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": false,
20
- "/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a": false,
21
- "/ipfs/": false,
22
- "ipfs/": false,
23
- "ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": false,
24
- }
25
-
26
- for p, expected := range cases {
27
- _, err := ParsePath(p)
28
- valid := err == nil
29
- if valid != expected {
30
- t.Fatalf("expected %s to have valid == %t", p, expected)
31
- }
32
- }
33
-}
34
-
35
-func TestIsJustAKey(t *testing.T) {
36
- cases := map[string]bool{
37
- "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
38
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
39
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a": false,
40
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b": false,
41
- "/ipns/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": false,
42
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b": false,
43
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": true,
44
- }
45
-
46
- for p, expected := range cases {
47
- path, err := ParsePath(p)
48
- if err != nil {
49
- t.Fatalf("ParsePath failed to parse \"%s\", but should have succeeded", p)
50
- }
51
- result := path.IsJustAKey()
52
- if result != expected {
53
- t.Fatalf("expected IsJustAKey(%s) to return %v, not %v", p, expected, result)
54
- }
55
- }
56
-}
57
-
58
-func TestPopLastSegment(t *testing.T) {
59
- cases := map[string][]string{
60
- "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": []string{"/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n", ""},
61
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n": []string{"/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n", ""},
62
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a": []string{"/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n", "a"},
63
- "/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a/b": []string{"/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/a", "b"},
64
- "/ipns/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/x/y/z": []string{"/ipns/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/x/y", "z"},
65
- "/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/x/y/z": []string{"/ipld/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n/x/y", "z"},
66
- }
67
-
68
- for p, expected := range cases {
69
- path, err := ParsePath(p)
70
- if err != nil {
71
- t.Fatalf("ParsePath failed to parse \"%s\", but should have succeeded", p)
72
- }
73
- head, tail, err := path.PopLastSegment()
74
- if err != nil {
75
- t.Fatalf("PopLastSegment failed, but should have succeeded: %s", err)
76
- }
77
- headStr := head.String()
78
- if headStr != expected[0] {
79
- t.Fatalf("expected head of PopLastSegment(%s) to return %v, not %v", p, expected[0], headStr)
80
- }
81
- if tail != expected[1] {
82
- t.Fatalf("expected tail of PopLastSegment(%s) to return %v, not %v", p, expected[1], tail)
83
- }
84
- }
85
-}
path/resolver/resolver.go
deleted
-199
@@ -1,199 +0,0 @@
1
-// Package resolver implements utilities for resolving paths within ipfs.
2
-package resolver
3
-
4
-import (
5
- "context"
6
- "errors"
7
- "fmt"
8
- "time"
9
-
10
- path "github.com/ipfs/go-ipfs/path"
11
- dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
12
-
13
- cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
14
- ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
15
- logging "gx/ipfs/QmcVVHfdyv15GVPk7NrxdWjh2hLVccXnoD8j2tyQShiXJb/go-log"
16
-)
17
-
18
-var log = logging.Logger("pathresolv")
19
-
20
-// ErrNoComponents is used when Paths after a protocol
21
-// do not contain at least one component
22
-var ErrNoComponents = errors.New(
23
- "path must contain at least one component")
24
-
25
-// ErrNoLink is returned when a link is not found in a path
26
-type ErrNoLink struct {
27
- Name string
28
- Node *cid.Cid
29
-}
30
-
31
-// Error implements the Error interface for ErrNoLink with a useful
32
-// human readable message.
33
-func (e ErrNoLink) Error() string {
34
- return fmt.Sprintf("no link named %q under %s", e.Name, e.Node.String())
35
-}
36
-
37
-// ResolveOnce resolves path through a single node
38
-type ResolveOnce func(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, names []string) (*ipld.Link, []string, error)
39
-
40
-// Resolver provides path resolution to IPFS
41
-// It has a pointer to a DAGService, which is uses to resolve nodes.
42
-// TODO: now that this is more modular, try to unify this code with the
43
-// the resolvers in namesys
44
-type Resolver struct {
45
- DAG ipld.NodeGetter
46
-
47
- ResolveOnce ResolveOnce
48
-}
49
-
50
-// NewBasicResolver constructs a new basic resolver.
51
-func NewBasicResolver(ds ipld.DAGService) *Resolver {
52
- return &Resolver{
53
- DAG: ds,
54
- ResolveOnce: ResolveSingle,
55
- }
56
-}
57
-
58
-// ResolveToLastNode walks the given path and returns the ipld.Node
59
-// referenced by the last element in it.
60
-func (r *Resolver) ResolveToLastNode(ctx context.Context, fpath path.Path) (ipld.Node, []string, error) {
61
- c, p, err := path.SplitAbsPath(fpath)
62
- if err != nil {
63
- return nil, nil, err
64
- }
65
-
66
- nd, err := r.DAG.Get(ctx, c)
67
- if err != nil {
68
- return nil, nil, err
69
- }
70
-
71
- for len(p) > 0 {
72
- lnk, rest, err := r.ResolveOnce(ctx, r.DAG, nd, p)
73
-
74
- // Note: have to drop the error here as `ResolveOnce` doesn't handle 'leaf'
75
- // paths (so e.g. for `echo '{"foo":123}' | ipfs dag put` we wouldn't be
76
- // able to resolve `zdpu[...]/foo`)
77
- if lnk == nil {
78
- break
79
- }
80
-
81
- if err != nil {
82
- return nil, nil, err
83
- }
84
-
85
- next, err := lnk.GetNode(ctx, r.DAG)
86
- if err != nil {
87
- return nil, nil, err
88
- }
89
- nd = next
90
- p = rest
91
- }
92
-
93
- if len(p) == 0 {
94
- return nd, nil, nil
95
- }
96
-
97
- // Confirm the path exists within the object
98
- val, rest, err := nd.Resolve(p)
99
- if err != nil {
100
- return nil, nil, err
101
- }
102
-
103
- if len(rest) > 0 {
104
- return nil, nil, errors.New("path failed to resolve fully")
105
- }
106
- switch val.(type) {
107
- case *ipld.Link:
108
- return nil, nil, errors.New("inconsistent ResolveOnce / nd.Resolve")
109
- default:
110
- return nd, p, nil
111
- }
112
-}
113
-
114
-// ResolvePath fetches the node for given path. It returns the last item
115
-// returned by ResolvePathComponents.
116
-func (r *Resolver) ResolvePath(ctx context.Context, fpath path.Path) (ipld.Node, error) {
117
- // validate path
118
- if err := fpath.IsValid(); err != nil {
119
- return nil, err
120
- }
121
-
122
- nodes, err := r.ResolvePathComponents(ctx, fpath)
123
- if err != nil || nodes == nil {
124
- return nil, err
125
- }
126
- return nodes[len(nodes)-1], err
127
-}
128
-
129
-// ResolveSingle simply resolves one hop of a path through a graph with no
130
-// extra context (does not opaquely resolve through sharded nodes)
131
-func ResolveSingle(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, names []string) (*ipld.Link, []string, error) {
132
- return nd.ResolveLink(names)
133
-}
134
-
135
-// ResolvePathComponents fetches the nodes for each segment of the given path.
136
-// It uses the first path component as a hash (key) of the first node, then
137
-// resolves all other components walking the links, with ResolveLinks.
138
-func (r *Resolver) ResolvePathComponents(ctx context.Context, fpath path.Path) ([]ipld.Node, error) {
139
- evt := log.EventBegin(ctx, "resolvePathComponents", logging.LoggableMap{"fpath": fpath})
140
- defer evt.Done()
141
-
142
- h, parts, err := path.SplitAbsPath(fpath)
143
- if err != nil {
144
- evt.Append(logging.LoggableMap{"error": err.Error()})
145
- return nil, err
146
- }
147
-
148
- log.Debug("resolve dag get")
149
- nd, err := r.DAG.Get(ctx, h)
150
- if err != nil {
151
- evt.Append(logging.LoggableMap{"error": err.Error()})
152
- return nil, err
153
- }
154
-
155
- return r.ResolveLinks(ctx, nd, parts)
156
-}
157
-
158
-// ResolveLinks iteratively resolves names by walking the link hierarchy.
159
-// Every node is fetched from the DAGService, resolving the next name.
160
-// Returns the list of nodes forming the path, starting with ndd. This list is
161
-// guaranteed never to be empty.
162
-//
163
-// ResolveLinks(nd, []string{"foo", "bar", "baz"})
164
-// would retrieve "baz" in ("bar" in ("foo" in nd.Links).Links).Links
165
-func (r *Resolver) ResolveLinks(ctx context.Context, ndd ipld.Node, names []string) ([]ipld.Node, error) {
166
-
167
- evt := log.EventBegin(ctx, "resolveLinks", logging.LoggableMap{"names": names})
168
- defer evt.Done()
169
- result := make([]ipld.Node, 0, len(names)+1)
170
- result = append(result, ndd)
171
- nd := ndd // dup arg workaround
172
-
173
- // for each of the path components
174
- for len(names) > 0 {
175
- var cancel context.CancelFunc
176
- ctx, cancel = context.WithTimeout(ctx, time.Minute)
177
- defer cancel()
178
-
179
- lnk, rest, err := r.ResolveOnce(ctx, r.DAG, nd, names)
180
- if err == dag.ErrLinkNotFound {
181
- evt.Append(logging.LoggableMap{"error": err.Error()})
182
- return result, ErrNoLink{Name: names[0], Node: nd.Cid()}
183
- } else if err != nil {
184
- evt.Append(logging.LoggableMap{"error": err.Error()})
185
- return result, err
186
- }
187
-
188
- nextnode, err := lnk.GetNode(ctx, r.DAG)
189
- if err != nil {
190
- evt.Append(logging.LoggableMap{"error": err.Error()})
191
- return result, err
192
- }
193
-
194
- nd = nextnode
195
- result = append(result, nextnode)
196
- names = rest
197
- }
198
- return result, nil
199
-}
path/resolver/resolver_test.go
deleted
-70
@@ -1,70 +0,0 @@
1
-package resolver_test
2
-
3
-import (
4
- "context"
5
- "fmt"
6
- "testing"
7
-
8
- path "github.com/ipfs/go-ipfs/path"
9
- "github.com/ipfs/go-ipfs/path/resolver"
10
- merkledag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
11
- dagmock "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag/test"
12
-
13
- util "gx/ipfs/QmPdKqUcHGFdeSpvjVoaTRPPstGif9GBZb5Q56RVw9o69A/go-ipfs-util"
14
- ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
15
-)
16
-
17
-func randNode() *merkledag.ProtoNode {
18
- node := new(merkledag.ProtoNode)
19
- node.SetData(make([]byte, 32))
20
- util.NewTimeSeededRand().Read(node.Data())
21
- return node
22
-}
23
-
24
-func TestRecurivePathResolution(t *testing.T) {
25
- ctx := context.Background()
26
- dagService := dagmock.Mock()
27
-
28
- a := randNode()
29
- b := randNode()
30
- c := randNode()
31
-
32
- err := b.AddNodeLink("grandchild", c)
33
- if err != nil {
34
- t.Fatal(err)
35
- }
36
-
37
- err = a.AddNodeLink("child", b)
38
- if err != nil {
39
- t.Fatal(err)
40
- }
41
-
42
- for _, n := range []ipld.Node{a, b, c} {
43
- err = dagService.Add(ctx, n)
44
- if err != nil {
45
- t.Fatal(err)
46
- }
47
- }
48
-
49
- aKey := a.Cid()
50
-
51
- segments := []string{aKey.String(), "child", "grandchild"}
52
- p, err := path.FromSegments("/ipfs/", segments...)
53
- if err != nil {
54
- t.Fatal(err)
55
- }
56
-
57
- resolver := resolver.NewBasicResolver(dagService)
58
- node, err := resolver.ResolvePath(ctx, p)
59
- if err != nil {
60
- t.Fatal(err)
61
- }
62
-
63
- cKey := c.Cid()
64
- key := node.Cid()
65
- if key.String() != cKey.String() {
66
- t.Fatal(fmt.Errorf(
67
- "recursive path resolution failed for %s: %s != %s",
68
- p.String(), key.String(), cKey.String()))
69
- }
70
-}
tar/format.go
+1
-1
@@ -10,9 +10,9 @@ import (
10
11
"github.com/ipfs/go-ipfs/dagutils"
12
importer "github.com/ipfs/go-ipfs/importer"
13
- path "github.com/ipfs/go-ipfs/path"
13
uio "github.com/ipfs/go-ipfs/unixfs/io"
14
dag "gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
15
+ path "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path"
16
17
chunker "gx/ipfs/QmVDjhUMtkRskBFAVNwyXuLSKbeAya7JKPnzAxMKDaK4x4/go-ipfs-chunker"
18
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"