fix(bitswap:strategy) move key set
Brian Tiger Chow committed
Sep 17, 2014 at 18:47 UTC
22539cf6d0593f16cb7f1393cbf0db532427dcd3
2 files changed
+6
-5
bitswap/bitswap.go
+1
-4
@@ -24,10 +24,6 @@ import (
24
// advertisements. WantLists are sorted in terms of priority.
25
const PartnerWantListMax = 10
26
27
-// KeySet is just a convenient alias for maps of keys, where we only care
28
-// access/lookups.
29
-type KeySet map[u.Key]struct{}
30
-
27
// bitswap instances implement the bitswap protocol.
28
type bitswap struct {
29
// peer is the identity of this (local) node.
@@ -59,6 +55,7 @@ func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d
55
bs := &bitswap{
56
blockstore: blockstore.NewBlockstore(d),
57
notifications: notifications.New(),
58
+ strategist: strategy.New(d),
59
peer: p,
60
routing: directory,
61
sender: bsnet.NewNetworkAdapter(s, &receiver),
bitswap/strategy/ledger.go
+5
-1
@@ -8,6 +8,10 @@ import (
8
u "github.com/jbenet/go-ipfs/util"
9
)
10
11
+// keySet is just a convenient alias for maps of keys, where we only care
12
+// access/lookups.
13
+type keySet map[u.Key]struct{}
14
+
15
// ledger stores the data exchange relationship between two peers.
16
type ledger struct {
17
lock sync.RWMutex
@@ -28,7 +32,7 @@ type ledger struct {
32
exchangeCount uint64
33
34
// wantList is a (bounded, small) set of keys that Partner desires.
31
- wantList KeySet
35
+ wantList keySet
36
37
Strategy strategyFunc
38
}