mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:30:39 +08:00
fix(bitswap:strategy) move key set
This commit is contained in:
@ -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),
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user