refac(bitswap) privatize strategies
temporarily. until bitswap is refactored
Brian Tiger Chow committed
Sep 16, 2014 at 08:24 UTC
e4bceca2295a21c489a8180c927f2a04f7137cb8
3 files changed
+6
-6
bitswap/bitswap.go
+2
-2
@@ -56,7 +56,7 @@ type bitswap struct {
56
// wantList is the set of keys we want values for. a map for fast lookups.
57
wantList KeySet
58
59
- strategy StrategyFunc
59
+ strategy strategyFunc
60
61
haltChan chan struct{}
62
}
@@ -74,7 +74,7 @@ func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d
74
sender: bsnet.NewNetworkAdapter(s, &receiver),
75
haltChan: make(chan struct{}),
76
notifications: notifications.New(),
77
- strategy: YesManStrategy,
77
+ strategy: yesManStrategy,
78
}
79
receiver.Delegate(bs)
80
bitswap/ledger.go
+1
-1
@@ -30,7 +30,7 @@ type Ledger struct {
30
// wantList is a (bounded, small) set of keys that Partner desires.
31
wantList KeySet
32
33
- Strategy StrategyFunc
33
+ Strategy strategyFunc
34
}
35
36
// LedgerMap lists Ledgers by their Partner key.
bitswap/strategy.go
+3
-3
@@ -5,13 +5,13 @@ import (
5
"math/rand"
6
)
7
8
-type StrategyFunc func(*Ledger) bool
8
+type strategyFunc func(*Ledger) bool
9
10
-func StandardStrategy(l *Ledger) bool {
10
+func standardStrategy(l *Ledger) bool {
11
return rand.Float64() <= probabilitySend(l.Accounting.Value())
12
}
13
14
-func YesManStrategy(l *Ledger) bool {
14
+func yesManStrategy(l *Ledger) bool {
15
return true
16
}
17