This repository has been archived by the owner on Sep 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
/
presets.go
52 lines (43 loc) · 1.78 KB
/
presets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package connmgr
import (
"time"
"github.com/libp2p/go-libp2p/core/connmgr"
)
// DecayNone applies no decay.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.DecayNone instead
func DecayNone() DecayFn {
return connmgr.DecayNone()
}
// DecayFixed subtracts from by the provided minuend, and deletes the tag when
// first reaching 0 or negative.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.DecayFixed instead
func DecayFixed(minuend int) DecayFn {
return connmgr.DecayFixed(minuend)
}
// DecayLinear applies a fractional coefficient to the value of the current tag,
// rounding down via math.Floor. It erases the tag when the result is zero.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.DecayLinear instead
func DecayLinear(coef float64) DecayFn {
return connmgr.DecayLinear(coef)
}
// DecayExpireWhenInactive expires a tag after a certain period of no bumps.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.DecayExpireWhenInactive instead
func DecayExpireWhenInactive(after time.Duration) DecayFn {
return connmgr.DecayExpireWhenInactive(after)
}
// BumpSumUnbounded adds the incoming value to the peer's score.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.BumpSumUnbounded instead
func BumpSumUnbounded() BumpFn {
return connmgr.BumpSumUnbounded()
}
// BumpSumBounded keeps summing the incoming score, keeping it within a
// [min, max] range.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.BumpSumBounded instead
func BumpSumBounded(min, max int) BumpFn {
return connmgr.BumpSumBounded(min, max)
}
// BumpOverwrite replaces the current value of the tag with the incoming one.
// Deprecated: use github.com/libp2p/go-libp2p/core/connmgr.BumpOverwrite instead
func BumpOverwrite() BumpFn {
return connmgr.BumpOverwrite()
}