synchronization

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 9 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.BasicLogger, 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 Telemetry

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

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

type Trigger

type Trigger interface {
	TimesTriggered() uint64
	Stop()
}

func NewPeriodicalTrigger

func NewPeriodicalTrigger(ctx context.Context, interval time.Duration, logger supervised.Errorer, trigger func(), onStop func()) Trigger

Directories

Path Synopsis
Package supervised provides basic supervision abilities for running goroutines, namely making sure that panics are not swallowed and that long-running goroutines are restarted if they crash
Package supervised provides basic supervision abilities for running goroutines, namely making sure that panics are not swallowed and that long-running goroutines are restarted if they crash

Jump to

Keyboard shortcuts

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