Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
e6559f59
Commit
e6559f59
authored
Jul 29, 2020
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make peer score inspect function types aliases
parent
cce1f8a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
score.go
score.go
+2
-6
No files found.
score.go
View file @
e6559f59
...
...
@@ -114,8 +114,8 @@ const (
deliveryThrottled
// we can't tell if it is valid because validation throttled
)
type
PeerScoreInspectFn
func
(
map
[
peer
.
ID
]
float64
)
type
ExtendedPeerScoreInspectFn
func
(
map
[
peer
.
ID
]
*
PeerScoreSnapshot
)
type
PeerScoreInspectFn
=
func
(
map
[
peer
.
ID
]
float64
)
type
ExtendedPeerScoreInspectFn
=
func
(
map
[
peer
.
ID
]
*
PeerScoreSnapshot
)
type
PeerScoreSnapshot
struct
{
Score
float64
...
...
@@ -155,12 +155,8 @@ func WithPeerScoreInspect(inspect interface{}, period time.Duration) Option {
switch
i
:=
inspect
.
(
type
)
{
case
PeerScoreInspectFn
:
gs
.
score
.
inspect
=
i
case
func
(
map
[
peer
.
ID
]
float64
)
:
gs
.
score
.
inspect
=
PeerScoreInspectFn
(
i
)
case
ExtendedPeerScoreInspectFn
:
gs
.
score
.
inspectEx
=
i
case
func
(
map
[
peer
.
ID
]
*
PeerScoreSnapshot
)
:
gs
.
score
.
inspectEx
=
ExtendedPeerScoreInspectFn
(
i
)
default
:
return
fmt
.
Errorf
(
"unknown peer score insector type: %v"
,
inspect
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment