Skip to content

Commit

Permalink
chore: boxo + /ipld -> /ipfs for single blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 6, 2023
1 parent 1a2996d commit 8017256
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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?

Check warning on line 119 in client/rpc/dag.go

View check run for this annotation

Codecov / codecov/patch

client/rpc/dag.go#L119

Added line #L119 was not covered by tests
}

func (api *HttpDagServ) RemoveMany(ctx context.Context, cids []cid.Cid) error {
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -183,7 +183,7 @@ type badNode struct {
}

func (n badNode) Path() path.ImmutablePath {
return path.NewIPLDPath(n.cid)
return path.FromCid(n.cid)

Check warning on line 186 in client/rpc/pin.go

View check run for this annotation

Codecov / codecov/patch

client/rpc/pin.go#L185-L186

Added lines #L185 - L186 were not covered by tests
}

func (n badNode) Err() error {
Expand Down
4 changes: 2 additions & 2 deletions core/coreapi/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions core/coreapi/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 8017256

Please sign in to comment.