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-bitswap
Commits
9ac61865
Commit
9ac61865
authored
Oct 27, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(bitswap) rename Adapter -> BitSwapNetwork for clarity
parent
014813e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
bitswap.go
bitswap.go
+1
-1
network/interface.go
network/interface.go
+3
-3
network/net_message_adapter.go
network/net_message_adapter.go
+1
-1
testnet/network.go
testnet/network.go
+2
-2
No files found.
bitswap.go
View file @
9ac61865
...
...
@@ -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
...
...
network/interface.go
View file @
9ac61865
...
...
@@ -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
...
...
network/net_message_adapter.go
View file @
9ac61865
...
...
@@ -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
,
...
...
testnet/network.go
View file @
9ac61865
...
...
@@ -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
,
...
...
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