Commit 2ea71743 authored by Jeromy's avatar Jeromy Committed by Juan Batiz-Benet

move mem-dag construction to its own function, and actually call WriteOutputTo

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent ae63887c
...@@ -98,6 +98,9 @@ func (n *dagService) Get(ctx context.Context, k key.Key) (*Node, error) { ...@@ -98,6 +98,9 @@ func (n *dagService) Get(ctx context.Context, k key.Key) (*Node, error) {
b, err := n.Blocks.GetBlock(ctx, k) b, err := n.Blocks.GetBlock(ctx, k)
if err != nil { if err != nil {
if err == bserv.ErrNotFound {
return nil, ErrNotFound
}
return nil, err return nil, err
} }
......
...@@ -41,7 +41,11 @@ func ApplyChange(ctx context.Context, ds dag.DAGService, nd *dag.Node, cs []*Cha ...@@ -41,7 +41,11 @@ func ApplyChange(ctx context.Context, ds dag.DAGService, nd *dag.Node, cs []*Cha
for _, c := range cs { for _, c := range cs {
switch c.Type { switch c.Type {
case Add: case Add:
err := e.InsertNodeAtPath(ctx, c.Path, c.After, nil) child, err := ds.Get(ctx, c.After)
if err != nil {
return nil, err
}
err = e.InsertNodeAtPath(ctx, c.Path, child, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -57,7 +61,11 @@ func ApplyChange(ctx context.Context, ds dag.DAGService, nd *dag.Node, cs []*Cha ...@@ -57,7 +61,11 @@ func ApplyChange(ctx context.Context, ds dag.DAGService, nd *dag.Node, cs []*Cha
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = e.InsertNodeAtPath(ctx, c.Path, c.After, nil) child, err := ds.Get(ctx, c.After)
if err != nil {
return nil, err
}
err = e.InsertNodeAtPath(ctx, c.Path, child, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
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