timeservice

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultRoundTimeout timeout
	DefaultRoundTimeout = 6000
	// DefaultRoundTimeoutInterval interval
	DefaultRoundTimeoutInterval = 500
)

Variables

View Source
var (
	// RoundTimeout duration
	RoundTimeout time.Duration
	// RoundTimeoutInterval duration
	RoundTimeoutInterval time.Duration
)

Functions

func GetEventTimeout

func GetEventTimeout(evtType TimerEventType, roundIndex int32) time.Duration

GetEventTimeout returns the time duration per event type and consensus roundIndex

Types

type TimerEvent

type TimerEvent struct {
	View     uint64                 // view in the consensus
	Duration time.Duration          // timeout
	Type     maxbftpb.ConsStateType // Monitored events
}

TimerEvent defines a timer event

func (*TimerEvent) String

func (t *TimerEvent) String() string

type TimerEventType

type TimerEventType int

TimerEventType defines the consensus event type

const (
	PROPOSAL_BLOCK_TIMEOUT TimerEventType = iota
	VOTE_BLOCK_TIMEOUT
	ROUND_TIMEOUT
)

Events: proposal block, vote block, get transaction, empty block, commit block, heartbeat

type TimerService

type TimerService struct {
	// contains filtered or unexported fields
}

TimerService provides timer service

func NewTimerService

func NewTimerService(log protocol.Logger) *TimerService

NewTimerService initializes an instance of timer service

func (*TimerService) AddEvent

func (ts *TimerService) AddEvent(event *TimerEvent)

AddEvent adds an timer event to timer channel

func (*TimerService) GetFiredCh

func (ts *TimerService) GetFiredCh() <-chan *TimerEvent

GetFiredCh returns a channel to receive events

func (*TimerService) GetMonitorEvent

func (ts *TimerService) GetMonitorEvent() *TimerEvent

GetMonitorEvent return pacemakerEvent

func (*TimerService) Start

func (ts *TimerService) Start()

Start starts timer service

func (*TimerService) Stop

func (ts *TimerService) Stop()

Stop stops timer service

Jump to

Keyboard shortcuts

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