提交 e4bceca2 作者: Brian Tiger Chow

refac(bitswap) privatize strategies

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