-
Notifications
You must be signed in to change notification settings - Fork 199
/
topicFloodPreventerStub.go
42 lines (34 loc) · 1.07 KB
/
topicFloodPreventerStub.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
package mock
import "github.com/ElrondNetwork/elrond-go-core/core"
// TopicAntiFloodStub -
type TopicAntiFloodStub struct {
IncreaseLoadCalled func(pid core.PeerID, topic string, numMessages uint32) error
ResetForTopicCalled func(topic string)
SetMaxMessagesForTopicCalled func(topic string, num uint32)
}
// IncreaseLoad -
func (t *TopicAntiFloodStub) IncreaseLoad(pid core.PeerID, topic string, numMessages uint32) error {
if t.IncreaseLoadCalled != nil {
return t.IncreaseLoadCalled(pid, topic, numMessages)
}
return nil
}
// ResetForTopic -
func (t *TopicAntiFloodStub) ResetForTopic(topic string) {
if t.ResetForTopicCalled != nil {
t.ResetForTopicCalled(topic)
}
}
// ResetForNotRegisteredTopics -
func (t *TopicAntiFloodStub) ResetForNotRegisteredTopics() {
}
// SetMaxMessagesForTopic -
func (t *TopicAntiFloodStub) SetMaxMessagesForTopic(topic string, num uint32) {
if t.SetMaxMessagesForTopicCalled != nil {
t.SetMaxMessagesForTopicCalled(topic, num)
}
}
// IsInterfaceNil -
func (t *TopicAntiFloodStub) IsInterfaceNil() bool {
return t == nil
}