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-ld-format
Commits
f10b5dd9
Commit
f10b5dd9
authored
Nov 15, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RemoveMany method
parent
b4033237
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
batch_test.go
batch_test.go
+9
-0
merkledag.go
merkledag.go
+5
-0
No files found.
batch_test.go
View file @
f10b5dd9
...
...
@@ -64,6 +64,15 @@ func (d *testDag) Remove(c *cid.Cid) error {
return
nil
}
func
(
d
*
testDag
)
RemoveMany
(
cids
[]
*
cid
.
Cid
)
error
{
d
.
mu
.
Lock
()
defer
d
.
mu
.
Unlock
()
for
_
,
c
:=
range
cids
{
delete
(
d
.
nodes
,
c
.
KeyString
())
}
return
nil
}
var
_
DAGService
=
new
(
testDag
)
func
TestBatch
(
t
*
testing
.
T
)
{
...
...
merkledag.go
View file @
f10b5dd9
...
...
@@ -55,4 +55,9 @@ type DAGService interface {
// Consider using NewBatch instead of calling this directly if you need
// to add an unbounded number of nodes to avoid buffering too much.
AddMany
([]
Node
)
error
// RemoveMany removes many nodes from this DAG.
//
// It returns success even if the nodes were not present in the DAG.
RemoveMany
([]
*
cid
.
Cid
)
error
}
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