roundtimer

package
v0.2.1-rc.6 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RoundTimer

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

RoundTimer helps to manage current instance rounds. it should be killed (Kill()) once the instance finished and recreated for each new IBFT instance, in that case 'false' is returned in result channel. if round has timed-out, the timer returns 'true' in the result channel. upon new round, Reset() should be called to reset the timer with the new timeout.

func New

func New(pctx context.Context, logger *zap.Logger) *RoundTimer

New creates a new instance of RoundTimer

func (*RoundTimer) Kill

func (t *RoundTimer) Kill()

Kill kills the timer

func (*RoundTimer) Reset

func (t *RoundTimer) Reset(d time.Duration)

Reset will reset the underlying timer

func (*RoundTimer) ResultChan

func (t *RoundTimer) ResultChan() <-chan bool

ResultChan returns the result chan true if the timer lapsed or false if it was stopped

func (*RoundTimer) Stopped

func (t *RoundTimer) Stopped() bool

Stopped returns whether the timer has stopped

Jump to

Keyboard shortcuts

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