提交 e4bceca2 作者: Brian Tiger Chow

refac(bitswap) privatize strategies

temporarily. until bitswap is refactored
上级 c07578d6
...@@ -56,7 +56,7 @@ type bitswap struct { ...@@ -56,7 +56,7 @@ type bitswap struct {
// wantList is the set of keys we want values for. a map for fast lookups. // wantList is the set of keys we want values for. a map for fast lookups.
wantList KeySet wantList KeySet
strategy StrategyFunc strategy strategyFunc
haltChan chan struct{} haltChan chan struct{}
} }
...@@ -74,7 +74,7 @@ func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d ...@@ -74,7 +74,7 @@ func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d
sender: bsnet.NewNetworkAdapter(s, &receiver), sender: bsnet.NewNetworkAdapter(s, &receiver),
haltChan: make(chan struct{}), haltChan: make(chan struct{}),
notifications: notifications.New(), notifications: notifications.New(),
strategy: YesManStrategy, strategy: yesManStrategy,
} }
receiver.Delegate(bs) receiver.Delegate(bs)
......
...@@ -30,7 +30,7 @@ type Ledger struct { ...@@ -30,7 +30,7 @@ type Ledger struct {
// wantList is a (bounded, small) set of keys that Partner desires. // wantList is a (bounded, small) set of keys that Partner desires.
wantList KeySet wantList KeySet
Strategy StrategyFunc Strategy strategyFunc
} }
// LedgerMap lists Ledgers by their Partner key. // LedgerMap lists Ledgers by their Partner key.
......
...@@ -5,13 +5,13 @@ import ( ...@@ -5,13 +5,13 @@ import (
"math/rand" "math/rand"
) )
type StrategyFunc func(*Ledger) bool type strategyFunc func(*Ledger) bool
func StandardStrategy(l *Ledger) bool { func standardStrategy(l *Ledger) bool {
return rand.Float64() <= probabilitySend(l.Accounting.Value()) return rand.Float64() <= probabilitySend(l.Accounting.Value())
} }
func YesManStrategy(l *Ledger) bool { func yesManStrategy(l *Ledger) bool {
return true return true
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论