Commit 9ac61865 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

style(bitswap) rename Adapter -> BitSwapNetwork for clarity

parent 014813e8
......@@ -57,7 +57,7 @@ func NetMessageSession(ctx context.Context, p peer.Peer,
type bitswap struct {
// sender delivers messages on behalf of the session
sender bsnet.Adapter
sender bsnet.BitSwapNetwork
// blockstore is the local database
// NB: ensure threadsafety
......
......@@ -8,8 +8,8 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
// Adapter provides network connectivity for BitSwap sessions
type Adapter interface {
// BitSwapNetwork provides network connectivity for BitSwap sessions
type BitSwapNetwork interface {
// DialPeer ensures there is a connection to peer.
DialPeer(context.Context, peer.Peer) error
......@@ -31,6 +31,7 @@ type Adapter interface {
SetDelegate(Receiver)
}
// Implement Receiver to receive messages from the BitSwapNetwork
type Receiver interface {
ReceiveMessage(
ctx context.Context, sender peer.Peer, incoming bsmsg.BitSwapMessage) (
......@@ -39,7 +40,6 @@ type Receiver interface {
ReceiveError(error)
}
// TODO rename -> Router?
type Routing interface {
// FindProvidersAsync returns a channel of providers for the given key
FindProvidersAsync(context.Context, u.Key, int) <-chan peer.Peer
......
......@@ -15,7 +15,7 @@ import (
var log = util.Logger("net_message_adapter")
// NetMessageAdapter wraps a NetMessage network service
func NetMessageAdapter(s inet.Service, n inet.Network, r Receiver) Adapter {
func NetMessageAdapter(s inet.Service, n inet.Network, r Receiver) BitSwapNetwork {
adapter := impl{
nms: s,
net: n,
......
......@@ -13,7 +13,7 @@ import (
)
type Network interface {
Adapter(peer.Peer) bsnet.Adapter
Adapter(peer.Peer) bsnet.BitSwapNetwork
HasPeer(peer.Peer) bool
......@@ -43,7 +43,7 @@ type network struct {
clients map[util.Key]bsnet.Receiver
}
func (n *network) Adapter(p peer.Peer) bsnet.Adapter {
func (n *network) Adapter(p peer.Peer) bsnet.BitSwapNetwork {
client := &networkClient{
local: p,
network: n,
......
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