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-unixfs
Commits
e1f2fe75
Commit
e1f2fe75
authored
Oct 25, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add in dag removal
parent
87407a99
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
blockservice/blockservice.go
blockservice/blockservice.go
+4
-0
exchange/bitswap/bitswap.go
exchange/bitswap/bitswap.go
+1
-1
merkledag/merkledag.go
merkledag/merkledag.go
+13
-0
routing/dht/dht.go
routing/dht/dht.go
+5
-1
No files found.
blockservice/blockservice.go
View file @
e1f2fe75
...
...
@@ -76,3 +76,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
return
nil
,
u
.
ErrNotFound
}
}
func
(
s
*
BlockService
)
DeleteBlock
(
k
u
.
Key
)
error
{
return
s
.
Datastore
.
Delete
(
k
.
DsKey
())
}
exchange/bitswap/bitswap.go
View file @
e1f2fe75
...
...
@@ -94,7 +94,7 @@ func (bs *bitswap) Block(parent context.Context, k u.Key) (*blocks.Block, error)
response
,
err
:=
bs
.
sender
.
SendRequest
(
ctx
,
p
,
message
)
if
err
!=
nil
{
log
.
Error
f
(
"Error sender.SendRequest(%s)
"
,
p
)
log
.
Error
(
"Error sender.SendRequest(%s)
= %s"
,
p
,
err
)
return
}
// FIXME ensure accounting is handled correctly when
...
...
merkledag/merkledag.go
View file @
e1f2fe75
...
...
@@ -215,3 +215,16 @@ func (n *DAGService) Get(k u.Key) (*Node, error) {
return
Decoded
(
b
.
Data
)
}
func
(
n
*
DAGService
)
Remove
(
nd
*
Node
)
error
{
for
_
,
l
:=
range
nd
.
Links
{
if
l
.
Node
!=
nil
{
n
.
Remove
(
l
.
Node
)
}
}
k
,
err
:=
nd
.
Key
()
if
err
!=
nil
{
return
err
}
return
n
.
Blocks
.
DeleteBlock
(
k
)
}
routing/dht/dht.go
View file @
e1f2fe75
...
...
@@ -540,7 +540,11 @@ func (dht *IpfsDHT) PingRoutine(t time.Duration) {
func
(
dht
*
IpfsDHT
)
Bootstrap
(
ctx
context
.
Context
)
{
id
:=
make
([]
byte
,
16
)
rand
.
Read
(
id
)
_
,
err
:=
dht
.
FindPeer
(
ctx
,
peer
.
ID
(
id
))
p
,
err
:=
dht
.
FindPeer
(
ctx
,
peer
.
ID
(
id
))
if
err
!=
nil
{
log
.
Error
(
"Bootstrap peer error: %s"
,
err
)
}
err
=
dht
.
dialer
.
DialPeer
(
p
)
if
err
!=
nil
{
log
.
Errorf
(
"Bootstrap peer error: %s"
,
err
)
}
...
...
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