From 22539cf6d0593f16cb7f1393cbf0db532427dcd3 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow <brian.holderchow@gmail.com> Date: Wed, 17 Sep 2014 18:47:40 -0700 Subject: [PATCH] fix(bitswap:strategy) move key set --- bitswap/bitswap.go | 5 +---- bitswap/strategy/ledger.go | 6 +++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bitswap/bitswap.go b/bitswap/bitswap.go index 8a7e2bda2..fcc3128b0 100644 --- a/bitswap/bitswap.go +++ b/bitswap/bitswap.go @@ -24,10 +24,6 @@ import ( // advertisements. WantLists are sorted in terms of priority. const PartnerWantListMax = 10 -// KeySet is just a convenient alias for maps of keys, where we only care -// access/lookups. -type KeySet map[u.Key]struct{} - // bitswap instances implement the bitswap protocol. type bitswap struct { // peer is the identity of this (local) node. @@ -59,6 +55,7 @@ func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d bs := &bitswap{ blockstore: blockstore.NewBlockstore(d), notifications: notifications.New(), + strategist: strategy.New(d), peer: p, routing: directory, sender: bsnet.NewNetworkAdapter(s, &receiver), diff --git a/bitswap/strategy/ledger.go b/bitswap/strategy/ledger.go index 03781056f..0ee3a1021 100644 --- a/bitswap/strategy/ledger.go +++ b/bitswap/strategy/ledger.go @@ -8,6 +8,10 @@ import ( u "github.com/jbenet/go-ipfs/util" ) +// keySet is just a convenient alias for maps of keys, where we only care +// access/lookups. +type keySet map[u.Key]struct{} + // ledger stores the data exchange relationship between two peers. type ledger struct { lock sync.RWMutex @@ -28,7 +32,7 @@ type ledger struct { exchangeCount uint64 // wantList is a (bounded, small) set of keys that Partner desires. - wantList KeySet + wantList keySet Strategy strategyFunc } -- GitLab