From 801725619330a12f92b87055f24e37ae8d3cdc84 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 6 Oct 2023 10:26:46 +0200 Subject: [PATCH] chore: boxo + /ipld -> /ipfs for single blocks --- client/rpc/block.go | 2 +- client/rpc/dag.go | 4 ++-- client/rpc/pin.go | 4 ++-- core/coreapi/block.go | 4 ++-- core/coreapi/pin.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/rpc/block.go b/client/rpc/block.go index ac304f377e6..a5882a57e9d 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -28,7 +28,7 @@ func (s *blockStat) Size() int { } func (s *blockStat) Path() path.ImmutablePath { - return path.NewIPLDPath(s.cid) + return path.FromCid(s.cid) } func (api *BlockAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.BlockPutOption) (iface.BlockStat, error) { diff --git a/client/rpc/dag.go b/client/rpc/dag.go index b87eed737ae..098a959d8f1 100644 --- a/client/rpc/dag.go +++ b/client/rpc/dag.go @@ -21,7 +21,7 @@ type ( ) func (api *HttpDagServ) Get(ctx context.Context, c cid.Cid) (format.Node, error) { - r, err := api.core().Block().Get(ctx, path.NewIPLDPath(c)) + r, err := api.core().Block().Get(ctx, path.FromCid(c)) if err != nil { return nil, err } @@ -116,7 +116,7 @@ func (api *HttpDagServ) Pinning() format.NodeAdder { } func (api *HttpDagServ) Remove(ctx context.Context, c cid.Cid) error { - return api.core().Block().Rm(ctx, path.NewIPLDPath(c)) // TODO: should we force rm? + return api.core().Block().Rm(ctx, path.FromCid(c)) // TODO: should we force rm? } func (api *HttpDagServ) RemoveMany(ctx context.Context, cids []cid.Cid) error { diff --git a/client/rpc/pin.go b/client/rpc/pin.go index a1323fb7f1a..486e5115b5b 100644 --- a/client/rpc/pin.go +++ b/client/rpc/pin.go @@ -102,7 +102,7 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) (<-chan i } select { - case ch <- pin{typ: out.Type, path: path.NewIPLDPath(c)}: + case ch <- pin{typ: out.Type, path: path.FromCid(c)}: case <-ctx.Done(): return } @@ -183,7 +183,7 @@ type badNode struct { } func (n badNode) Path() path.ImmutablePath { - return path.NewIPLDPath(n.cid) + return path.FromCid(n.cid) } func (n badNode) Err() error { diff --git a/core/coreapi/block.go b/core/coreapi/block.go index 08743c16e08..ffbe89c8bf6 100644 --- a/core/coreapi/block.go +++ b/core/coreapi/block.go @@ -68,7 +68,7 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc } } - return &BlockStat{path: path.NewIPLDPath(b.Cid()), size: len(data)}, nil + return &BlockStat{path: path.FromCid(b.Cid()), size: len(data)}, nil } func (api *BlockAPI) Get(ctx context.Context, p path.Path) (io.Reader, error) { @@ -143,7 +143,7 @@ func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (coreiface.BlockStat } return &BlockStat{ - path: path.NewIPLDPath(b.Cid()), + path: path.FromCid(b.Cid()), size: len(b.RawData()), }, nil } diff --git a/core/coreapi/pin.go b/core/coreapi/pin.go index 47ea1975168..7c33b3ee0a7 100644 --- a/core/coreapi/pin.go +++ b/core/coreapi/pin.go @@ -210,7 +210,7 @@ func (api *PinAPI) Verify(ctx context.Context) (<-chan coreiface.PinStatus, erro links, err := getLinks(ctx, root) if err != nil { status := &pinStatus{ok: false, cid: root} - status.badNodes = []coreiface.BadPinNode{&badNode{path: path.NewIPLDPath(root), err: err}} + status.badNodes = []coreiface.BadPinNode{&badNode{path: path.FromCid(root), err: err}} visited[root] = status return status } @@ -281,7 +281,7 @@ func (api *PinAPI) pinLsAll(ctx context.Context, typeStr string) <-chan coreifac select { case out <- &pinInfo{ pinType: typeStr, - path: path.NewIPLDPath(c), + path: path.FromCid(c), }: case <-ctx.Done(): return ctx.Err()