Commit c20b9a52 authored by Michael Muré's avatar Michael Muré

sever the dependancy with go-path and interface-go-ipfs-core

parent 74471d62
......@@ -7,13 +7,16 @@ import (
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
dag "github.com/ipfs/go-merkledag"
coreiface "github.com/ipfs/interface-go-ipfs-core"
)
// ChangeType denotes type of change in Change
type ChangeType int
// These constants define the changes that can be applied to a DAG.
const (
Add = iota
Add ChangeType = iota
Remove
Mod
)
......@@ -21,7 +24,7 @@ const (
// Change represents a change to a DAG and contains a reference to the old and
// new CIDs.
type Change struct {
Type coreiface.ChangeType
Type ChangeType
Path string
Before cid.Cid
After cid.Cid
......
......@@ -4,10 +4,10 @@ import (
"context"
"fmt"
mdag "github.com/ipfs/go-merkledag"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
mdag "github.com/ipfs/go-merkledag"
)
// DiffEnumerate fetches every object in the graph pointed to by 'to' that is
......
......@@ -5,11 +5,11 @@ import (
"fmt"
"testing"
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
dag "github.com/ipfs/go-merkledag"
mdtest "github.com/ipfs/go-merkledag/test"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)
func buildNode(name string, desc map[string]ndesc, out map[string]ipld.Node) ipld.Node {
......
......@@ -3,16 +3,16 @@ package dagutils
import (
"context"
"errors"
"strings"
bserv "github.com/ipfs/go-blockservice"
dag "github.com/ipfs/go-merkledag"
path "github.com/ipfs/go-path"
ds "github.com/ipfs/go-datastore"
syncds "github.com/ipfs/go-datastore/sync"
bstore "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline"
ipld "github.com/ipfs/go-ipld-format"
dag "github.com/ipfs/go-merkledag"
)
// Editor represents a ProtoNode tree editor and provides methods to
......@@ -87,7 +87,7 @@ func addLink(ctx context.Context, ds ipld.DAGService, root *dag.ProtoNode, child
// InsertNodeAtPath inserts a new node in the tree and replaces the current root with the new one.
func (e *Editor) InsertNodeAtPath(ctx context.Context, pth string, toinsert ipld.Node, create func() *dag.ProtoNode) error {
splpath := path.SplitList(pth)
splpath := strings.Split(pth, "/")
nd, err := e.insertNodeAtPath(ctx, e.root, splpath, toinsert, create)
if err != nil {
return err
......@@ -143,7 +143,7 @@ func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.ProtoNode, path
// RmLink removes the link with the given name and updates the root node of
// the editor.
func (e *Editor) RmLink(ctx context.Context, pth string) error {
splpath := path.SplitList(pth)
splpath := strings.Split(pth, "/")
nd, err := e.rmLink(ctx, e.root, splpath)
if err != nil {
return err
......
......@@ -2,14 +2,14 @@ package dagutils
import (
"context"
"strings"
"testing"
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
dag "github.com/ipfs/go-merkledag"
mdtest "github.com/ipfs/go-merkledag/test"
path "github.com/ipfs/go-path"
cid "github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)
func TestAddLink(t *testing.T) {
......@@ -42,7 +42,7 @@ func TestAddLink(t *testing.T) {
}
func assertNodeAtPath(t *testing.T, ds ipld.DAGService, root *dag.ProtoNode, pth string, exp cid.Cid) {
parts := path.SplitList(pth)
parts := strings.Split(pth, "/")
cur := root
for _, e := range parts {
nxt, err := cur.GetLinkedProtoNode(context.Background(), ds, e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment