mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
chore: update boxo for structification of ImmutablePath
This commit is contained in:
parent
a7c6518497
commit
a5668d22ba
@ -43,7 +43,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
|
||||
func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.ObjectPutOption) (path.ImmutablePath, error) {
|
||||
options, err := caopts.ObjectPutOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
var out objectOut
|
||||
@ -54,12 +54,12 @@ func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.Objec
|
||||
FileBody(r).
|
||||
Exec(ctx, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
@ -156,7 +156,7 @@ func (api *ObjectAPI) Stat(ctx context.Context, p path.Path) (*iface.ObjectStat,
|
||||
func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...caopts.ObjectAddLinkOption) (path.ImmutablePath, error) {
|
||||
options, err := caopts.ObjectAddLinkOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
var out objectOut
|
||||
@ -164,12 +164,12 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string,
|
||||
Option("create", options.Create).
|
||||
Exec(ctx, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
@ -180,12 +180,12 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (
|
||||
err := api.core().Request("object/patch/rm-link", base.String(), link).
|
||||
Exec(ctx, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
@ -197,12 +197,12 @@ func (api *ObjectAPI) AppendData(ctx context.Context, p path.Path, r io.Reader)
|
||||
FileBody(r).
|
||||
Exec(ctx, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
@ -214,12 +214,12 @@ func (api *ObjectAPI) SetData(ctx context.Context, p path.Path, r io.Reader) (pa
|
||||
FileBody(r).
|
||||
Exec(ctx, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
|
||||
@ -17,22 +17,22 @@ func (api *HttpApi) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
|
||||
var err error
|
||||
if p.Namespace() == path.IPNSNamespace {
|
||||
if p, err = api.Name().Resolve(ctx, p.String()); err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := api.Request("dag/resolve", p.String()).Exec(ctx, &out); err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
p, err = path.NewPathFromSegments(p.Namespace(), out.Cid.String(), out.RemPath)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
imPath, err := path.NewImmutablePath(p)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
return imPath, path.StringToSegments(out.RemPath), nil
|
||||
|
||||
@ -29,12 +29,12 @@ type UnixfsAPI HttpApi
|
||||
func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.UnixfsAddOption) (path.ImmutablePath, error) {
|
||||
options, _, err := caopts.UnixfsAddOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
mht, ok := mh.Codes[options.MhType]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unknowm mhType %d", options.MhType)
|
||||
return path.ImmutablePath{}, fmt.Errorf("unknowm mhType %d", options.MhType)
|
||||
}
|
||||
|
||||
req := api.core().Request("add").
|
||||
@ -65,7 +65,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.Unix
|
||||
|
||||
version, err := api.core().loadRemoteVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
useEncodedAbsPaths := version.LT(encodedAbsolutePathVersion)
|
||||
req.Body(files.NewMultiFileReader(d, false, useEncodedAbsPaths))
|
||||
@ -73,10 +73,10 @@ func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.Unix
|
||||
var out addEvent
|
||||
resp, err := req.Send(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
if resp.Error != nil {
|
||||
return nil, resp.Error
|
||||
return path.ImmutablePath{}, resp.Error
|
||||
}
|
||||
defer resp.Output.Close()
|
||||
dec := json.NewDecoder(resp.Output)
|
||||
@ -88,7 +88,7 @@ loop:
|
||||
case io.EOF:
|
||||
break loop
|
||||
default:
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
out = evt
|
||||
|
||||
@ -102,7 +102,7 @@ loop:
|
||||
if out.Hash != "" {
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
ifevt.Path = path.FromCid(c)
|
||||
@ -111,14 +111,14 @@ loop:
|
||||
select {
|
||||
case options.Events <- ifevt:
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
return path.ImmutablePath{}, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c, err := cid.Parse(out.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(c), nil
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
gopath "path"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/kubo/core/commands/cmdenv"
|
||||
@ -15,6 +15,7 @@ import (
|
||||
"github.com/ipfs/boxo/coreiface/options"
|
||||
"github.com/ipfs/boxo/files"
|
||||
mfs "github.com/ipfs/boxo/mfs"
|
||||
"github.com/ipfs/boxo/path"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
@ -301,7 +302,7 @@ See 'dag export' and 'dag import' for more information.
|
||||
return
|
||||
}
|
||||
// if MFS destination is a dir, append filename to the dir path
|
||||
toFilesDst += path.Base(addit.Name())
|
||||
toFilesDst += gopath.Base(addit.Name())
|
||||
}
|
||||
|
||||
// error if we try to overwrite a preexisting file destination
|
||||
@ -310,9 +311,9 @@ See 'dag export' and 'dag import' for more information.
|
||||
return
|
||||
}
|
||||
|
||||
_, err = mfs.Lookup(ipfsNode.FilesRoot, path.Dir(toFilesDst))
|
||||
_, err = mfs.Lookup(ipfsNode.FilesRoot, gopath.Dir(toFilesDst))
|
||||
if err != nil {
|
||||
errCh <- fmt.Errorf("%s: MFS destination parent %q %q does not exist: %w", toFilesOptionName, toFilesDst, path.Dir(toFilesDst), err)
|
||||
errCh <- fmt.Errorf("%s: MFS destination parent %q %q does not exist: %w", toFilesOptionName, toFilesDst, gopath.Dir(toFilesDst), err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -339,14 +340,14 @@ See 'dag export' and 'dag import' for more information.
|
||||
}
|
||||
|
||||
h := ""
|
||||
if output.Path != nil {
|
||||
if (output.Path != path.ImmutablePath{}) {
|
||||
h = enc.Encode(output.Path.RootCid())
|
||||
}
|
||||
|
||||
if !dir && addit.Name() != "" {
|
||||
output.Name = addit.Name()
|
||||
} else {
|
||||
output.Name = path.Join(addit.Name(), output.Name)
|
||||
output.Name = gopath.Join(addit.Name(), output.Name)
|
||||
}
|
||||
|
||||
if err := res.Emit(&AddEvent{
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/boxo/ipld/merkledag/dagutils"
|
||||
"github.com/ipfs/boxo/path"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
|
||||
cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
|
||||
@ -82,11 +83,11 @@ Example:
|
||||
Path: change.Path,
|
||||
}
|
||||
|
||||
if change.Before != nil {
|
||||
if (change.Before != path.ImmutablePath{}) {
|
||||
out[i].Before = change.Before.RootCid()
|
||||
}
|
||||
|
||||
if change.After != nil {
|
||||
if (change.After != path.ImmutablePath{}) {
|
||||
out[i].After = change.After.RootCid()
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
|
||||
options, err := caopts.ObjectPutOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
span.SetAttributes(
|
||||
attribute.Bool("pin", options.Pin),
|
||||
@ -81,7 +81,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
|
||||
data, err := io.ReadAll(io.LimitReader(src, inputLimit+10))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
var dagnode *dag.ProtoNode
|
||||
@ -92,12 +92,12 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
decoder.DisallowUnknownFields()
|
||||
err = decoder.Decode(node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
dagnode, err = deserializeNode(node, options.DataType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
case "protobuf":
|
||||
@ -107,20 +107,20 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
node := new(Node)
|
||||
err = xml.Unmarshal(data, node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
dagnode, err = deserializeNode(node, options.DataType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, errors.New("unknown object encoding")
|
||||
return path.ImmutablePath{}, errors.New("unknown object encoding")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
if options.Pin {
|
||||
@ -129,17 +129,17 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
|
||||
err = api.dag.Add(ctx, dagnode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
if options.Pin {
|
||||
if err := api.pinning.PinWithMode(ctx, dagnode.Cid(), pin.Recursive); err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
err = api.pinning.Flush(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,23 +223,23 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string,
|
||||
|
||||
options, err := caopts.ObjectAddLinkOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
span.SetAttributes(attribute.Bool("create", options.Create))
|
||||
|
||||
baseNd, err := api.core().ResolveNode(ctx, base)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
childNd, err := api.core().ResolveNode(ctx, child)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
basePb, ok := baseNd.(*dag.ProtoNode)
|
||||
if !ok {
|
||||
return nil, dag.ErrNotProtobuf
|
||||
return path.ImmutablePath{}, dag.ErrNotProtobuf
|
||||
}
|
||||
|
||||
var createfunc func() *dag.ProtoNode
|
||||
@ -251,12 +251,12 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string,
|
||||
|
||||
err = e.InsertNodeAtPath(ctx, name, childNd, createfunc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
nnode, err := e.Finalize(ctx, api.dag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(nnode.Cid()), nil
|
||||
@ -271,24 +271,24 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (
|
||||
|
||||
baseNd, err := api.core().ResolveNode(ctx, base)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
basePb, ok := baseNd.(*dag.ProtoNode)
|
||||
if !ok {
|
||||
return nil, dag.ErrNotProtobuf
|
||||
return path.ImmutablePath{}, dag.ErrNotProtobuf
|
||||
}
|
||||
|
||||
e := dagutils.NewDagEditor(basePb, api.dag)
|
||||
|
||||
err = e.RmLink(ctx, link)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
nnode, err := e.Finalize(ctx, api.dag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(nnode.Cid()), nil
|
||||
@ -311,17 +311,17 @@ func (api *ObjectAPI) SetData(ctx context.Context, path path.Path, r io.Reader)
|
||||
func (api *ObjectAPI) patchData(ctx context.Context, p path.Path, r io.Reader, appendData bool) (path.ImmutablePath, error) {
|
||||
nd, err := api.core().ResolveNode(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
pbnd, ok := nd.(*dag.ProtoNode)
|
||||
if !ok {
|
||||
return nil, dag.ErrNotProtobuf
|
||||
return path.ImmutablePath{}, dag.ErrNotProtobuf
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
if appendData {
|
||||
@ -331,7 +331,7 @@ func (api *ObjectAPI) patchData(ctx context.Context, p path.Path, r io.Reader, a
|
||||
|
||||
err = api.dag.Add(ctx, pbnd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
return path.FromCid(pbnd.Cid()), nil
|
||||
|
||||
@ -42,9 +42,9 @@ func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
|
||||
|
||||
p, err := resolve.ResolveIPNS(ctx, api.namesys, p)
|
||||
if err == resolve.ErrNoNamesys {
|
||||
return nil, nil, coreiface.ErrOffline
|
||||
return path.ImmutablePath{}, nil, coreiface.ErrOffline
|
||||
} else if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
var resolver ipfspathresolver.Resolver
|
||||
@ -54,17 +54,17 @@ func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
|
||||
case path.IPFSNamespace:
|
||||
resolver = api.unixFSPathResolver
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unsupported path namespace: %s", p.Namespace())
|
||||
return path.ImmutablePath{}, nil, fmt.Errorf("unsupported path namespace: %s", p.Namespace())
|
||||
}
|
||||
|
||||
imPath, err := path.NewImmutablePath(p)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
node, remainder, err := resolver.ResolveToLastNode(ctx, imPath)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
segments := []string{p.Namespace(), node.String()}
|
||||
@ -72,12 +72,12 @@ func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
|
||||
|
||||
p, err = path.NewPathFromSegments(segments...)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
imPath, err = path.NewImmutablePath(p)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return path.ImmutablePath{}, nil, err
|
||||
}
|
||||
|
||||
return imPath, remainder, nil
|
||||
|
||||
@ -64,7 +64,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
|
||||
settings, prefix, err := options.UnixfsAddOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
span.SetAttributes(
|
||||
@ -85,7 +85,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
|
||||
cfg, err := api.repo.Config()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
// check if repo will exceed storage limit if added
|
||||
@ -97,7 +97,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
//}
|
||||
|
||||
if settings.NoCopy && !(cfg.Experimental.FilestoreEnabled || cfg.Experimental.UrlstoreEnabled) {
|
||||
return nil, fmt.Errorf("either the filestore or the urlstore must be enabled to use nocopy, see: https://github.com/ipfs/kubo/blob/master/docs/experimental-features.md#ipfs-filestore")
|
||||
return path.ImmutablePath{}, fmt.Errorf("either the filestore or the urlstore must be enabled to use nocopy, see: https://github.com/ipfs/kubo/blob/master/docs/experimental-features.md#ipfs-filestore")
|
||||
}
|
||||
|
||||
addblockstore := api.blockstore
|
||||
@ -110,7 +110,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
if settings.OnlyHash {
|
||||
node, err := getOrCreateNilNode()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
addblockstore = node.Blockstore
|
||||
exch = node.Exchange
|
||||
@ -144,7 +144,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
|
||||
fileAdder, err := coreunix.NewAdder(ctx, pinning, addblockstore, syncDserv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
fileAdder.Chunker = settings.Chunker
|
||||
@ -164,7 +164,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
case options.TrickleLayout:
|
||||
fileAdder.Trickle = true
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown layout: %d", settings.Layout)
|
||||
return path.ImmutablePath{}, fmt.Errorf("unknown layout: %d", settings.Layout)
|
||||
}
|
||||
|
||||
if settings.Inline {
|
||||
@ -180,11 +180,11 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
// Use the same prefix for the "empty" MFS root as for the file adder.
|
||||
err := emptyDirNode.SetCidBuilder(fileAdder.CidBuilder)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
mr, err := mfs.NewRoot(ctx, md, emptyDirNode, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
fileAdder.SetMfsRoot(mr)
|
||||
@ -192,12 +192,12 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
|
||||
nd, err := fileAdder.AddAllAndPin(ctx, files)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
|
||||
if !settings.OnlyHash {
|
||||
if err := api.provider.Provide(nd.Cid()); err != nil {
|
||||
return nil, err
|
||||
return path.ImmutablePath{}, err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ go 1.20
|
||||
replace github.com/ipfs/kubo => ./../../..
|
||||
|
||||
require (
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea
|
||||
github.com/ipfs/kubo v0.0.0-00010101000000-000000000000
|
||||
github.com/libp2p/go-libp2p v0.31.0
|
||||
github.com/multiformats/go-multiaddr v0.11.0
|
||||
|
||||
@ -300,8 +300,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
|
||||
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664 h1:wserB+u/lpguBpxuKNNzwJR+rOSHxWufm3ZzNgN3d24=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea h1:CygWxN8BL+d1F6PBOI+02UKqkpASP0ai459aw6ANZTg=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
|
||||
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
|
||||
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
|
||||
|
||||
2
go.mod
2
go.mod
@ -15,7 +15,7 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.6.0
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea
|
||||
github.com/ipfs/go-block-format v0.2.0
|
||||
github.com/ipfs/go-cid v0.4.1
|
||||
github.com/ipfs/go-cidutil v0.1.0
|
||||
|
||||
4
go.sum
4
go.sum
@ -335,8 +335,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
|
||||
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664 h1:wserB+u/lpguBpxuKNNzwJR+rOSHxWufm3ZzNgN3d24=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea h1:CygWxN8BL+d1F6PBOI+02UKqkpASP0ai459aw6ANZTg=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
|
||||
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
|
||||
github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ=
|
||||
|
||||
@ -7,7 +7,7 @@ replace github.com/ipfs/kubo => ../../
|
||||
require (
|
||||
github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd
|
||||
github.com/golangci/golangci-lint v1.54.1
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea
|
||||
github.com/ipfs/go-cid v0.4.1
|
||||
github.com/ipfs/go-cidutil v0.1.0
|
||||
github.com/ipfs/go-datastore v0.6.0
|
||||
|
||||
@ -396,8 +396,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
|
||||
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664 h1:wserB+u/lpguBpxuKNNzwJR+rOSHxWufm3ZzNgN3d24=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231006140423-85c180e26664/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea h1:CygWxN8BL+d1F6PBOI+02UKqkpASP0ai459aw6ANZTg=
|
||||
github.com/ipfs/boxo v0.13.2-0.20231009073559-45c797e0ccea/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
|
||||
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
|
||||
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
|
||||
github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user