Commit 20acf8b7 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refactor(bitswap/testnet) slim down interface

so it'll be easier to create another implementation using the new
mocknet
parent 94147479
...@@ -5,13 +5,12 @@ import ( ...@@ -5,13 +5,12 @@ import (
"fmt" "fmt"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"github.com/jbenet/go-ipfs/routing"
"github.com/jbenet/go-ipfs/routing/mock"
bsmsg "github.com/jbenet/go-ipfs/exchange/bitswap/message" bsmsg "github.com/jbenet/go-ipfs/exchange/bitswap/message"
bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network" bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
"github.com/jbenet/go-ipfs/util" routing "github.com/jbenet/go-ipfs/routing"
mockrouting "github.com/jbenet/go-ipfs/routing/mock"
util "github.com/jbenet/go-ipfs/util"
delay "github.com/jbenet/go-ipfs/util/delay" delay "github.com/jbenet/go-ipfs/util/delay"
) )
...@@ -19,19 +18,6 @@ type Network interface { ...@@ -19,19 +18,6 @@ type Network interface {
Adapter(peer.ID) bsnet.BitSwapNetwork Adapter(peer.ID) bsnet.BitSwapNetwork
HasPeer(peer.ID) bool HasPeer(peer.ID) bool
SendMessage(
ctx context.Context,
from peer.ID,
to peer.ID,
message bsmsg.BitSwapMessage) error
SendRequest(
ctx context.Context,
from peer.ID,
to peer.ID,
message bsmsg.BitSwapMessage) (
incoming bsmsg.BitSwapMessage, err error)
} }
// network impl // network impl
...@@ -154,7 +140,7 @@ func (n *network) SendRequest( ...@@ -154,7 +140,7 @@ func (n *network) SendRequest(
type networkClient struct { type networkClient struct {
local peer.ID local peer.ID
bsnet.Receiver bsnet.Receiver
network Network network *network
routing routing.IpfsRouting routing routing.IpfsRouting
} }
......
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