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-dms3
Commits
5c309ccc
Unverified
Commit
5c309ccc
authored
Aug 28, 2018
by
Steven Allen
Committed by
GitHub
Aug 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5308 from ipfs/fix/5295
remove bitswap unwant
parents
66b54d9a
db45c4d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
60 deletions
+1
-60
core/commands/bitswap.go
core/commands/bitswap.go
+0
-48
core/commands/commands_test.go
core/commands/commands_test.go
+0
-1
misc/completion/ipfs-completion.bash
misc/completion/ipfs-completion.bash
+1
-11
No files found.
core/commands/bitswap.go
View file @
5c309ccc
...
...
@@ -16,7 +16,6 @@ import (
cmds
"gx/ipfs/QmPTfgFTo9PFr1PvPKyKoeMgBvYPh6cX3aDP7DHKVbnCbi/go-ipfs-cmds"
peer
"gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer"
cmdkit
"gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
cid
"gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
)
var
BitswapCmd
=
&
cmds
.
Command
{
...
...
@@ -28,58 +27,11 @@ var BitswapCmd = &cmds.Command{
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"stat"
:
bitswapStatCmd
,
"wantlist"
:
lgc
.
NewCommand
(
showWantlistCmd
),
"unwant"
:
lgc
.
NewCommand
(
unwantCmd
),
"ledger"
:
lgc
.
NewCommand
(
ledgerCmd
),
"reprovide"
:
lgc
.
NewCommand
(
reprovideCmd
),
},
}
var
unwantCmd
=
&
oldcmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Remove a given block from your wantlist."
,
},
Arguments
:
[]
cmdkit
.
Argument
{
cmdkit
.
StringArg
(
"key"
,
true
,
true
,
"Key(s) to remove from your wantlist."
)
.
EnableStdin
(),
},
Run
:
func
(
req
oldcmds
.
Request
,
res
oldcmds
.
Response
)
{
nd
,
err
:=
req
.
InvocContext
()
.
GetNode
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
!
nd
.
OnlineMode
()
{
res
.
SetError
(
ErrNotOnline
,
cmdkit
.
ErrClient
)
return
}
bs
,
ok
:=
nd
.
Exchange
.
(
*
bitswap
.
Bitswap
)
if
!
ok
{
res
.
SetError
(
e
.
TypeErr
(
bs
,
nd
.
Exchange
),
cmdkit
.
ErrNormal
)
return
}
var
ks
[]
*
cid
.
Cid
for
_
,
arg
:=
range
req
.
Arguments
()
{
c
,
err
:=
cid
.
Decode
(
arg
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
ks
=
append
(
ks
,
c
)
}
// TODO: This should maybe find *all* sessions for this request and cancel them?
// (why): in reality, i think this command should be removed. Its
// messing with the internal state of bitswap. You should cancel wants
// by killing the command that caused the want.
bs
.
CancelWants
(
ks
,
0
)
res
.
SetOutput
(
nil
)
},
}
var
showWantlistCmd
=
&
oldcmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Show blocks currently on the wantlist."
,
...
...
core/commands/commands_test.go
View file @
5c309ccc
...
...
@@ -73,7 +73,6 @@ func TestCommands(t *testing.T) {
"/bitswap/ledger"
,
"/bitswap/reprovide"
,
"/bitswap/stat"
,
"/bitswap/unwant"
,
"/bitswap/wantlist"
,
"/block"
,
"/block/get"
,
...
...
misc/completion/ipfs-completion.bash
View file @
5c309ccc
...
...
@@ -27,7 +27,7 @@ _ipfs_add()
_ipfs_bitswap
()
{
ipfs_comp
"ledger stat
unwant
wantlist --help"
ipfs_comp
"ledger stat wantlist --help"
}
_ipfs_bitswap_ledger
()
...
...
@@ -40,21 +40,11 @@ _ipfs_bitswap_stat()
_ipfs_help_only
}
_ipfs_bitswap_unwant
()
{
_ipfs_help_only
}
_ipfs_bitswap_wantlist
()
{
ipfs_comp
"--peer= --help"
}
_ipfs_bitswap_unwant
()
{
_ipfs_help_only
}
_ipfs_block
()
{
_ipfs_comp
"get put rm stat --help"
...
...
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