mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
gx update and fix code to use new Cid type
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org> This commit was moved from ipfs/interface-go-ipfs-core@bdbcb4cff0 This commit was moved from ipfs/boxo@a48e694f9d
This commit is contained in:
parent
f56bdca2e6
commit
00a0dc6a4b
@ -5,7 +5,7 @@ package iface
|
||||
import (
|
||||
"context"
|
||||
|
||||
ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format"
|
||||
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
|
||||
)
|
||||
|
||||
// CoreAPI defines an unified interface to IPFS for Go programs
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
||||
|
||||
ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format"
|
||||
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
|
||||
)
|
||||
|
||||
// DagOps groups operations that can be batched together
|
||||
|
||||
@ -6,14 +6,14 @@ import (
|
||||
|
||||
options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
||||
|
||||
ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format"
|
||||
cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
|
||||
cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid"
|
||||
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
|
||||
)
|
||||
|
||||
// ObjectStat provides information about dag nodes
|
||||
type ObjectStat struct {
|
||||
// Cid is the CID of the node
|
||||
Cid *cid.Cid
|
||||
Cid cid.Cid
|
||||
|
||||
// NumLinks is number of links the node contains
|
||||
NumLinks int
|
||||
|
||||
@ -2,8 +2,8 @@ package options
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid"
|
||||
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
|
||||
cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
|
||||
)
|
||||
|
||||
type BlockPutSettings struct {
|
||||
|
||||
@ -3,7 +3,7 @@ package options
|
||||
import (
|
||||
"math"
|
||||
|
||||
cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
|
||||
cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid"
|
||||
)
|
||||
|
||||
type DagPutSettings struct {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package iface
|
||||
|
||||
import (
|
||||
ipfspath "gx/ipfs/QmNgXoHgXU1HzNb2HEZmRww9fDKE9NfDsvQwWLHiKHpvKM/go-path"
|
||||
ipfspath "gx/ipfs/QmRYx6fJzTWFoeTo3qQn64iDrVC154Gy9waQDhvKRr2ND3/go-path"
|
||||
|
||||
cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
|
||||
cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid"
|
||||
)
|
||||
|
||||
//TODO: merge with ipfspath so we don't depend on it
|
||||
@ -65,7 +65,7 @@ type ResolvedPath interface {
|
||||
// * Calling Cid() will return `cidB`
|
||||
// * Calling Root() will return `cidRoot`
|
||||
// * Calling Remainder() will return `foo/bar`
|
||||
Cid() *cid.Cid
|
||||
Cid() cid.Cid
|
||||
|
||||
// Root returns the CID of the root object of the path
|
||||
//
|
||||
@ -74,7 +74,7 @@ type ResolvedPath interface {
|
||||
// "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot
|
||||
//
|
||||
// For more examples see the documentation of Cid() method
|
||||
Root() *cid.Cid
|
||||
Root() cid.Cid
|
||||
|
||||
// Remainder returns unresolved part of the path
|
||||
//
|
||||
@ -100,13 +100,13 @@ type path struct {
|
||||
// resolvedPath implements coreiface.resolvedPath
|
||||
type resolvedPath struct {
|
||||
path
|
||||
cid *cid.Cid
|
||||
root *cid.Cid
|
||||
cid cid.Cid
|
||||
root cid.Cid
|
||||
remainder string
|
||||
}
|
||||
|
||||
// IpfsPath creates new /ipfs path from the provided CID
|
||||
func IpfsPath(c *cid.Cid) ResolvedPath {
|
||||
func IpfsPath(c cid.Cid) ResolvedPath {
|
||||
return &resolvedPath{
|
||||
path: path{ipfspath.Path("/ipfs/" + c.String())},
|
||||
cid: c,
|
||||
@ -116,7 +116,7 @@ func IpfsPath(c *cid.Cid) ResolvedPath {
|
||||
}
|
||||
|
||||
// IpldPath creates new /ipld path from the provided CID
|
||||
func IpldPath(c *cid.Cid) ResolvedPath {
|
||||
func IpldPath(c cid.Cid) ResolvedPath {
|
||||
return &resolvedPath{
|
||||
path: path{ipfspath.Path("/ipld/" + c.String())},
|
||||
cid: c,
|
||||
@ -138,7 +138,7 @@ func ParsePath(p string) (Path, error) {
|
||||
// NewResolvedPath creates new ResolvedPath. This function performs no checks
|
||||
// and is intended to be used by resolver implementations. Incorrect inputs may
|
||||
// cause panics. Handle with care.
|
||||
func NewResolvedPath(ipath ipfspath.Path, c *cid.Cid, root *cid.Cid, remainder string) ResolvedPath {
|
||||
func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath {
|
||||
return &resolvedPath{
|
||||
path: path{ipath},
|
||||
cid: c,
|
||||
@ -163,11 +163,11 @@ func (p *path) Mutable() bool {
|
||||
return p.Namespace() == "ipns"
|
||||
}
|
||||
|
||||
func (p *resolvedPath) Cid() *cid.Cid {
|
||||
func (p *resolvedPath) Cid() cid.Cid {
|
||||
return p.cid
|
||||
}
|
||||
|
||||
func (p *resolvedPath) Root() *cid.Cid {
|
||||
func (p *resolvedPath) Root() cid.Cid {
|
||||
return p.root
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format"
|
||||
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
|
||||
)
|
||||
|
||||
// UnixfsAPI is the basic interface to immutable files in IPFS
|
||||
|
||||
Loading…
Reference in New Issue
Block a user