Commit b32dcdec authored by Jeromy's avatar Jeromy

fixing mutability issues in ipns

parent 60d738bc
...@@ -75,6 +75,16 @@ func (n *Node) RemoveNodeLink(name string) error { ...@@ -75,6 +75,16 @@ func (n *Node) RemoveNodeLink(name string) error {
return u.ErrNotFound return u.ErrNotFound
} }
func (n *Node) Copy() *Node {
nnode := new(Node)
nnode.Data = make([]byte, len(n.Data))
copy(nnode.Data, n.Data)
nnode.Links = make([]*Link, len(n.Links))
copy(nnode.Links, n.Links)
return nnode
}
// Size returns the total size of the data addressed by node, // Size returns the total size of the data addressed by node,
// including the total sizes of references. // including the total sizes of references.
func (n *Node) Size() (uint64, error) { func (n *Node) Size() (uint64, error) {
......
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