synchronization

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogTag = log.Service("block-tracker")

Functions

This section is empty.

Types

type BlockTracker

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

func NewBlockTracker

func NewBlockTracker(parent log.Logger, startingHeight uint64, graceDist uint16) *BlockTracker

func (*BlockTracker) IncrementTo added in v0.7.11

func (t *BlockTracker) IncrementTo(height primitives.BlockHeight)

func (*BlockTracker) WaitForBlock

func (t *BlockTracker) WaitForBlock(ctx context.Context, requestedHeight primitives.BlockHeight) error

waits until we reach a block at the specified height, or until the context is closed to wait until some timeout, pass a child context with a deadline

type NopHeightReporter added in v0.7.1

type NopHeightReporter struct{}

shim for BlockWriter

func (NopHeightReporter) IncrementTo added in v0.7.11

func (_ NopHeightReporter) IncrementTo(height primitives.BlockHeight)

type PeriodicalTrigger added in v1.2.1

type PeriodicalTrigger struct {
	govnr.TreeSupervisor

	Closed govnr.ContextEndedChan
	// contains filtered or unexported fields
}

the trigger is coupled with supervized package, this feels okay for now

func NewPeriodicalTrigger

func NewPeriodicalTrigger(ctx context.Context, name string, ticker Ticker, logger logfields.Errorer, trigger func(), onStop func()) *PeriodicalTrigger

func (*PeriodicalTrigger) Stop added in v1.2.1

func (t *PeriodicalTrigger) Stop()

type Ticker added in v1.3.0

type Ticker interface {
	// The channel on which the ticks are delivered.
	C() <-chan time.Time
	// Stop turns off a ticker. After Stop, no more ticks will be sent.
	// Stop does not close the channel, to prevent a concurrent goroutine
	// reading from the channel from seeing an erroneous "tick".
	Stop()
}

proxy interface for time.Ticker

func NewTimeTicker added in v1.3.0

func NewTimeTicker(d time.Duration) Ticker

type Timer

type Timer struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

This struct comes to work around the timer channel issue: https://github.com/golang/go/issues/11513 Google couldn't break the API or behavior, so they documented it https://github.com/golang/go/issues/14383 we just wrap the timer so we can reset and stop as expected without the workaround of the channel issue.

func NewTimer

func NewTimer(d time.Duration) *Timer

func NewTimerWithManualTick

func NewTimerWithManualTick() *Timer

used primarily for tests

func (*Timer) GetTimer

func (t *Timer) GetTimer() *time.Timer

func (*Timer) ManualTick

func (t *Timer) ManualTick()

used primarily for tests

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration) bool

func (*Timer) Stop

func (t *Timer) Stop() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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