Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
a83cbb99
Commit
a83cbb99
authored
Mar 19, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invalidate merkledag cache when modifying children
parent
d54bc701
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
node.go
node.go
+3
-0
No files found.
node.go
View file @
a83cbb99
...
@@ -87,6 +87,7 @@ func (l *Link) GetNode(serv DAGService) (*Node, error) {
...
@@ -87,6 +87,7 @@ func (l *Link) GetNode(serv DAGService) (*Node, error) {
// AddNodeLink adds a link to another node.
// AddNodeLink adds a link to another node.
func
(
n
*
Node
)
AddNodeLink
(
name
string
,
that
*
Node
)
error
{
func
(
n
*
Node
)
AddNodeLink
(
name
string
,
that
*
Node
)
error
{
n
.
encoded
=
nil
lnk
,
err
:=
MakeLink
(
that
)
lnk
,
err
:=
MakeLink
(
that
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -101,6 +102,7 @@ func (n *Node) AddNodeLink(name string, that *Node) error {
...
@@ -101,6 +102,7 @@ func (n *Node) AddNodeLink(name string, that *Node) error {
// AddNodeLink adds a link to another node. without keeping a reference to
// AddNodeLink adds a link to another node. without keeping a reference to
// the child node
// the child node
func
(
n
*
Node
)
AddNodeLinkClean
(
name
string
,
that
*
Node
)
error
{
func
(
n
*
Node
)
AddNodeLinkClean
(
name
string
,
that
*
Node
)
error
{
n
.
encoded
=
nil
lnk
,
err
:=
MakeLink
(
that
)
lnk
,
err
:=
MakeLink
(
that
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -113,6 +115,7 @@ func (n *Node) AddNodeLinkClean(name string, that *Node) error {
...
@@ -113,6 +115,7 @@ func (n *Node) AddNodeLinkClean(name string, that *Node) error {
// Remove a link on this node by the given name
// Remove a link on this node by the given name
func
(
n
*
Node
)
RemoveNodeLink
(
name
string
)
error
{
func
(
n
*
Node
)
RemoveNodeLink
(
name
string
)
error
{
n
.
encoded
=
nil
for
i
,
l
:=
range
n
.
Links
{
for
i
,
l
:=
range
n
.
Links
{
if
l
.
Name
==
name
{
if
l
.
Name
==
name
{
n
.
Links
=
append
(
n
.
Links
[
:
i
],
n
.
Links
[
i
+
1
:
]
...
)
n
.
Links
=
append
(
n
.
Links
[
:
i
],
n
.
Links
[
i
+
1
:
]
...
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment