Skip to content

Commit

Permalink
chore: bump boxo
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 6, 2023
1 parent 0d1a24b commit 24faf49
Show file tree
Hide file tree
Showing 40 changed files with 91 additions and 91 deletions.
4 changes: 2 additions & 2 deletions assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func addAssetList(nd *core.IpfsNode, l []string) (cid.Cid, error) {
return cid.Cid{}, err
}

basePath := path.NewIPFSPath(dirb.Cid())
basePath := path.FromCid(dirb.Cid())

for _, p := range l {
d, err := Asset.ReadFile(p)
Expand All @@ -69,5 +69,5 @@ func addAssetList(nd *core.IpfsNode, l []string) (cid.Cid, error) {
return cid.Cid{}, err
}

return basePath.Cid(), nil
return basePath.RootCid(), nil
}
6 changes: 3 additions & 3 deletions client/rpc/apifile.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
const forwardSeekLimit = 1 << 14 // 16k

func (api *UnixfsAPI) Get(ctx context.Context, p path.Path) (files.Node, error) {
if p.Namespace().Mutable() { // use resolved path in case we are dealing with IPNS / MFS
if p.Mutable() { // use resolved path in case we are dealing with IPNS / MFS
var err error
p, _, err = api.core().ResolvePath(ctx, p)
if err != nil {
Expand Down Expand Up @@ -195,13 +195,13 @@ func (it *apiIter) Next() bool {

switch it.cur.Type {
case unixfs.THAMTShard, unixfs.TMetadata, unixfs.TDirectory:
it.curFile, err = it.core.getDir(it.ctx, path.NewIPFSPath(c), int64(it.cur.Size))
it.curFile, err = it.core.getDir(it.ctx, path.FromCid(c), int64(it.cur.Size))
if err != nil {
it.err = err
return false
}
case unixfs.TFile:
it.curFile, err = it.core.getFile(it.ctx, path.NewIPFSPath(c), int64(it.cur.Size))
it.curFile, err = it.core.getFile(it.ctx, path.FromCid(c), int64(it.cur.Size))
if err != nil {
it.err = err
return false
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (api *httpNodeAdder) add(ctx context.Context, nd format.Node, pin bool) err
if err != nil {
return err
}
if !stat.Path().Cid().Equals(c) {
return fmt.Errorf("cids didn't match - local %s, remote %s", c.String(), stat.Path().Cid().String())
if !stat.Path().RootCid().Equals(c) {
return fmt.Errorf("cids didn't match - local %s, remote %s", c.String(), stat.Path().RootCid().String())
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (api *DhtAPI) FindProviders(ctx context.Context, p path.Path, opts ...caopt
return nil, err
}

resp, err := api.core().Request("dht/findprovs", rp.Cid().String()).
resp, err := api.core().Request("dht/findprovs", rp.RootCid().String()).
Option("num-providers", options.NumProviders).
Send(ctx)
if err != nil {
Expand Down Expand Up @@ -103,7 +103,7 @@ func (api *DhtAPI) Provide(ctx context.Context, p path.Path, opts ...caopts.DhtP
return err
}

return api.core().Request("dht/provide", rp.Cid().String()).
return api.core().Request("dht/provide", rp.RootCid().String()).
Option("recursive", options.Recursive).
Exec(ctx, nil)
}
Expand Down
14 changes: 7 additions & 7 deletions client/rpc/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.Objec
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

func (api *ObjectAPI) Get(ctx context.Context, p path.Path) (ipld.Node, error) {
Expand Down Expand Up @@ -172,7 +172,7 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string,
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (path.ImmutablePath, error) {
Expand All @@ -188,7 +188,7 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

func (api *ObjectAPI) AppendData(ctx context.Context, p path.Path, r io.Reader) (path.ImmutablePath, error) {
Expand All @@ -205,7 +205,7 @@ func (api *ObjectAPI) AppendData(ctx context.Context, p path.Path, r io.Reader)
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

func (api *ObjectAPI) SetData(ctx context.Context, p path.Path, r io.Reader) (path.ImmutablePath, error) {
Expand All @@ -222,7 +222,7 @@ func (api *ObjectAPI) SetData(ctx context.Context, p path.Path, r io.Reader) (pa
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

type change struct {
Expand All @@ -246,10 +246,10 @@ func (api *ObjectAPI) Diff(ctx context.Context, a path.Path, b path.Path) ([]ifa
Path: ch.Path,
}
if ch.Before != cid.Undef {
res[i].Before = path.NewIPFSPath(ch.Before)
res[i].Before = path.FromCid(ch.Before)
}
if ch.After != cid.Undef {
res[i].After = path.NewIPFSPath(ch.After)
res[i].After = path.FromCid(ch.After)
}
}
return res, nil
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (api *HttpApi) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
return nil, nil, err
}

p, err = path.NewPathFromSegments(p.Namespace().String(), out.Cid.String(), out.RemPath)
p, err = path.NewPathFromSegments(p.Namespace(), out.Cid.String(), out.RemPath)
if err != nil {
return nil, nil, err
}
Expand All @@ -44,5 +44,5 @@ func (api *HttpApi) ResolveNode(ctx context.Context, p path.Path) (ipld.Node, er
return nil, err
}

return api.Dag().Get(ctx, rp.Cid())
return api.Dag().Get(ctx, rp.RootCid())
}
4 changes: 2 additions & 2 deletions client/rpc/unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ loop:
return nil, err
}

ifevt.Path = path.NewIPFSPath(c)
ifevt.Path = path.FromCid(c)
}

select {
Expand All @@ -121,7 +121,7 @@ loop:
return nil, err
}

return path.NewIPFSPath(c), nil
return path.FromCid(c), nil
}

type lsLink struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipfs/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,5 @@ func initializeIpnsKeyspace(repoRoot string) error {
return err
}

return nd.Namesys.Publish(ctx, nd.PrivateKey, path.NewIPFSPath(emptyDir.Cid()))
return nd.Namesys.Publish(ctx, nd.PrivateKey, path.FromCid(emptyDir.Cid()))
}
4 changes: 2 additions & 2 deletions core/commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ See 'dag export' and 'dag import' for more information.
}

var nodeAdded ipld.Node
nodeAdded, err = api.Dag().Get(req.Context, pathAdded.Cid())
nodeAdded, err = api.Dag().Get(req.Context, pathAdded.RootCid())
if err != nil {
errCh <- err
return
Expand All @@ -340,7 +340,7 @@ See 'dag export' and 'dag import' for more information.

h := ""
if output.Path != nil {
h = enc.Encode(output.Path.Cid())
h = enc.Encode(output.Path.RootCid())
}

if !dir && addit.Name() != "" {
Expand Down
8 changes: 4 additions & 4 deletions core/commands/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ on raw IPFS blocks. It outputs the following to stdout:
}

return cmds.EmitOnce(res, &BlockStat{
Key: b.Path().Cid().String(),
Key: b.Path().RootCid().String(),
Size: b.Size(),
})
},
Expand Down Expand Up @@ -210,7 +210,7 @@ only for backward compatibility when a legacy CIDv0 is required (--format=v0).
}

err = res.Emit(&BlockStat{
Key: p.Path().Cid().String(),
Key: p.Path().RootCid().String(),
Size: p.Size(),
})
if err != nil {
Expand Down Expand Up @@ -278,7 +278,7 @@ It takes a list of CIDs to remove from the local datastore..
err = api.Block().Rm(req.Context, rp, options.Block.Force(force))
if err != nil {
if err := res.Emit(&removedBlock{
Hash: rp.Cid().String(),
Hash: rp.RootCid().String(),
Error: err.Error(),
}); err != nil {
return err
Expand All @@ -288,7 +288,7 @@ It takes a list of CIDs to remove from the local datastore..

if !quiet {
err := res.Emit(&removedBlock{
Hash: rp.Cid().String(),
Hash: rp.RootCid().String(),
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion core/commands/dag/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func dagGet(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) e
return err
}

obj, err := api.Dag().Get(req.Context, rp.Cid())
obj, err := api.Dag().Get(req.Context, rp.RootCid())
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/dag/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func dagResolve(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environmen
}

return cmds.EmitOnce(res, &ResolveOutput{
Cid: rp.Cid(),
Cid: rp.RootCid(),
RemPath: path.SegmentsToString(remainder...),
})
}
4 changes: 2 additions & 2 deletions core/commands/dag/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func dagStat(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment)
return fmt.Errorf("cannot return size for anything other than a DAG with a root CID")
}

obj, err := nodeGetter.Get(req.Context, rp.Cid())
obj, err := nodeGetter.Get(req.Context, rp.RootCid())
if err != nil {
return err
}
dagstats := &DagStat{Cid: rp.Cid()}
dagstats := &DagStat{Cid: rp.RootCid()}
dagStatSummary.appendStats(dagstats)
err = traverse.Traverse(obj, traverse.Options{
DAG: nodeGetter,
Expand Down
4 changes: 2 additions & 2 deletions core/commands/object/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Example:
}

if change.Before != nil {
out[i].Before = change.Before.Cid()
out[i].Before = change.Before.RootCid()
}

if change.After != nil {
out[i].After = change.After.Cid()
out[i].After = change.After.RootCid()
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/commands/object/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ multihash. Provided for legacy reasons. Use 'ipfs dag get' instead.
}

out := &Object{
Hash: enc.Encode(rp.Cid()),
Hash: enc.Encode(rp.RootCid()),
Links: outLinks,
}

Expand Down Expand Up @@ -448,7 +448,7 @@ DEPRECATED and provided for legacy reasons. Use 'ipfs dag put' instead.
return err
}

return cmds.EmitOnce(res, &Object{Hash: enc.Encode(p.Cid())})
return cmds.EmitOnce(res, &Object{Hash: enc.Encode(p.RootCid())})
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *Object) error {
Expand Down
16 changes: 8 additions & 8 deletions core/commands/object/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ DEPRECATED and provided for legacy reasons. Use 'ipfs add' or 'ipfs files' inste
return err
}

if err := cmdutils.CheckCIDSize(req, p.Cid(), api.Dag()); err != nil {
if err := cmdutils.CheckCIDSize(req, p.RootCid(), api.Dag()); err != nil {
return err
}

return cmds.EmitOnce(res, &Object{Hash: p.Cid().String()})
return cmds.EmitOnce(res, &Object{Hash: p.RootCid().String()})
},
Type: &Object{},
Encoders: cmds.EncoderMap{
Expand Down Expand Up @@ -144,11 +144,11 @@ DEPRECATED and provided for legacy reasons. Use 'files cp' and 'dag put' instead
return err
}

if err := cmdutils.CheckCIDSize(req, p.Cid(), api.Dag()); err != nil {
if err := cmdutils.CheckCIDSize(req, p.RootCid(), api.Dag()); err != nil {
return err
}

return cmds.EmitOnce(res, &Object{Hash: p.Cid().String()})
return cmds.EmitOnce(res, &Object{Hash: p.RootCid().String()})
},
Type: Object{},
Encoders: cmds.EncoderMap{
Expand Down Expand Up @@ -190,11 +190,11 @@ DEPRECATED and provided for legacy reasons. Use 'files rm' instead.
return err
}

if err := cmdutils.CheckCIDSize(req, p.Cid(), api.Dag()); err != nil {
if err := cmdutils.CheckCIDSize(req, p.RootCid(), api.Dag()); err != nil {
return err
}

return cmds.EmitOnce(res, &Object{Hash: p.Cid().String()})
return cmds.EmitOnce(res, &Object{Hash: p.RootCid().String()})
},
Type: Object{},
Encoders: cmds.EncoderMap{
Expand Down Expand Up @@ -269,11 +269,11 @@ Use MFS and 'files' commands instead:
return err
}

if err := cmdutils.CheckCIDSize(req, p.Cid(), api.Dag()); err != nil {
if err := cmdutils.CheckCIDSize(req, p.RootCid(), api.Dag()); err != nil {
return err
}

return cmds.EmitOnce(res, &Object{Hash: p.Cid().String()})
return cmds.EmitOnce(res, &Object{Hash: p.RootCid().String()})
},
Type: Object{},
Encoders: cmds.EncoderMap{
Expand Down
10 changes: 5 additions & 5 deletions core/commands/pin/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func pinAddMany(ctx context.Context, api coreiface.CoreAPI, enc cidenc.Encoder,
if err := api.Pin().Add(ctx, rp, options.Pin.Recursive(recursive)); err != nil {
return nil, err
}
added[i] = enc.Encode(rp.Cid())
added[i] = enc.Encode(rp.RootCid())
}

return added, nil
Expand Down Expand Up @@ -257,7 +257,7 @@ ipfs pin ls -t indirect <cid>
return err
}

id := enc.Encode(rp.Cid())
id := enc.Encode(rp.RootCid())
pins = append(pins, id)
if err := api.Pin().Rm(req.Context, rp, options.Pin.RmRecursive(recursive)); err != nil {
return err
Expand Down Expand Up @@ -491,7 +491,7 @@ func pinLsKeys(req *cmds.Request, typeStr string, api coreiface.CoreAPI, emit fu
err = emit(PinLsOutputWrapper{
PinLsObject: PinLsObject{
Type: pinType,
Cid: enc.Encode(rp.Cid()),
Cid: enc.Encode(rp.RootCid()),
},
})
if err != nil {
Expand Down Expand Up @@ -532,7 +532,7 @@ func pinLsAll(req *cmds.Request, typeStr string, api coreiface.CoreAPI, emit fun
err = emit(PinLsOutputWrapper{
PinLsObject: PinLsObject{
Type: p.Type(),
Cid: enc.Encode(p.Path().Cid()),
Cid: enc.Encode(p.Path().RootCid()),
},
})
if err != nil {
Expand Down Expand Up @@ -608,7 +608,7 @@ pin.
return err
}

return cmds.EmitOnce(res, &PinOutput{Pins: []string{enc.Encode(from.Cid()), enc.Encode(to.Cid())}})
return cmds.EmitOnce(res, &PinOutput{Pins: []string{enc.Encode(from.RootCid()), enc.Encode(to.RootCid())}})
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *PinOutput) error {
Expand Down
Loading

0 comments on commit 24faf49

Please sign in to comment.