diff --git a/blocks/blockstoreutil/remove.go b/blocks/blockstoreutil/remove.go index 880f033656fd15b05473b964d156c23dca48631d..b4e944fdfcbeaa61d22c77a97ace84df23dca114 100644 --- a/blocks/blockstoreutil/remove.go +++ b/blocks/blockstoreutil/remove.go @@ -9,6 +9,7 @@ import ( cid "github.com/ipfs/go-cid" bs "github.com/ipfs/go-ipfs-blockstore" pin "github.com/ipfs/go-ipfs-pinner" + format "github.com/ipfs/go-ipld-format" ) // RemovedBlock is used to represent the result of removing a block. @@ -54,7 +55,7 @@ func RmBlocks(ctx context.Context, blocks bs.GCBlockstore, pins pin.Pinner, cids continue } if !has && !opts.Force { - out <- &RemovedBlock{Hash: c.String(), Error: bs.ErrNotFound.Error()} + out <- &RemovedBlock{Hash: c.String(), Error: format.ErrNotFound{Cid: c}.Error()} continue } diff --git a/core/commands/dag/export.go b/core/commands/dag/export.go index 7290002e7f0ec47ce7d6fa69dd420b4a8607e3ba..530bf4d57886b87f31760a38ca2e47cd59c433c4 100644 --- a/core/commands/dag/export.go +++ b/core/commands/dag/export.go @@ -63,8 +63,7 @@ func dagExport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment err = <-errCh // minimal user friendliness - if err != nil && - err == ipld.ErrNotFound { + if ipld.IsNotFound(err) { explicitOffline, _ := req.Options["offline"].(bool) if explicitOffline { err = fmt.Errorf("%s (currently offline, perhaps retry without the offline flag)", err) diff --git a/core/commands/files.go b/core/commands/files.go index 879f1fab10e3aecc00f57bb7be259e6a08a4cf76..4c403f7688af02c1dd8b70163b876da525bf1437 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -297,7 +297,7 @@ func walkBlock(ctx context.Context, dagserv ipld.DAGService, nd ipld.Node) (bool for _, link := range nd.Links() { child, err := dagserv.Get(ctx, link.Cid) - if err == ipld.ErrNotFound { + if ipld.IsNotFound(err) { local = false continue } diff --git a/core/coreapi/block.go b/core/coreapi/block.go index e1ad9badc05b43dca79e7cee9416e54c251913c0..a1d5984d412f07338a96fd7a9a0e8bfc3920a917 100644 --- a/core/coreapi/block.go +++ b/core/coreapi/block.go @@ -107,6 +107,8 @@ func (api *BlockAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.BlockRm return errors.New("got unexpected output from util.RmBlocks") } + // Because errors come as strings we lose information about + // the error type. if remBlock.Error != "" { return errors.New(remBlock.Error) } diff --git a/fuse/readonly/readonly_unix.go b/fuse/readonly/readonly_unix.go index 1fbb473106dc07b40a7780d97888a114b4fe5c83..af961221ca70e4ffb54e99a64e1e1abe5bf098f5 100644 --- a/fuse/readonly/readonly_unix.go +++ b/fuse/readonly/readonly_unix.go @@ -188,13 +188,9 @@ func (s *Node) Lookup(ctx context.Context, name string) (fs.Node, error) { } nd, err := s.Ipfs.DAG.Get(ctx, link.Cid) - switch err { - case ipld.ErrNotFound: - default: + if err != nil && !ipld.IsNotFound(err) { log.Errorf("fuse lookup %q: %s", name, err) return nil, err - case nil: - // noop } return &Node{Ipfs: s.Ipfs, Nd: nd}, nil diff --git a/gc/gc.go b/gc/gc.go index a77142e103a938a7e43a328074042f1bdc989a44..e3b0fda68f90da6c46a122641fbc3bc405485ed1 100644 --- a/gc/gc.go +++ b/gc/gc.go @@ -233,7 +233,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo bestEffortGetLinks := func(ctx context.Context, cid cid.Cid) ([]*ipld.Link, error) { links, err := ipld.GetLinks(ctx, ng, cid) - if err != nil && err != ipld.ErrNotFound { + if err != nil && !ipld.IsNotFound(err) { errors = true select { case output <- Result{Error: &CannotFetchLinksError{cid, err}}: diff --git a/go.mod b/go.mod index 8546b9057b313838c30e7bbe2b4c477859ccc2ad..f87cb2edbc8f1023ce3d7b0cf8f334da4c66d8f5 100644 --- a/go.mod +++ b/go.mod @@ -13,9 +13,9 @@ require ( github.com/gabriel-vasile/mimetype v1.4.0 github.com/go-bindata/go-bindata/v3 v3.1.3 github.com/hashicorp/go-multierror v1.1.1 - github.com/ipfs/go-bitswap v0.5.1 + github.com/ipfs/go-bitswap v0.5.2-0.20220302142610-595ae6937936 github.com/ipfs/go-block-format v0.0.3 - github.com/ipfs/go-blockservice v0.2.1 + github.com/ipfs/go-blockservice v0.2.2-0.20220302144055-931fbecb724e github.com/ipfs/go-cid v0.1.0 github.com/ipfs/go-cidutil v0.0.2 github.com/ipfs/go-datastore v0.5.1 @@ -25,15 +25,15 @@ require ( github.com/ipfs/go-ds-leveldb v0.5.0 github.com/ipfs/go-ds-measure v0.2.0 github.com/ipfs/go-fetcher v1.6.1 - github.com/ipfs/go-filestore v1.1.0 + github.com/ipfs/go-filestore v1.1.1-0.20220302151633-1dfe2386cda8 github.com/ipfs/go-fs-lock v0.0.7 github.com/ipfs/go-graphsync v0.11.0 - github.com/ipfs/go-ipfs-blockstore v1.1.2 + github.com/ipfs/go-ipfs-blockstore v1.1.3-0.20220302142350-af197de1c3da github.com/ipfs/go-ipfs-chunker v0.0.5 github.com/ipfs/go-ipfs-cmds v0.6.0 github.com/ipfs/go-ipfs-config v0.19.0 github.com/ipfs/go-ipfs-exchange-interface v0.1.0 - github.com/ipfs/go-ipfs-exchange-offline v0.1.1 + github.com/ipfs/go-ipfs-exchange-offline v0.1.2-0.20220302144615-a919970e8153 github.com/ipfs/go-ipfs-files v0.0.9 github.com/ipfs/go-ipfs-keystore v0.0.2 github.com/ipfs/go-ipfs-pinner v0.2.1 @@ -42,12 +42,12 @@ require ( github.com/ipfs/go-ipfs-routing v0.2.1 github.com/ipfs/go-ipfs-util v0.0.2 github.com/ipfs/go-ipld-cbor v0.0.5 - github.com/ipfs/go-ipld-format v0.2.0 + github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65 github.com/ipfs/go-ipld-git v0.1.1 github.com/ipfs/go-ipld-legacy v0.1.0 github.com/ipfs/go-ipns v0.1.2 github.com/ipfs/go-log v1.0.5 - github.com/ipfs/go-merkledag v0.5.1 + github.com/ipfs/go-merkledag v0.5.2-0.20220302145706-4c7f7bfbe598 github.com/ipfs/go-metrics-interface v0.0.1 github.com/ipfs/go-metrics-prometheus v0.0.2 github.com/ipfs/go-mfs v0.2.1 @@ -57,7 +57,7 @@ require ( github.com/ipfs/go-unixfs v0.3.1 github.com/ipfs/go-unixfsnode v1.1.3 github.com/ipfs/go-verifcid v0.0.1 - github.com/ipfs/interface-go-ipfs-core v0.5.2 + github.com/ipfs/interface-go-ipfs-core v0.5.3-0.20220302172844-ebde7297b2a0 github.com/ipfs/tar-utils v0.0.2 github.com/ipld/go-car v0.3.2 github.com/ipld/go-codec-dagpb v1.3.0 diff --git a/go.sum b/go.sum index e791d5ea3cff7436d1d8b276e78fee2a1a97728c..d5a4e09a87cdbb99b6ecef587058110e8c0c108e 100644 --- a/go.sum +++ b/go.sum @@ -397,8 +397,9 @@ github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSA github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs= github.com/ipfs/go-bitswap v0.1.8/go.mod h1:TOWoxllhccevbWFUR2N7B1MTSVVge1s6XSMiCSA4MzM= github.com/ipfs/go-bitswap v0.3.4/go.mod h1:4T7fvNv/LmOys+21tnLzGKncMeeXUYUd1nUiJ2teMvI= -github.com/ipfs/go-bitswap v0.5.1 h1:721YAEDBnLIrvcIMkCHCdqp34hA8jwL9yKMkyJpSpco= github.com/ipfs/go-bitswap v0.5.1/go.mod h1:P+ckC87ri1xFLvk74NlXdP0Kj9RmWAh4+H78sC6Qopo= +github.com/ipfs/go-bitswap v0.5.2-0.20220302142610-595ae6937936 h1:1Ps0PF7jFKqO8/QwHaFvwCpQ0AITuYSbOI50gts3OiM= +github.com/ipfs/go-bitswap v0.5.2-0.20220302142610-595ae6937936/go.mod h1:Ro9XYuNUQxtx/YIZm+OA5mEnADStr5fyowhSUIgZtaU= github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc= @@ -407,8 +408,9 @@ github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbR github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= github.com/ipfs/go-blockservice v0.1.4/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU= github.com/ipfs/go-blockservice v0.1.7/go.mod h1:GmS+BAt4hrwBKkzE11AFDQUrnvqjwFatGS2MY7wOjEM= -github.com/ipfs/go-blockservice v0.2.1 h1:NJ4j/cwEfIg60rzAWcCIxRtOwbf6ZPK49MewNxObCPQ= github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8= +github.com/ipfs/go-blockservice v0.2.2-0.20220302144055-931fbecb724e h1:Nqyg2HAa7lS19g6N7UTpbiJQFHKSO7yp+DvcqY4iBFk= +github.com/ipfs/go-blockservice v0.2.2-0.20220302144055-931fbecb724e/go.mod h1:0rezJNcrjTA32XEEXiV/DQAztHZrVduLb7GiktRq6lg= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= @@ -455,8 +457,8 @@ github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9 github.com/ipfs/go-fetcher v1.5.0/go.mod h1:5pDZ0393oRF/fHiLmtFZtpMNBQfHOYNPtryWedVuSWE= github.com/ipfs/go-fetcher v1.6.1 h1:UFuRVYX5AIllTiRhi5uK/iZkfhSpBCGX7L70nSZEmK8= github.com/ipfs/go-fetcher v1.6.1/go.mod h1:27d/xMV8bodjVs9pugh/RCjjK2OZ68UgAMspMdingNo= -github.com/ipfs/go-filestore v1.1.0 h1:Pu4tLBi1bucu6/HU9llaOmb9yLFk/sgP+pW764zNDoE= -github.com/ipfs/go-filestore v1.1.0/go.mod h1:6e1/5Y6NvLuCRdmda/KA4GUhXJQ3Uat6vcWm2DJfxc8= +github.com/ipfs/go-filestore v1.1.1-0.20220302151633-1dfe2386cda8 h1:e92gjZ0hO8CCcdi7UN18ghULbd/ZoP524Qm9iZltaF0= +github.com/ipfs/go-filestore v1.1.1-0.20220302151633-1dfe2386cda8/go.mod h1:EQKwAmJqrW20KGt+xU2DVK2RBFgcwYTF9eNM/M0EfKs= github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U= github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc= github.com/ipfs/go-graphsync v0.11.0 h1:PiiD5CnoC3xEHMW8d6uBGqGcoTwiMB5d9CORIEyF6iA= @@ -466,9 +468,8 @@ github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2Is github.com/ipfs/go-ipfs-blockstore v0.1.4/go.mod h1:Jxm3XMVjh6R17WvxFEiyKBLUGr86HgIYJW/D/MwqeYQ= github.com/ipfs/go-ipfs-blockstore v0.1.6/go.mod h1:Jxm3XMVjh6R17WvxFEiyKBLUGr86HgIYJW/D/MwqeYQ= github.com/ipfs/go-ipfs-blockstore v0.2.1/go.mod h1:jGesd8EtCM3/zPgx+qr0/feTXGUeRai6adgwC+Q+JvE= -github.com/ipfs/go-ipfs-blockstore v1.1.1/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY= -github.com/ipfs/go-ipfs-blockstore v1.1.2 h1:WCXoZcMYnvOTmlpX+RSSnhVN0uCmbWTeepTGX5lgiXw= -github.com/ipfs/go-ipfs-blockstore v1.1.2/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY= +github.com/ipfs/go-ipfs-blockstore v1.1.3-0.20220302142350-af197de1c3da h1:/TU6rnYvsuKOwqpWxQXtO/K1Uj7IYY2GFE0WUr4Gh2Y= +github.com/ipfs/go-ipfs-blockstore v1.1.3-0.20220302142350-af197de1c3da/go.mod h1:dFOiy6XAxbK5x1Jvx7OAO1rQsrcyHxaXdTLWN085QoE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= @@ -489,8 +490,9 @@ github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFq github.com/ipfs/go-ipfs-exchange-interface v0.1.0 h1:TiMekCrOGQuWYtZO3mf4YJXDIdNgnKWZ9IE3fGlnWfo= github.com/ipfs/go-ipfs-exchange-interface v0.1.0/go.mod h1:ych7WPlyHqFvCi/uQI48zLZuAWVP5iTQPXEfVaw5WEI= github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-exchange-offline v0.1.1 h1:mEiXWdbMN6C7vtDG21Fphx8TGCbZPpQnz/496w/PL4g= github.com/ipfs/go-ipfs-exchange-offline v0.1.1/go.mod h1:vTiBRIbzSwDD0OWm+i3xeT0mO7jG2cbJYatp3HPk5XY= +github.com/ipfs/go-ipfs-exchange-offline v0.1.2-0.20220302144615-a919970e8153 h1:GtLORXk45GpVMfhPz+IyZ9YNAe36BQ+rKZvem5Bo49Y= +github.com/ipfs/go-ipfs-exchange-offline v0.1.2-0.20220302144615-a919970e8153/go.mod h1:fjwwh1LDdR2LrZ0qYeDbWx4pgdTq+Tw48YaLBjCS2qk= github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.8/go.mod h1:wiN/jSG8FKyk7N0WyctKSvq3ljIa2NNTiZB55kpTdOs= github.com/ipfs/go-ipfs-files v0.0.9 h1:OFyOfmuVDu9c5YtjSDORmwXzE6fmZikzZpzsnNkgFEg= @@ -520,8 +522,9 @@ github.com/ipfs/go-ipld-cbor v0.0.5 h1:ovz4CHKogtG2KB/h1zUp5U0c/IzZrL435rCh5+K/5 github.com/ipfs/go-ipld-cbor v0.0.5/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4= github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= -github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL37mwA= github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs= +github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65 h1:xxnD+fUS7hziDAnfrn3qsl0ql18DOjq4rwvzBTCr1iA= +github.com/ipfs/go-ipld-format v0.2.1-0.20220302134852-d02e0e18fc65/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= github.com/ipfs/go-ipld-git v0.1.1 h1:TWGnZjS0htmEmlMFEkA3ogrNCqWjIxwr16x1OsdhG+Y= github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYDpKUkJubI= github.com/ipfs/go-ipld-legacy v0.1.0 h1:wxkkc4k8cnvIGIjPO0waJCe7SHEyFgl+yQdafdjGrpA= @@ -545,8 +548,9 @@ github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKy github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-merkledag v0.4.0/go.mod h1:XshXBkhyeS63YNGisLL1uDSfuTyrQIxVUOg3ojR5MOE= -github.com/ipfs/go-merkledag v0.5.1 h1:tr17GPP5XtPhvPPiWtu20tSGZiZDuTaJRXBLcr79Umk= github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4= +github.com/ipfs/go-merkledag v0.5.2-0.20220302145706-4c7f7bfbe598 h1:LBBmuAf+riiqOFU/YbErKaHF2kZ5ajc1cjy2puuNyLs= +github.com/ipfs/go-merkledag v0.5.2-0.20220302145706-4c7f7bfbe598/go.mod h1:nYh/2ZlUEAHL8glS7y93pPA3Ut7JHkY5fYThsrp8+RY= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/ipfs/go-metrics-prometheus v0.0.2 h1:9i2iljLg12S78OhC6UAiXi176xvQGiZaGVF1CUVdE+s= @@ -580,6 +584,10 @@ github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZ github.com/ipfs/interface-go-ipfs-core v0.4.0/go.mod h1:UJBcU6iNennuI05amq3FQ7g0JHUkibHFAfhfUIy927o= github.com/ipfs/interface-go-ipfs-core v0.5.2 h1:m1/5U+WpOK2ZE7Qzs5iIu80QM1ZA3aWYi2Ilwpi+tdg= github.com/ipfs/interface-go-ipfs-core v0.5.2/go.mod h1:lNBJrdXHtWS46evMPBdWtDQMDsrKcGbxCOGoKLkztOE= +github.com/ipfs/interface-go-ipfs-core v0.5.3-0.20220302154624-b7f863f05698 h1:PidDOk6cfYYKsO+1LVRpKQUccKJMxB/7It75TATpruA= +github.com/ipfs/interface-go-ipfs-core v0.5.3-0.20220302154624-b7f863f05698/go.mod h1:1wpi0hALzziD775jYmRiehbakCmxZA3XTlTlF3D2z2c= +github.com/ipfs/interface-go-ipfs-core v0.5.3-0.20220302172844-ebde7297b2a0 h1:Y+PmGrp9gF9UTIQHMc6PGEMvV6Ylk5zAQJYyIg8z5Mk= +github.com/ipfs/interface-go-ipfs-core v0.5.3-0.20220302172844-ebde7297b2a0/go.mod h1:1wpi0hALzziD775jYmRiehbakCmxZA3XTlTlF3D2z2c= github.com/ipfs/tar-utils v0.0.2 h1:UNgHB4x/PPzbMkmJi+7EqC9LNMPDztOVSnx1HAqSNg4= github.com/ipfs/tar-utils v0.0.2/go.mod h1:4qlnRWgTVljIMhSG2SqRYn66NT+3wrv/kZt9V+eqxDM= github.com/ipld/go-car v0.3.2 h1:V9wt/80FNfbMRWSD98W5br6fyjUAyVgI2lDOTZX16Lg=