Documentation
¶
Index ¶
- type Callback
- type Checker
- type DropPeerFn
- type EventsRequesterFn
- type Fetcher
- func (f *Fetcher) Enqueue(peer string, inEvents inter.Events, t time.Time, fetchEvents EventsRequesterFn) error
- func (f *Fetcher) Notify(peer string, hashes hash.Events, t time.Time, fetchEvents EventsRequesterFn) error
- func (f *Fetcher) Overloaded() bool
- func (f *Fetcher) OverloadedPeer(peer string) bool
- func (f *Fetcher) Start()
- func (f *Fetcher) Stop()
- type FilterInterestedFn
- type MockChecker
- type MockTestData
- type PushEventFn
- type SyncChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback struct { PushEvent PushEventFn OnlyInterested FilterInterestedFn DropPeer DropPeerFn HeavyCheck Checker FirstCheck func(*inter.Event) error }
type Checker ¶
type Checker interface { Start() Stop() Overloaded() bool Enqueue(events inter.Events, onValidated heavycheck.OnValidatedFn) error }
Checker is an interface that represents abstract logic for a checker object
type DropPeerFn ¶
type DropPeerFn func(peer string)
DropPeerFn is a callback type for dropping a peer detected as malicious.
type EventsRequesterFn ¶
EventsRequesterFn is a callback type for sending a event retrieval request.
type Fetcher ¶
Fetcher is responsible for accumulating event announcements from various peers and scheduling them for retrieval.
func (*Fetcher) Enqueue ¶
func (f *Fetcher) Enqueue(peer string, inEvents inter.Events, t time.Time, fetchEvents EventsRequesterFn) error
Enqueue tries to fill gaps the fetcher's future import queue.
func (*Fetcher) Notify ¶
func (f *Fetcher) Notify(peer string, hashes hash.Events, t time.Time, fetchEvents EventsRequesterFn) error
Notify announces the fetcher of the potential availability of a new event in the network.
func (*Fetcher) Overloaded ¶
Overloaded returns true if too much events are being processed or requested
func (*Fetcher) OverloadedPeer ¶
OverloadedPeer returns true if too much events are being processed or requested from the peer
type FilterInterestedFn ¶
FilterInterestedFn returns only event which may be requested.
type MockChecker ¶
type MockChecker struct {
// contains filtered or unexported fields
}
MockChecker is a mock checker made for tests only
func NewMockChecker ¶
func NewMockChecker(resultError error) *MockChecker
NewMockChecker is a constructor for a mock checker
func (*MockChecker) Enqueue ¶
func (m *MockChecker) Enqueue(events inter.Events, onValidated heavycheck.OnValidatedFn) error
Enqueue made for tests only
func (*MockChecker) Overloaded ¶
func (m *MockChecker) Overloaded() bool
Overloaded is an empty implementation
type MockTestData ¶
type MockTestData struct {
// contains filtered or unexported fields
}
MockTestData is a mock Checker for a testing purposes
func NewMockTestData ¶
func NewMockTestData(resultError error) *MockTestData
NewMockTestData is a constructor for a mock test data
func (*MockTestData) GetEvents ¶
func (m *MockTestData) GetEvents() inter.Events
GetEvents is a getter for events
func (*MockTestData) GetOnValidatedFn ¶
func (m *MockTestData) GetOnValidatedFn() heavycheck.OnValidatedFn
GetOnValidatedFn is a getter for onValidated callback
func (*MockTestData) GetResult ¶
func (m *MockTestData) GetResult() []error
GetResult is a getter for result
type PushEventFn ¶
PushEventFn is a callback type to connect a received event
type SyncChecker ¶
type SyncChecker struct {
// contains filtered or unexported fields
}
SyncChecker calls checker.Enqueue synchronously for a testing purposes
func (*SyncChecker) Enqueue ¶
func (s *SyncChecker) Enqueue(events inter.Events, onValidated heavycheck.OnValidatedFn) error
func (*SyncChecker) Overloaded ¶
func (s *SyncChecker) Overloaded() bool
func (*SyncChecker) Start ¶
func (s *SyncChecker) Start()
func (*SyncChecker) Stop ¶
func (s *SyncChecker) Stop()