timeservice

package
v0.0.0-...-e884bc7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultRoundTimeout         = 6000
	DefaultRoundTimeoutInterval = 500
)

Variables

View Source
var (
	RoundTimeout         time.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 {
	Index      uint64                 // Index of the local node in the validator collection of the current epoch
	Level      uint64                 // level in the consensus
	Height     uint64                 // Height in the consensus
	EpochId    uint64                 // EpochId in the consensus
	LevelIndex uint64                 // diff in the committed level and current level
	Duration   time.Duration          // timeout
	PreBlkHash []byte                 // only used in proposed event
	State      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 *logger.CMLogger) *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) 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