tasks

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLiveChecksPerRun = 20 // Max Live Checks per run
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LiveCheckTask

type LiveCheckTask struct {
	NodeTable             *routingtable.RoutingTable // The routing table
	CheckInterval         int                        // the check interval given in time.Seconds
	MaxRetriesForEviction int                        // The maximum number of retries for evicting a peer from bucket.
	IsTaskAlive           bool                       // is the task alive?
	ProtoMessenger        *network.ProtocolMessenger // The protocol Messenger
}

LiveCheckTask is a background task that executes at least once in the specifies interval. It checks for the "Liveliness" of the peers in the routingtable.RoutingTable, Once the peer is un responsive for a number of tries, then it evicts the peer from the routingtable.RoutingTable Each ping is restricted to 10 seconds. This can be added as a configurable param later if needed.

func NewLiveCheckTask

func NewLiveCheckTask(routingTable *routingtable.RoutingTable, checkInterval int, retiresForEviction int, pMes *network.ProtocolMessenger) *LiveCheckTask

func (*LiveCheckTask) Execute

func (lt *LiveCheckTask) Execute()

Execute Kick off the worker

func (*LiveCheckTask) Stop

func (lt *LiveCheckTask) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL